コード例 #1
0
ファイル: Packet.cs プロジェクト: mdrucken/gipsi
        public void Parse(Encoder s)
        {
            packetType = s.Read<PacketType>();
            reserved1 = s.ReadByte();
            reserved2 = s.ReadByte();
            reserved3 = s.ReadByte();
            packetId = s.Read<PacketId>();
            reserved = s.ReadUshort();
            dataSize = s.ReadUint();

            switch (packetId)
            {
                case PacketId.StartSession:
                    data = new PSessionStarted();
                    data.Parse(s);
                    break;
                case PacketId.ProductData:
                    data = new PProductData();
                    data.Parse(s);
                    break;
                case PacketId.ProtocolArray:
                    data = new PProtocolArray();
                    data.Parse(s);
                    break;
                case PacketId.RecordCount:
                    data = new PRecords();
                    data.Parse(s);
                    break;
                case PacketId.TrackData:
                    data = new PTrkData();
                    data.Parse(s);
                    break;
                case PacketId.TrackHeader:
                    data = new PTrackHeader();
                    data.Parse(s);
                    break;
                case PacketId.TransferComplete:
                    data = new PXferComplete();
                    data.Parse(s);
                    break;
                case PacketId.CourseTrackData:
                    data = new PTrkData();
                    data.Parse(s);
                    break;
            }
        }