Esempio n. 1
0
        internal static PsnDataPacketChunk Deserialize(PsnChunkHeader chunkHeader, PsnBinaryReader reader)
        {
            var subChunks = new List <PsnChunk>();

            foreach (var pair in FindSubChunkHeaders(reader, chunkHeader.DataLength))
            {
                reader.Seek(pair.Item2, SeekOrigin.Begin);

                switch ((PsnDataPacketChunkId)pair.Item1.ChunkId)
                {
                case PsnDataPacketChunkId.PsnDataHeader:
                    subChunks.Add(PsnDataHeaderChunk.Deserialize(pair.Item1, reader));
                    break;

                case PsnDataPacketChunkId.PsnDataTrackerList:
                    subChunks.Add(PsnDataTrackerListChunk.Deserialize(pair.Item1, reader));
                    break;

                default:
                    subChunks.Add(PsnUnknownChunk.Deserialize(pair.Item1, reader));
                    break;
                }
            }

            return(new PsnDataPacketChunk(subChunks));
        }
Esempio n. 2
0
        internal static PsnDataTrackerChunk Deserialize(PsnChunkHeader chunkHeader, PsnBinaryReader reader)
        {
            var subChunks = new List <PsnChunk>();

            foreach (var pair in FindSubChunkHeaders(reader, chunkHeader.DataLength))
            {
                reader.Seek(pair.Item2, SeekOrigin.Begin);

                switch ((PsnDataTrackerChunkId)pair.Item1.ChunkId)
                {
                case PsnDataTrackerChunkId.PsnDataTrackerPos:
                    subChunks.Add(PsnDataTrackerPosChunk.Deserialize(chunkHeader, reader));
                    break;

                case PsnDataTrackerChunkId.PsnDataTrackerSpeed:
                    subChunks.Add(PsnDataTrackerSpeedChunk.Deserialize(chunkHeader, reader));
                    break;

                case PsnDataTrackerChunkId.PsnDataTrackerOri:
                    subChunks.Add(PsnDataTrackerOriChunk.Deserialize(chunkHeader, reader));
                    break;

                case PsnDataTrackerChunkId.PsnDataTrackerStatus:
                    subChunks.Add(PsnDataTrackerStatusChunk.Deserialize(chunkHeader, reader));
                    break;

                case PsnDataTrackerChunkId.PsnDataTrackerAccel:
                    subChunks.Add(PsnDataTrackerAccelChunk.Deserialize(chunkHeader, reader));
                    break;

                case PsnDataTrackerChunkId.PsnDataTrackerTrgtPos:
                    subChunks.Add(PsnDataTrackerTrgtPosChunk.Deserialize(chunkHeader, reader));
                    break;

                default:
                    subChunks.Add(PsnUnknownChunk.Deserialize(chunkHeader, reader));
                    break;
                }
            }

            return(new PsnDataTrackerChunk(chunkHeader.ChunkId, subChunks));
        }