public async Task <Stream> OpenFileAsync(FileSystemPath path, DesiredFileAccess access, CancellationToken cancellationToken) { await AwaitExtensions.SwitchOffMainThreadAsync(cancellationToken); return(OpenFile(path, access)); }
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())); }
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)); }
public static FileAccess ToFileAccess(this DesiredFileAccess desiredFileAccess) { return((FileAccess)desiredFileAccess); }