/// <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); } }
public IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options) { throw new NotImplementedException(); }
public override async Task <IRandomAccessStreamWithContentType> OpenAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => new RandomAccessStreamWithContentType(await FileRandomAccessStream.CreateFromSafUriAsync(_fileUri, accessMode), ContentType);
public override async Task <Stream> OpenStreamAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => File.Open(Path, FileMode.Open, ToFileAccess(accessMode), ToFileShare(options));
public override IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options) => throw new NotSupportedException();
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); }
internal Task <Stream> OpenStream(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => Implementation.OpenStreamAsync(ct, accessMode, options);
public IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options) => AsyncOperation <StorageStreamTransaction> .FromTask((ct, _) => Implementation.OpenTransactedWriteAsync(ct, options));
public override Task <StorageStreamTransaction> OpenTransactedWriteAsync(CancellationToken ct, StorageOpenOptions option) => throw NotSupported();
public override Task <IRandomAccessStreamWithContentType> OpenAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => throw NotSupported();
public override Task <Stream> OpenStreamAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => throw NotSupported();
internal Task <StorageStreamTransaction> OpenTransactedWrite(CancellationToken ct, StorageOpenOptions option) => _impl.OpenTransactedWrite(ct, option);
internal Task <Stream> OpenStream(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => _impl.OpenStream(ct, accessMode, options);
public abstract Task <StorageStreamTransaction> OpenTransactedWrite(CancellationToken ct, StorageOpenOptions option);
public IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options) => AsyncOperation <IRandomAccessStream> .FromTask(async (ct, _) => await Implementation.OpenAsync(ct, accessMode, options));
public override IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options) => throw new NotSupportedException();
internal Task <IRandomAccessStreamWithContentType> Open(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => Implementation.OpenAsync(ct, accessMode, options);
public override IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options) => File.OpenTransactedWriteAsync(options);
internal Task <StorageStreamTransaction> OpenTransactedWrite(CancellationToken ct, StorageOpenOptions option) => Implementation.OpenTransactedWriteAsync(ct, option);
public abstract IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options);
public override IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options) => OpenAsync(accessMode);
public abstract IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options);
public override async Task <IRandomAccessStreamWithContentType> OpenAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => new RandomAccessStreamWithContentType(FileRandomAccessStream.CreateLocal(Path, ToFileAccess(accessMode), ToFileShare(options)), ContentType);
public abstract Task <IRandomAccessStreamWithContentType> Open(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options);
public override async Task <StorageStreamTransaction> OpenTransactedWriteAsync(CancellationToken ct, StorageOpenOptions option) => new StorageStreamTransaction(Owner, ToFileShare(option));
public virtual async Task <Stream> OpenStream(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => (await Open(ct, accessMode, options).AsTask(ct)).AsStream();
public override Task <StorageStreamTransaction> OpenTransactedWriteAsync(CancellationToken ct, StorageOpenOptions option) => throw new NotImplementedException();
public IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options) { throw new NotImplementedException(); }