private UiNode[] ExpandTrbChilds() { ImgbArchiveAccessor imgbAccessor = new ImgbArchiveAccessor(_listing, _indices, _binary); SeDbArchiveListing sedbListing = SeDbArchiveListingReader.Read(imgbAccessor); UiNode[] result = new UiNode[sedbListing.Count]; int offset = sedbListing.Count * 16 + 0x40; using (Stream headers = imgbAccessor.ExtractHeaders()) using (BinaryReader br = new BinaryReader(headers)) { for (int i = 0; i < result.Length; i++) { SeDbResEntry entry = sedbListing[i]; String name = entry.Index.ToString(); SectionType type; if (TryReadSectionType(br, offset, entry, out type)) { name = name + "." + type.ToString().ToLower(); } result[i] = new UiSeDbTableLeaf(name, entry, sedbListing) { Parent = this }; } } return(result); }
private static bool TryReadSectionType(BinaryReader br, int offset, SeDbResEntry entry, out SectionType type) { br.BaseStream.SetPosition(entry.Offset + offset); int magic = br.ReadInt32(); if (magic != SectionHeader.MagicNumber) { type = 0; return(false); } type = (SectionType)br.ReadInt32(); return(true); }
public UiSeDbTableLeaf(string name, SeDbResEntry entry, SeDbArchiveListing listing) : base(name, UiNodeType.FileTableLeaf) { Entry = entry; Listing = listing; }