Пример #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);
 }