Пример #1
0
        public IStorage OpenFile(string filename)
        {
            if (!FileDict.TryGetValue(filename, out PfsFileEntry file))
            {
                throw new FileNotFoundException();
            }

            return(OpenFile(file));
        }
Пример #2
0
        public Stream OpenFile(string filename)
        {
            if (!FileDict.TryGetValue(filename, out RomfsFile file))
            {
                throw new FileNotFoundException();
            }

            return(OpenFile(file));
        }
Пример #3
0
        public bool TryOpenFile(string filename, out IStorage storage)
        {
            if (!FileDict.TryGetValue(filename, out PfsFileEntry file))
            {
                storage = null;
                return(false);
            }

            storage = OpenFile(file);
            return(true);
        }
Пример #4
0
        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));
        }
Пример #5
0
        public bool TryOpenFile(string filename, out Stream stream)
        {
            if (!FileDict.TryGetValue(filename, out PfsFileEntry file))
            {
                stream = null;
                return(false);
            }

            stream = OpenFile(file);
            return(true);
        }
Пример #6
0
        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));
        }
Пример #7
0
        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);
        }
Пример #8
0
        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);
        }
Пример #9
0
        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));
        }