public static sSSEQ Read(string filePath) { BinaryReader br = new BinaryReader(File.OpenRead(filePath)); sSSEQ seq = new sSSEQ(); // Generic header seq.generic.id = br.ReadChars(4); seq.generic.endianess = br.ReadUInt16(); seq.generic.constant = br.ReadUInt16(); seq.generic.file_size = br.ReadUInt32(); seq.generic.header_size = br.ReadUInt16(); seq.generic.nSection = br.ReadUInt16(); // Data section seq.data.type = br.ReadChars(4); // Should be 'DATA' seq.data.size = br.ReadUInt32(); seq.data.offset = br.ReadUInt32(); // Sould be 0x1C seq.data.events = new List <sEvent>(); while (br.BaseStream.Position < br.BaseStream.Length) { sEvent evn = new sEvent(); evn.status = br.ReadByte(); evn.parameters = br.ReadBytes(0); seq.data.events.Add(evn); } br.Close(); return(seq); }
public static sSSEQ Read(string filePath) { BinaryReader br = new BinaryReader(File.OpenRead(filePath)); sSSEQ seq = new sSSEQ(); // Generic header seq.generic.id = br.ReadChars(4); seq.generic.endianess = br.ReadUInt16(); seq.generic.constant = br.ReadUInt16(); seq.generic.file_size = br.ReadUInt32(); seq.generic.header_size = br.ReadUInt16(); seq.generic.nSection = br.ReadUInt16(); // Data section seq.data.type = br.ReadChars(4); // Should be 'DATA' seq.data.size = br.ReadUInt32(); seq.data.offset = br.ReadUInt32(); // Sould be 0x1C seq.data.events = new List<sEvent>(); while (br.BaseStream.Position < br.BaseStream.Length) { sEvent evn = new sEvent(); evn.status = br.ReadByte(); evn.parameters = br.ReadBytes(0); seq.data.events.Add(evn); } br.Close(); return seq; }