Пример #1
0
 public override async Task <bool> WriteToLocal(string filePath, object content)
 {
     using (var stream = context.OpenFileOutput(filePath, FileCreationMode.Private))
     {
         return(await DataAccessUtil.WriteToStream(stream, content));
     }
 }
Пример #2
0
        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));
            }
        }