WriteBufferAsync() public static method

public static WriteBufferAsync ( [ file, [ buffer ) : IAsyncAction
file [
buffer [
return IAsyncAction
Ejemplo n.º 1
0
        private static async Task WriteBufferTaskAsync(string path, IBuffer buffer, CancellationToken cancellationToken)
        {
            if (path is null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            var file = await StorageFile.GetFileFromPathAsync(path);

            await FileIO.WriteBufferAsync(file, buffer).AsTask(cancellationToken);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Store data to file.
 /// </summary>
 /// <param name="folder">Folder of file.</param>
 /// <param name="fileName">Name of file.</param>
 /// <param name="options"><see cref="CreationCollisionOption"/> for the operation.</param>
 /// <param name="buffer">Data to store.</param>
 /// <returns>The stored file.</returns>
 public static IAsyncOperation <StorageFile> SaveFileAsync(this StorageFolder folder, string fileName, CreationCollisionOption options, IBuffer buffer)
 {
     if (folder == null)
     {
         throw new ArgumentNullException(nameof(folder));
     }
     return(Run(async token =>
     {
         fileName = StorageHelper.ToValidFileName(fileName);
         var file = await folder.CreateFileAsync(fileName, options);
         await FileIO.WriteBufferAsync(file, buffer);
         return file;
     }));
 }
 async public static Task WriteBufferAsync(this StorageFile file, IBuffer buffer)
 {
     await FileIO.WriteBufferAsync(file, buffer);
 }