示例#1
0
        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);
        }
示例#2
0
文件: SSEQ.cs 项目: MetLob/tinke
        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;
        }