Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3518)

Side by Side Diff: Src/GoogleApis.DotNet4/Apis/Util/Store/FileDataStore.cs

Issue 97380043: Issue 462: Improve FileDataStore implementation (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Patch Set: minor Created 9 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleWebAuthorizationBroker.cs ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright 2011 Google Inc 2 Copyright 2011 Google Inc
3 3
4 Licensed under the Apache License, Version 2.0 (the "License"); 4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License. 5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at 6 You may obtain a copy of the License at
7 7
8 http://www.apache.org/licenses/LICENSE-2.0 8 http://www.apache.org/licenses/LICENSE-2.0
9 9
10 Unless required by applicable law or agreed to in writing, software 10 Unless required by applicable law or agreed to in writing, software
(...skipping 19 matching lines...) Expand all
30 public class FileDataStore : IDataStore 30 public class FileDataStore : IDataStore
31 { 31 {
32 readonly string folderPath; 32 readonly string folderPath;
33 /// <summary>Gets the full folder path.</summary> 33 /// <summary>Gets the full folder path.</summary>
34 public string FolderPath { get { return folderPath; } } 34 public string FolderPath { get { return folderPath; } }
35 35
36 /// <summary> 36 /// <summary>
37 /// Constructs a new file data store with the specified folder. This fol der is created (if it doesn't exist· 37 /// Constructs a new file data store with the specified folder. This fol der is created (if it doesn't exist·
38 /// yet) under <see cref="Environment.SpecialFolder.ApplicationData"/>. 38 /// yet) under <see cref="Environment.SpecialFolder.ApplicationData"/>.
39 /// </summary> 39 /// </summary>
40 /// <param name="folder">Folder name.</param> 40 /// <param name="folderPath">
41 public FileDataStore(string folder) 41 /// Folder path. From version 1.8.2 this string contains the full path a nd not just a relative folder.
42 /// </param>
43 public FileDataStore(string folderPath)
42 { 44 {
43 folderPath = Path.Combine(Environment.GetFolderPath(Environment.Spec ialFolder.ApplicationData), folder); 45 folderPath = folderPath;
44 if (!Directory.Exists(folderPath)) 46 if (!Directory.Exists(folderPath))
45 { 47 {
46 Directory.CreateDirectory(folderPath); 48 Directory.CreateDirectory(folderPath);
47 } 49 }
48 } 50 }
49 51
50 /// <summary> 52 /// <summary>
51 /// Stores the given value for the given key. It creates a new file (nam ed <see cref="GenerateStoredKey"/>) in· 53 /// Stores the given value for the given key. It creates a new file (nam ed <see cref="GenerateStoredKey"/>) in·
52 /// <see cref="FolderPath"/>. 54 /// <see cref="FolderPath"/>.
53 /// </summary> 55 /// </summary>
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 140
139 /// <summary>Creates a unique stored key based on the key and the class type.</summary> 141 /// <summary>Creates a unique stored key based on the key and the class type.</summary>
140 /// <param name="key">The object key.</param> 142 /// <param name="key">The object key.</param>
141 /// <param name="t">The type to store or retrieve.</param> 143 /// <param name="t">The type to store or retrieve.</param>
142 public static string GenerateStoredKey(string key, Type t) 144 public static string GenerateStoredKey(string key, Type t)
143 { 145 {
144 return string.Format("{0}-{1}", t.FullName, key); 146 return string.Format("{0}-{1}", t.FullName, key);
145 } 147 }
146 } 148 }
147 } 149 }
OLDNEW
« no previous file with comments | « Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleWebAuthorizationBroker.cs ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b