コード例 #1
0
 public static void ProcessFrame(int frameCount, Frame frame)
 {
     if (FrameManager.HasFrame(frameCount) == false)
     {
         FrameManager.AddFrame(frameCount, frame);
     }
 }
コード例 #2
0
        public static void ProcessPacket(FastList <byte> packet)
        {
            if (packet == null || packet.Count < 4)
            {
                throw new System.Exception("Packet is null or not valid length");
            }
            int frameCount = BitConverter.ToInt32(packet.innerArray, 0);
            int index      = 4;

            if (FrameManager.HasFrame(frameCount) == false)
            {
                Frame frame = new Frame();

                if (packet.Count > 4)
                {
                    RecordedBytes.AddRange(BitConverter.GetBytes((ushort)packet.Count));
                    RecordedBytes.AddRange(packet);
                    while (index < packet.Count)
                    {
                        Command com = new Command();
                        index += com.Reconstruct(packet.innerArray, index);
                        frame.AddCommand(com);
                    }
                    if (frameCount > LastCommandedFrameCount)
                    {
                        LastCommandedFrameCount = frameCount;
                    }
                }
                FrameManager.AddFrame(frameCount, frame);
            }
            else
            {
            }
        }