public static SubsectionDirectory Read(long lfaBase, BinaryReader r) { // Read directory section header var hdr = Misc.FromBinaryReader <SubsectionDirectoryHeader>(r); var sd = new SubsectionDirectory { Header = hdr }; // Read entry headers var eheaders = new DirectoryEntryHeader[(int)hdr.DirectoryCount]; for (int i = 0; i < hdr.DirectoryCount; i++) { eheaders[i] = Misc.FromBinaryReader <DirectoryEntryHeader>(r); } // Read directory entry contents sd.Sections = new SubsectionData[hdr.DirectoryCount]; for (int i = 0; i < hdr.DirectoryCount; i++) { sd.Sections[i] = SubsectionData.Read(lfaBase, eheaders[i], r); } return(sd); }
public static SubsectionData Read(long lfaBase, DirectoryEntryHeader hdr, BinaryReader r) { SubsectionData sd = null; switch (hdr.Type) { case SubsectionType.sstModule: sd = new sstModule(); break; case SubsectionType.sstSrcModule: sd = new sstSrcModule(); break; case SubsectionType.sstLibraries: sd = new sstLibraries(); break; case SubsectionType.sstGlobalSym: sd = new sstGlobalSym(); break; case SubsectionType.sstGlobalTypes: sd = new sstGlobalTypes(); break; case SubsectionType.sstSegName: sd = new sstSegName(); break; case SubsectionType.sstFileIndex: sd = new sstFileIndex(); break; } if (sd != null) { sd.Header = hdr; r.BaseStream.Position = lfaBase + hdr.ContentOffset; sd.Read(r); } return(sd); }