public void Load(Stream stream) { CanSave = true; using (var reader = new FileReader(stream)) { CheckEndianness(reader); isBigEndian = reader.IsBigEndian; uint Count = reader.ReadUInt32(); Console.WriteLine($"Count {Count}"); uint[] Offsets = new uint[Count]; uint[] Sizes = new uint[Count]; for (int i = 0; i < Count; i++) { Offsets[i] = reader.ReadUInt32(); Sizes[i] = reader.ReadUInt32(); } for (int i = 0; i < Count; i++) { var fileEntry = new FileEntry(); reader.SeekBegin(Offsets[i]); string Magic = reader.ReadString(4); reader.Seek(-4); reader.SeekBegin(Offsets[i]); fileEntry.FileData = reader.ReadBytes((int)Sizes[i]); fileEntry.FileName = $"File {i}"; switch (Magic) { case "GT1G": //Textures case "G1TG": //Textures G1T GITextureU = new G1T(); GITextureU.FileName = $"TextureContainer{i}.gt1"; GITextureU.Load(new MemoryStream(fileEntry.FileData)); Nodes.Add(GITextureU); fileEntry.FileFormat = GITextureU; break; default: break; } files.Add(fileEntry); } } }
public GITexture(G1T GT1) { ContainerParent = GT1; }