Last active
August 2, 2018 15:22
-
-
Save Delaire/7789ccad1a9a7caf89f847fbdbeb3ea6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IFileIoReaderHelper | |
{ | |
string ReadFromDefaultFile(string fileName); | |
} | |
public class FileIOReaderHelper : IFileIoReaderHelper | |
{ | |
//Read the content from Json file | |
public string ReadFromDefaultFile(string fileName) | |
{ | |
if (string.IsNullOrWhiteSpace(fileName)) | |
{ | |
throw new ArgumentNullException(nameof(fileName)); | |
} | |
Uri appUri = new Uri(fileName); | |
IStorageFile anjFile = StorageFile.GetFileFromApplicationUriAsync(appUri).AsTask().ConfigureAwait(false).GetAwaiter().GetResult(); | |
string txtFile = FileIO.ReadTextAsync(anjFile).AsTask().ConfigureAwait(false).GetAwaiter().GetResult(); | |
return txtFile; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment