public GAR_Parser(Stream stream) { using (var reader = new FileReader(stream, true)) { Signature = reader.ReadString(4, Encoding.ASCII); switch (Signature) { case "ZAR\x01": Version = VersionMagic.ZAR1; break; case "GAR\x02": Version = VersionMagic.GAR2; break; case "GAR\x05": Version = VersionMagic.GAR5; break; } uint FileSize = reader.ReadUInt32(); FileGroupCount = reader.ReadUInt16(); FileCount = reader.ReadUInt16(); FileGroupOffset = reader.ReadUInt32(); FileInfoOffset = reader.ReadUInt32(); DataOffset = reader.ReadUInt32(); Codename = reader.ReadString(0x08); switch (Codename) { case "queen\0\0\0": case "jenkins\0": ReadZeldaArchive(reader); break; case "agora\0\0\0": case "SYSTEM\0\0": ReadSystemGrezzoArchive(reader); break; default: throw new Exception($"Unexpected codename! {Codename}"); } } }
public void Read(FileReader reader, List <FileEntry> files) { reader.ByteOrder = Syroot.BinaryData.ByteOrder.LittleEndian; string Signature = reader.ReadString(4, Encoding.ASCII); switch (Signature) { case "ZAR\x01": Version = VersionMagic.ZAR1; break; case "GAR\x02": Version = VersionMagic.GAR2; break; case "GAR\x05": Version = VersionMagic.GAR5; break; } FileSize = reader.ReadUInt32(); FileGroupCount = reader.ReadUInt16(); FileCount = reader.ReadUInt16(); FileGroupOffset = reader.ReadUInt32(); FileInfoOffset = reader.ReadUInt32(); DataOffset = reader.ReadUInt32(); Codename = reader.ReadString(0x08); switch (Codename) { case "queen\0\0\0": case "jenkins\0": ReadZeldaArchive(reader, files); break; case "agora\0\0\0": case "SYSTEM\0\0": ReadSystemGrezzoArchive(reader, files); break; default: throw new Exception($"Unexpected codename! {Codename}"); } }