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

Side by Side Diff: Src/GoogleApis.Windows/Apis/Util/Store/StorageDataStore.cs

Issue 176220043: Issue 471: Support WP8.1 (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Patch Set: minor Created 9 years, 4 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.WP81/packages.config ('k') | Src/GoogleApis.Windows/GoogleApis.Windows.csproj » ('j') | 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 2013 Google Inc 2 Copyright 2013 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 11 matching lines...) Expand all
22 22
23 using Google.Apis.Json; 23 using Google.Apis.Json;
24 using Google.Apis.Logging; 24 using Google.Apis.Logging;
25 25
26 namespace Google.Apis.Util.Store 26 namespace Google.Apis.Util.Store
27 { 27 {
28 /// <summary> 28 /// <summary>
29 /// Windows Store data store that implements <see cref="IDataStore"/>. This store creates a different file for each· 29 /// Windows Store data store that implements <see cref="IDataStore"/>. This store creates a different file for each·
30 /// combination of type and key. 30 /// combination of type and key.
31 /// </summary> 31 /// </summary>
32 public class StroageDataStore : IDataStore 32 public class StorageDataStore : IDataStore
33 { 33 {
34 // TODO(peleyal): consider adding also PasswordValutDataStore 34 // TODO(peleyal): consider adding also PasswordValutDataStore
35 35
36 private static readonly StorageFolder LocalFolder = ApplicationData.Curr ent.LocalFolder; 36 private static readonly StorageFolder LocalFolder = ApplicationData.Curr ent.LocalFolder;
37 private static readonly ILogger Logger = ApplicationContext.Logger.ForTy pe<StroageDataStore>(); 37 private static readonly ILogger Logger = ApplicationContext.Logger.ForTy pe<StorageDataStore>();
38 38
39 #region IDataStore Members 39 #region IDataStore Members
40 40
41 public async Task StoreAsync<T>(string key, T value) 41 public async Task StoreAsync<T>(string key, T value)
42 { 42 {
43 StorageFile file = await LocalFolder.CreateFileAsync(GenerateStoredK ey(key, typeof(T)), 43 StorageFile file = await LocalFolder.CreateFileAsync(GenerateStoredK ey(key, typeof(T)),
44 CreationCollisionOption.ReplaceExisting); 44 CreationCollisionOption.ReplaceExisting);
45 45
46 var content = Encoding.UTF8.GetBytes(NewtonsoftJsonSerializer.Instan ce.Serialize(value)); 46 var content = Encoding.UTF8.GetBytes(NewtonsoftJsonSerializer.Instan ce.Serialize(value));
47 using (var stream = await file.OpenStreamForWriteAsync().ConfigureAw ait(false)) 47 using (var stream = await file.OpenStreamForWriteAsync().ConfigureAw ait(false))
(...skipping 28 matching lines...) Expand all
76 } 76 }
77 77
78 #endregion 78 #endregion
79 79
80 private string GenerateStoredKey(string key, Type t) 80 private string GenerateStoredKey(string key, Type t)
81 { 81 {
82 return string.Format("{0}-{1}", t.FullName, key); 82 return string.Format("{0}-{1}", t.FullName, key);
83 } 83 }
84 } 84 }
85 } 85 }
OLDNEW
« no previous file with comments | « Src/GoogleApis.WP81/packages.config ('k') | Src/GoogleApis.Windows/GoogleApis.Windows.csproj » ('j') | no next file with comments »

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