This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed
Examples/CodePushDemoApp/windows/CodePushDemoApp
windows/CodePush.Net46/Adapters/Storage Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -62,11 +62,12 @@ public class ApplicationDataContainer
62
62
private readonly SemaphoreSlim mutex = new SemaphoreSlim ( 1 , 1 ) ;
63
63
64
64
const string STORAGE_NAME = "AppStorage.data" ;
65
- IFile storageFile = null ;
65
+ string storageFileName = null ;
66
66
67
67
public ApplicationDataContainer ( string name = STORAGE_NAME )
68
68
{
69
- storageFile = FileSystem . Current . LocalStorage . CreateFileAsync ( name , CreationCollisionOption . OpenIfExists ) . Result ;
69
+ storageFileName = name ;
70
+ var storageFile = FileSystem . Current . LocalStorage . CreateFileAsync ( storageFileName , CreationCollisionOption . OpenIfExists ) . Result ;
70
71
var data = CodePushUtils . GetJObjectFromFileAsync ( storageFile ) . Result ;
71
72
72
73
if ( data != null )
@@ -90,14 +91,16 @@ async Task SaveAsync()
90
91
{
91
92
await mutex . WaitAsync ( ) . ConfigureAwait ( false ) ;
92
93
var jobject = JObject . FromObject ( Values ) ;
94
+ var storageFile = await FileSystem . Current . LocalStorage . CreateFileAsync ( storageFileName , CreationCollisionOption . OpenIfExists ) . ConfigureAwait ( false ) ;
93
95
await storageFile . WriteAllTextAsync ( JsonConvert . SerializeObject ( jobject ) ) . ConfigureAwait ( false ) ;
94
96
mutex . Release ( ) ;
95
97
}
96
98
97
99
public async Task DeleteAsync ( )
98
100
{
99
101
Values . Clear ( ) ;
100
- await storageFile . DeleteAsync ( ) ;
102
+ var storageFile = await FileSystem . Current . LocalStorage . CreateFileAsync ( storageFileName , CreationCollisionOption . OpenIfExists ) . ConfigureAwait ( false ) ;
103
+ await storageFile . DeleteAsync ( ) . ConfigureAwait ( false ) ;
101
104
}
102
105
}
103
106
}
You can’t perform that action at this time.
0 commit comments