예제 #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);
            }
        }
예제 #3
0
 public IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options)
 {
     throw new NotImplementedException();
 }
예제 #4
0
 public override async Task <IRandomAccessStreamWithContentType> OpenAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) =>
 new RandomAccessStreamWithContentType(await FileRandomAccessStream.CreateFromSafUriAsync(_fileUri, accessMode), ContentType);
예제 #5
0
 public override async Task <Stream> OpenStreamAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => File.Open(Path, FileMode.Open, ToFileAccess(accessMode), ToFileShare(options));
예제 #6
0
 public override IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options) => throw new NotSupportedException();
예제 #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);
            }
예제 #8
0
 internal Task <Stream> OpenStream(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => Implementation.OpenStreamAsync(ct, accessMode, options);
예제 #9
0
 public IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options)
 => AsyncOperation <StorageStreamTransaction> .FromTask((ct, _) => Implementation.OpenTransactedWriteAsync(ct, options));
예제 #10
0
 public override Task <StorageStreamTransaction> OpenTransactedWriteAsync(CancellationToken ct, StorageOpenOptions option) => throw NotSupported();
예제 #11
0
 public override Task <IRandomAccessStreamWithContentType> OpenAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => throw NotSupported();
예제 #12
0
 public override Task <Stream> OpenStreamAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) => throw NotSupported();
예제 #13
0
 internal Task <StorageStreamTransaction> OpenTransactedWrite(CancellationToken ct, StorageOpenOptions option)
 => _impl.OpenTransactedWrite(ct, option);
예제 #14
0
 internal Task <Stream> OpenStream(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => _impl.OpenStream(ct, accessMode, options);
예제 #15
0
 public abstract Task <StorageStreamTransaction> OpenTransactedWrite(CancellationToken ct, StorageOpenOptions option);
예제 #16
0
 public IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options)
 => AsyncOperation <IRandomAccessStream> .FromTask(async (ct, _) => await Implementation.OpenAsync(ct, accessMode, options));
예제 #17
0
 public override IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options) => throw new NotSupportedException();
예제 #18
0
 internal Task <IRandomAccessStreamWithContentType> Open(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => Implementation.OpenAsync(ct, accessMode, options);
예제 #19
0
 public override IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options) => File.OpenTransactedWriteAsync(options);
예제 #20
0
 internal Task <StorageStreamTransaction> OpenTransactedWrite(CancellationToken ct, StorageOpenOptions option)
 => Implementation.OpenTransactedWriteAsync(ct, option);
예제 #21
0
 public abstract IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options);
예제 #22
0
 public override IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options) => OpenAsync(accessMode);
예제 #23
0
 public abstract IAsyncOperation <StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options);
예제 #24
0
 public override async Task <IRandomAccessStreamWithContentType> OpenAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => new RandomAccessStreamWithContentType(FileRandomAccessStream.CreateLocal(Path, ToFileAccess(accessMode), ToFileShare(options)), ContentType);
예제 #25
0
 public abstract Task <IRandomAccessStreamWithContentType> Open(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options);
예제 #26
0
 public override async Task <StorageStreamTransaction> OpenTransactedWriteAsync(CancellationToken ct, StorageOpenOptions option)
 => new StorageStreamTransaction(Owner, ToFileShare(option));
예제 #27
0
 public virtual async Task <Stream> OpenStream(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options)
 => (await Open(ct, accessMode, options).AsTask(ct)).AsStream();
예제 #28
0
 public override Task <StorageStreamTransaction> OpenTransactedWriteAsync(CancellationToken ct, StorageOpenOptions option) => throw new NotImplementedException();
예제 #29
0
 public IAsyncOperation <IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options)
 {
     throw new NotImplementedException();
 }