예제 #1
0
        public async Task <Stream> OpenFileAsync(FileSystemPath path, DesiredFileAccess access,
                                                 CancellationToken cancellationToken)
        {
            await AwaitExtensions.SwitchOffMainThreadAsync(cancellationToken);

            return(OpenFile(path, access));
        }
예제 #2
0
 public Stream OpenFile(FileSystemPath path, DesiredFileAccess access)
 {
     if (!path.IsFile)
     {
         throw new ArgumentException("The specified path is not a file.", "path");
     }
     return(File.Open(GetPhysicalPath(path), FileMode.Open, access.ToFileAccess()));
 }
예제 #3
0
        public Stream OpenFile(FileSystemPath path, DesiredFileAccess access)
        {
            if (!path.IsFile)
            {
                throw new ArgumentException("The specified path is no file.", "path");
            }
            MemoryFile file;

            if (!_files.TryGetValue(path, out file))
            {
                throw new FileNotFoundException();
            }
            return(new MemoryFileStream(file));
        }
예제 #4
0
 public static FileAccess ToFileAccess(this DesiredFileAccess desiredFileAccess)
 {
     return((FileAccess)desiredFileAccess);
 }