示例#1
0
 protected void OnFileHeader(FileHeader header)
 {
 }
示例#2
0
        public void Parse(Stream stream, bool isParseAsn, uint[] parTraces = null)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            BigEndianBinaryReader reader = new BigEndianBinaryReader(stream);
            FileHeader header = new FileHeader
            {
                file_flag_ui4 = reader.ReadUInt32()
            };
            reader.ReadString(4);
            reader.ReadUInt32();
            header.fver_ui2 = reader.ReadUInt16();
            reader.ReadString(4);
            reader.ReadUInt32();
            header.ttyp_ui2 = reader.ReadUInt16();
            reader.ReadString(4);
            reader.ReadUInt32();
            header.fno_ui4 = reader.ReadUInt32();
            reader.ReadString(4);
            reader.ReadUInt32();
            header.ntyp_i1 = reader.ReadByte();
            reader.ReadString(4);
            reader.ReadUInt32();
            header.nver_s40 = reader.ReadString(40);
            reader.ReadString(4);
            reader.ReadUInt32();
            header.ndep_ui1 = reader.ReadSByte();
            OnFileHeader(header);

            ParTraces = parTraces;
            IsParseAsn = isParseAsn;
            uint num = BlockType("msg0");
            while (!reader.Eof())
            {
                uint num2 = reader.ReadUInt32();
                if (num2 == num)
                {
                    ParseMsg0(reader);
                }
                else
                {
                    Console.WriteLine("unknown block type as {0:X}, expect {1:X}, but {2:X}",
                        reader.BaseStream.Position, num, num2);
                    return;
                }
            }
        }