public override async Task <bool> WriteToLocal(string filePath, object content) { using (var stream = context.OpenFileOutput(filePath, FileCreationMode.Private)) { return(await DataAccessUtil.WriteToStream(stream, content)); } }
private async Task <bool> Write(string filePath, StorageFolder root, object content) { var folderPathAndFileName = ExtractFolderPathAndFileName(filePath); StorageFolder folder = await GetFolderAsync(folderPathAndFileName.FolderPath, root); if (folder == null) { folder = await root.CreateFolderAsync(folderPathAndFileName.FolderPath); } StorageFile file = await folder.CreateFileAsync(folderPathAndFileName.FileName, CreationCollisionOption.ReplaceExisting); using (Stream stream = await file.OpenStreamForWriteAsync()) { return(await DataAccessUtil.WriteToStream(stream, content)); } }