Exemplo n.º 1
0
 /// <summary>
 /// Opens a random-access stream over the file.
 /// </summary>
 ///
 /// <param name="accessMode">The type of access to allow.</param>
 /// <param name="options">
 /// The allowed interactions between multiple streams reading from or
 /// writing to this file.
 /// </param>
 ///
 /// <returns>
 /// A stream providing access to the data within the file, once the
 /// <see cref="Task{TResult}"/> completes.
 /// </returns>
 public Task <FileStream> OpenAsync(
     FileAccessMode accessMode,
     StorageOpenOptions options = StorageOpenOptions.None
     )
 {
     throw new NotImplementedException();
 }
        public WindowsUniversalFileStream(string fileName, StorageFolder directory, FileAccessMode mode, CreationCollisionOption collisionOptions, StorageOpenOptions openOptions, int length = 1024 * 80, int writeBufferSize = 1024 * 80, int readBufferSize = 1024 * 80)
        {
            if (fileName == null || fileName == string.Empty)
            {
                throw new ArgumentNullException("path");
            }

            Directory        = directory;
            FileName         = fileName;
            Mode             = mode;
            CollisionOptions = collisionOptions;
            OpenOptions      = openOptions;

            WriteBufferSize = writeBufferSize;
            ReadBufferSize  = readBufferSize;

            RandomAccessStream = Directory.CreateFileAsync(FileName, collisionOptions).AsTask().Result.OpenAsync(mode, openOptions).AsTask().Result;
            ReadStream         = RandomAccessStream.AsStreamForRead(ReadBufferSize);
            ReadStream.SetLength(length);

            if (mode == FileAccessMode.ReadWrite)
            {
                WriteStream = RandomAccessStream.AsStreamForWrite(WriteBufferSize);
            }
        }
Exemplo n.º 3
0
 public IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 4
0
 public override async Task <IRandomAccessStreamWithContentType> OpenAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) =>
 new RandomAccessStreamWithContentType(await FileRandomAccessStream.CreateFromSafUriAsync(_fileUri, accessMode), ContentType);
Exemplo n.º 5
0
 public override async Task <Stream> OpenStreamAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => File.Open(Path, FileMode.Open, ToFileAccess(accessMode), ToFileShare(options));
Exemplo n.º 6
0
 public override IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options) => throw new NotSupportedException();
Exemplo n.º 7
0
            public override async Task <Stream> OpenStreamAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
            {
                Func <Stream> streamBuilder = () => File.Open(Path, FileMode.Open, ToFileAccess(accessMode), ToFileShare(options));
                var           streamWrapper = new SecurityScopeStreamWrapper(_nsUrl, streamBuilder);

                return(streamWrapper);
            }
Exemplo n.º 8
0
 internal Task <Stream> OpenStream(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => Implementation.OpenStreamAsync(ct, accessMode, options);
Exemplo n.º 9
0
 public IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options)
 => AsyncOperation <StorageStreamTransaction> .FromTask((ct, _) => Implementation.OpenTransactedWriteAsync(ct, options));
Exemplo n.º 10
0
 public override Task <StorageStreamTransaction> OpenTransactedWriteAsync(CancellationToken ct, StorageOpenOptions option) => throw NotSupported();
Exemplo n.º 11
0
 public override Task <IRandomAccessStreamWithContentType> OpenAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => throw NotSupported();
Exemplo n.º 12
0
 public override Task <Stream> OpenStreamAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => throw NotSupported();
Exemplo n.º 13
0
 internal Task <StorageStreamTransaction> OpenTransactedWrite(CancellationToken ct, StorageOpenOptions option)
 => _impl.OpenTransactedWrite(ct, option);
Exemplo n.º 14
0
 internal Task <Stream> OpenStream(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => _impl.OpenStream(ct, accessMode, options);
Exemplo n.º 15
0
 public abstract Task <StorageStreamTransaction> OpenTransactedWrite(CancellationToken ct, StorageOpenOptions option);
Exemplo n.º 16
0
 public IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options)
 => AsyncOperation <IRandomAccessStream> .FromTask(async (ct, _) => await Implementation.OpenAsync(ct, accessMode, options));
Exemplo n.º 17
0
 public override IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options) => throw new NotSupportedException();
Exemplo n.º 18
0
 internal Task <IRandomAccessStreamWithContentType> Open(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => Implementation.OpenAsync(ct, accessMode, options);
Exemplo n.º 19
0
 public override IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options) => File.OpenTransactedWriteAsync(options);
Exemplo n.º 20
0
 internal Task <StorageStreamTransaction> OpenTransactedWrite(CancellationToken ct, StorageOpenOptions option)
 => Implementation.OpenTransactedWriteAsync(ct, option);
Exemplo n.º 21
0
 public abstract IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options);
Exemplo n.º 22
0
 public override IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options) => OpenAsync(accessMode);
Exemplo n.º 23
0
 public abstract IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options);
Exemplo n.º 24
0
 public override async Task <IRandomAccessStreamWithContentType> OpenAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => new RandomAccessStreamWithContentType(FileRandomAccessStream.CreateLocal(Path, ToFileAccess(accessMode), ToFileShare(options)), ContentType);
Exemplo n.º 25
0
 public abstract Task <IRandomAccessStreamWithContentType> Open(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options);
Exemplo n.º 26
0
 public override async Task <StorageStreamTransaction> OpenTransactedWriteAsync(CancellationToken ct, StorageOpenOptions option)
 => new StorageStreamTransaction(Owner, ToFileShare(option));
Exemplo n.º 27
0
 public virtual async Task <Stream> OpenStream(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => (await Open(ct, accessMode, options).AsTask(ct)).AsStream();
Exemplo n.º 28
0
 public override Task <StorageStreamTransaction> OpenTransactedWriteAsync(CancellationToken ct, StorageOpenOptions option) => throw new NotImplementedException();
Exemplo n.º 29
0
 public IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options)
 {
     throw new NotImplementedException();
 }