public Stream OpenFile(string filename) { if (!FileDict.TryGetValue(filename, out RomfsFile file)) { throw new FileNotFoundException(); } return(OpenFile(file)); }
public IStorage OpenFile(string filename) { if (!FileDict.TryGetValue(filename, out PfsFileEntry 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 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); }
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); }
public void LoadObjFile(string objPath, Vector3 scaleSize, Transform parent) { FileDict.Clear(); loaded = false; IsObjModelLoaded = false; parentTransform = parent; modelScaleSize = scaleSize; objFilePath = objPath; Thread readFileThread = new Thread(new ParameterizedThreadStart(ReadFiles)); readFileThread.Start(objPath); }
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)); }
public DirectoryEntryType GetEntryType(string path) { path = PathTools.Normalize(path); if (path == "/") { return(DirectoryEntryType.Directory); } if (FileDict.ContainsKey(path.TrimStart('/'))) { return(DirectoryEntryType.File); } return(DirectoryEntryType.NotFound); }
public DirectoryEntryType GetEntryType(string path) { path = PathTools.Normalize(path); if (path == "/") { return(DirectoryEntryType.Directory); } if (FileDict.ContainsKey(path)) { return(DirectoryEntryType.File); } throw new FileNotFoundException(path); }
protected override Result GetEntryTypeImpl(out DirectoryEntryType entryType, U8Span path) { entryType = default; if (path.ToString() == "/") { entryType = DirectoryEntryType.Directory; return(Result.Success); } if (FileDict.ContainsKey(path.ToString().TrimStart('/'))) { entryType = DirectoryEntryType.File; return(Result.Success); } return(ResultFs.PathNotFound.Log()); }
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path) { UnsafeHelpers.SkipParamInit(out entryType); if (path.ToString() == "/") { entryType = DirectoryEntryType.Directory; return(Result.Success); } if (FileDict.ContainsKey(path.ToString().TrimStart('/'))) { entryType = DirectoryEntryType.File; return(Result.Success); } return(ResultFs.PathNotFound.Log()); }
protected override Result GetEntryTypeImpl(out DirectoryEntryType entryType, string path) { entryType = DirectoryEntryType.NotFound; path = PathTools.Normalize(path); if (path == "/") { entryType = DirectoryEntryType.Directory; return(Result.Success); } if (FileDict.ContainsKey(path.TrimStart('/'))) { entryType = DirectoryEntryType.File; return(Result.Success); } return(ResultFs.PathNotFound.Log()); }
public bool FileExists(string path) { path = PathTools.Normalize(path).TrimStart('/'); return(FileDict.ContainsKey(path)); }
public bool FileExists(string filename) => FileDict.ContainsKey(filename);
public bool FileExists(string filename) { return(FileDict.ContainsKey(filename)); }