public IStorage OpenFile(string filename) { if (!FileDict.TryGetValue(filename, out PfsFileEntry file)) { throw new FileNotFoundException(); } return(OpenFile(file)); }
public Stream OpenFile(string filename) { if (!FileDict.TryGetValue(filename, out RomfsFile file)) { throw new FileNotFoundException(); } return(OpenFile(file)); }
public bool TryOpenFile(string filename, out IStorage storage) { if (!FileDict.TryGetValue(filename, out PfsFileEntry file)) { storage = null; return(false); } storage = OpenFile(file); return(true); }
public IFile OpenFile(string path, OpenMode mode) { path = PathTools.Normalize(path).TrimStart('/'); if (!FileDict.TryGetValue(path, out PartitionFileEntry entry)) { ThrowHelper.ThrowResult(ResultFs.PathNotFound); } return(OpenFile(entry, mode)); }
public bool TryOpenFile(string filename, out Stream stream) { if (!FileDict.TryGetValue(filename, out PfsFileEntry file)) { stream = null; return(false); } stream = OpenFile(file); return(true); }
public IFile OpenFile(string path, OpenMode mode) { path = PathTools.Normalize(path).TrimStart('/'); if (!FileDict.TryGetValue(path, out PartitionFileEntry entry)) { throw new FileNotFoundException(); } return(OpenFile(entry, mode)); }
protected override Result OpenFileImpl(out IFile file, string path, OpenMode mode) { path = PathTools.Normalize(path).TrimStart('/'); if (!FileDict.TryGetValue(path, out PartitionFileEntry entry)) { ThrowHelper.ThrowResult(ResultFs.PathNotFound); } file = OpenFile(entry, mode); return(Result.Success); }
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode) { path = PathTools.Normalize(path.ToString()).TrimStart('/').ToU8Span(); if (!FileDict.TryGetValue(path.ToString(), out PartitionFileEntry entry)) { ThrowHelper.ThrowResult(ResultFs.PathNotFound.Value); } file = OpenFile(entry, mode); return(Result.Success); }
public IFile OpenFile(string path, OpenMode mode) { path = PathTools.Normalize(path); if (!FileDict.TryGetValue(path, out ArchiveFileInfo file)) { throw new FileNotFoundException(); } if (mode != OpenMode.Read) { throw new ArgumentOutOfRangeException(nameof(mode), "RomFs files must be opened read-only."); } return(OpenFile(file)); }