Created
March 14, 2014 16:36
-
-
Save derikwhittaker/9551405 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
private const string BaseFilePath = "JsonSerialization/json/"; | |
public async static Task<string> DirectorySearchJson() | |
{ | |
return await ReadFile(BaseFilePath + "DirectorySearchResults.json.txt"); | |
} | |
private async static Task<string> ReadFile(string fileName) | |
{ | |
var jsonFile = Path.Combine(Package.Current.InstalledLocation.Path, fileName); | |
var jsonFolder = await StorageFolder.GetFolderFromPathAsync(Path.GetDirectoryName(jsonFile)); | |
using (var jsonStream = await jsonFolder.OpenStreamForReadAsync(Path.GetFileName(jsonFile))) | |
{ | |
using (var streamReader = new StreamReader(jsonStream)) | |
{ | |
var json = streamReader.ReadToEnd(); | |
return json; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment