public void Print(string path) { using (StreamWriter sw = new StreamWriter(path)) { sw.WriteLine($"Prefix Count: {Prefixes.Count}"); for (int i = 0; i < Prefixes.Count; i++) { sw.WriteLine($"[{i}] {Prefixes[i].Name}"); } sw.WriteLine(); sw.WriteLine($"Names Map 1 Count: {NameTrees[0].Entries.Count}"); for (int i = 0; i < NameTrees[0].Entries.Count; i++) { NDB0Entry entry = NameTrees[0].Entries[i]; sw.WriteLine($"[{i}] {entry.FullName,-75} > ID: {entry.SpecDBID}, ID2: {entry.AlphabeticalID}, Name: {entry.Name}, {entry.Prefixes.Count} Prefixes {(entry.Prefixes.Count > 0 ? $"({string.Join(", ", entry.Prefixes)})" : "")}"); } sw.WriteLine(); sw.WriteLine($"Names Map 2 Count: {NameTrees[1].Entries.Count}"); for (int i = 0; i < NameTrees[1].Entries.Count; i++) { NDB0Entry entry = NameTrees[1].Entries[i]; sw.WriteLine($"[{i}] {entry.FullName,-75} > SpecDBID: {entry.SpecDBID}, AlphabeticalID: {entry.AlphabeticalID}, Name: {entry.Name}, {entry.Prefixes.Count} Prefixes {(entry.Prefixes.Count > 0 ? $"({string.Join(", ", entry.Prefixes)})" : "")}"); } sw.Flush(); } }
private NDB0Tree DeserializeMapNames(BinaryStream bs) { uint unk = bs.ReadUInt32(); // 100 uint nameCount = bs.ReadUInt32(); bs.Position += 8; // Skip 5E 5E 5E 5E 5E 5E 5E 5E int basePos = (int)bs.Position; NDB0Tree entries = new NDB0Tree(); for (int i = 0; i < nameCount; i++) { bs.Position = basePos + (i * 0x10); var entry = new NDB0Entry(); entry.SpecDBID = bs.ReadUInt32(); entry.AlphabeticalID = bs.ReadUInt32(); uint nameOffset = bs.ReadUInt32(); int temp = (int)bs.Position; bs.Position = (int)nameOffset; entry.Name = bs.ReadString(StringCoding.ZeroTerminated); bs.Position = temp; for (int j = 0; j < 4; j++) { int prefixIndex = bs.ReadByte(); if (prefixIndex != byte.MaxValue) { entry.Prefixes.Add(Prefixes[prefixIndex].Name); } } entry.FullName = entry.ToString(); entries.Entries.Add(entry); } return(entries); }
public void Remove(NDB0Entry entry) { Entries.Remove(entry); Resort(); }
public void Add(NDB0Entry entry) { entry.FullName = entry.ToString(); Entries.Add(entry); Resort(); }