Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Parse/Internal/Storage/Controller/StorageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
TaskQueue Queue { get; } = new TaskQueue { };

/// <summary>
/// Creates a Parse storage controller and attempts to extract a previously created settings storage file from the persistent storage location.
/// Creates a Parse storage controller with the default file wrapper.
/// </summary>
public StorageController() => Storage = new StorageDictionary(File = StorageManager.PersistentStorageFileWrapper);
public StorageController() => File = StorageManager.PersistentStorageFileWrapper;

/// <summary>
/// Creates a Parse storage controller with the provided <paramref name="file"/> wrapper.
Expand All @@ -156,7 +156,7 @@ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
/// Loads a settings dictionary from the file wrapped by <see cref="File"/>.
/// </summary>
/// <returns>A storage dictionary containing the deserialized content of the storage file targeted by the <see cref="StorageController"/> instance</returns>
public Task<IStorageDictionary<string, object>> LoadAsync() => Queue.Enqueue(toAwait => toAwait.ContinueWith(_ => Task.FromResult((IStorageDictionary<string, object>) Storage) ?? (Storage = new StorageDictionary(File)).LoadAsync().OnSuccess(__ => Storage as IStorageDictionary<string, object>)).Unwrap(), CancellationToken.None);
public Task<IStorageDictionary<string, object>> LoadAsync() => Queue.Enqueue(toAwait => toAwait.ContinueWith(_ => (Storage != null) ? Task.FromResult((IStorageDictionary<string, object>) Storage) : (Storage = new StorageDictionary(File)).LoadAsync().OnSuccess(__ => Storage as IStorageDictionary<string, object>)).Unwrap(), CancellationToken.None);

/// <summary>
///
Expand Down
2 changes: 1 addition & 1 deletion Parse/Internal/Utilities/StorageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static async Task WriteToAsync(this FileInfo file, string content)
/// <returns>A task that should contain the little-endian 16-bit character string (UTF-16) extracted from the <paramref name="file"/> if the read completes successfully</returns>
public static async Task<string> ReadAllTextAsync(this FileInfo file)
{
using (StreamReader reader = file.OpenText())
using (var reader = new StreamReader(file.FullName, Encoding.Unicode))
return await reader.ReadToEndAsync();
}

Expand Down