public void load(string file) { byte[] f = File.ReadAllBytes(file); BinaryReader br = new BinaryReader(new MemoryStream(f, 0, f.Length)); hdr.parseHeader(br); readEntries(br); for (int i = 0; i < amtaData.Count; i++) { f = amtaData[i]; br = new BinaryReader(new MemoryStream(f, 0, f.Length)); AMTA amta = new AMTA(); amta.parseAMTA(br); DATA data = new DATA(); data.parseDATA(br); MARK mark = new MARK(); mark.parseMARK(br); EXT_ ext = new EXT_(); ext.parseEXT_(br); STRG strg = new STRG(); strg.parseSTRG(br); strgList.Add(strg); br.Close(); } }
public void Read(FileReader reader) { string Signature = reader.ReadString(4, Encoding.ASCII); if (Signature != "FSAR") { throw new Exception($"Invalid signature {Signature}! Expected FSAR."); } BOM = reader.ReadUInt16(); HeaderSize = reader.ReadUInt16(); Version = reader.ReadUInt32(); uint FileSize = reader.ReadUInt32(); SectionCount = reader.ReadUInt16(); ushort padding = reader.ReadUInt16(); for (int i = 0; i < SectionCount; i++) { ushort Identifier = reader.ReadUInt16(); ushort padding2 = reader.ReadUInt16(); uint Offset = reader.ReadUInt32(); uint Size = reader.ReadUInt32(); if (Identifier == 8192) { reader.Seek(Offset, SeekOrigin.Begin); STRG = new STRG(); STRG.Read(reader); } if (Identifier == 8193) { reader.Seek(Offset, SeekOrigin.Begin); INFO = new INFO(); INFO.Read(reader); } if (Identifier == 8194) { reader.Seek(Offset, SeekOrigin.Begin); FILE = new FILE(); FILE.Read(reader, INFO); } } reader.Close(); reader.Dispose(); }
public static void ConvertWAVtoBFWAV(string input, string output) { byte[] fileAudioData = File.ReadAllBytes(input); string fileAudioIdntr = ".wav"; STRG fileStrg = new STRG(); fileStrg.name = Path.GetFileNameWithoutExtension(input); if (fileAudioIdntr == ".wav") { FileStream f = File.Create(output); WaveReader reader = new WaveReader(); BCFstmWriter writer = new BCFstmWriter(NwTarget.Cafe); VGAudio.Formats.AudioData convertedWav = reader.Read(fileAudioData); writer.WriteToStream(convertedWav, f); f.Close(); } }
public CSAR(byte[] Data) { EndianBinaryReaderEx er = new EndianBinaryReaderEx(new MemoryStream(Data), Endianness.LittleEndian); try { Header = new CSARHeader(er); foreach (var v in Header.Sections) { er.BaseStream.Position = v.Offset; switch (v.Id) { case 0x2000: Strings = new STRG(er); break; case 0x2001: Infos = new INFO(er); break; } } } finally { er.Close(); } }