public SaveDataFileSystemCore(IStorage storage, IStorage allocationTable, IStorage header) { HeaderStorage = header; BaseStorage = storage; AllocationTable = new AllocationTable(allocationTable, header.Slice(0x18, 0x30)); Header = new SaveHeader(HeaderStorage); AllocationTableStorage dirTableStorage = OpenFatStorage(AllocationTable.Header.DirectoryTableBlock); AllocationTableStorage fileTableStorage = OpenFatStorage(AllocationTable.Header.FileTableBlock); FileTable = new HierarchicalSaveFileTable(dirTableStorage, fileTableStorage); }
public IEnumerable <DirectoryEntry> Read() { SaveFindPosition position = InitialPosition; HierarchicalSaveFileTable tab = ParentFileSystem.FileTable; if (Mode.HasFlag(OpenDirectoryMode.Directories)) { while (tab.FindNextDirectory(ref position, out string name)) { yield return(new DirectoryEntry(name, PathTools.Combine(FullPath, name), DirectoryEntryType.Directory, 0)); } } if (Mode.HasFlag(OpenDirectoryMode.Files)) { while (tab.FindNextFile(ref position, out SaveFileInfo info, out string name)) { yield return(new DirectoryEntry(name, PathTools.Combine(FullPath, name), DirectoryEntryType.File, info.Length)); } } }