public void Load(EndianBinaryReader stream) { if (stream == null || stream.BaseStream.Length == 0) throw new ArgumentException("Null or empty stream specified", "stream"); // Read the header byte entryCount = stream.ReadByte(); stream.Skip(3); // Unknown Constants (0x5E, 0, 0x61) // Offset to the first entry (realistically it's right after the header and always 0x8 int offsetToFirstEntry = stream.ReadInt32(); // Load categories and their entries. stream.BaseStream.Position = offsetToFirstEntry; for(int i = 0; i < entryCount; i++) { Category category = new Category(); category.Load(stream); Categories.Add(category); } }
private void AddCategory() { if (LoadedFile == null) throw new InvalidOperationException("Cannot add category when no file is loaded!"); Category newCategory = new Category(); LoadedFile.Categories.Add(newCategory); SelectedCategory = newCategory; }