private Stream OpenFile(int index) { FATEntry fatEntry = FAT[index]; uint len = fatEntry.End - fatEntry.Start; return(new SubStream(DataStream, fatEntry.Start, len)); }
public Pointer GetStructPtr(FATEntry.Type type, ushort index, bool global = false) { FATEntry entry = GetEntry(type, index, global: global); if (entry != null) { return(new Pointer(entry.off_data, files_array[SMem.Data])); } else { return(null); } }
public FAT(EndianBinaryReader er) { long baseoffset = er.BaseStream.Position; Signature = er.ReadString(Encoding.ASCII, 4); if (Signature != "FAT ") { throw new SignatureNotCorrectException(Signature, "FAT ", er.BaseStream.Position - 4); } SectionSize = er.ReadUInt32(); NrEntries = er.ReadUInt32(); Entries = new FATEntry[NrEntries]; for (int i = 0; i < NrEntries; i++) { Entries[i] = new FATEntry(er); } er.BaseStream.Position = baseoffset + SectionSize; }
public FATEntry GetEntry(ushort type, ushort index, bool global = false) { type = (ushort)(type & 0x7FFF); index = (ushort)(index & 0x7FFF); FATEntry levelEntry = fatTables[CurrentLevel + 2].entries.FirstOrDefault(e => e.type == type && e.index == index); if (levelEntry != null) { return(levelEntry); } FATEntry fix2Entry = fatTables[1].entries.FirstOrDefault(e => e.type == type && e.index == index); if (fix2Entry != null) { return(fix2Entry); } FATEntry fixEntry = fatTables[0].entries.FirstOrDefault(e => e.type == type && e.index == index); if (fixEntry != null) { return(fixEntry); } if (global) { for (int i = 2; i < fatTables.Length; i++) { if (i == CurrentLevel + 2) { continue; } FATEntry entry = fatTables[i].entries.FirstOrDefault(e => e.type == type && e.index == index); if (entry != null) { return(entry); } } } return(null); }
public FATEntry GetEntry(FATEntry.Type type, ushort index, bool global = false) { bool isFix = (index & (ushort)FATEntry.Flag.Fix) == (ushort)FATEntry.Flag.Fix; ushort ind = (ushort)(index & 0x7FFF); if (!global) { if (!isFix) { FATEntry levelEntry = fatTables[CurrentLevel + 2].GetEntry(type, ind); if (levelEntry != null) { return(levelEntry); } FATEntry fix2Entry = fatTables[1].GetEntry(type, ind); if (fix2Entry != null) { return(fix2Entry); } } else { FATEntry fixEntry = fatTables[0].GetEntry(type, ind); if (fixEntry != null) { return(fixEntry); } } } else { FATEntry levelEntry = fatTables[CurrentLevel + 2].GetEntry(type, ind); if (levelEntry != null) { return(levelEntry); } FATEntry fix2Entry = fatTables[1].GetEntry(type, ind); if (fix2Entry != null) { return(fix2Entry); } FATEntry fixEntry = fatTables[0].GetEntry(type, ind); if (fixEntry != null) { return(fixEntry); } for (int i = 2; i < fatTables.Length; i++) { if (i == CurrentLevel + 2) { continue; } FATEntry entry = fatTables[i].GetEntry(type, ind); if (entry != null) { return(entry); } } } return(null); }
private void AccolateCluster() { FATEntry target = BPB.FileTable.NextFreeFATEntry(); }