Пример #1
0
    public void ParseCommands()
    {
        if (incoming.Count > 4)
        {
            if (currMsgLength == -1)
            {
                currMsgLength = BitConverter.ToInt32(incoming.ToArray(), 0);
            }

            if (incoming.Count >= currMsgLength)
            {
                if (currMsgLength > 4)
                {
                    NetworkMessageEncoder.SortEncodedMessages(incoming.GetRange(4, currMsgLength - 4).ToArray());
                }

                incoming.RemoveRange(0, currMsgLength);
                currMsgLength = -1;
                ParseCommands();
            }
        }
    }
 public NetworkMessageEncoderTests()
 {
     _loggerMock       = new Mock <ILogger>();
     _engineConfigMock = new Mock <IEngineConfiguration>();
     _encoder          = new NetworkMessageEncoder(_loggerMock.Object, _engineConfigMock.Object);
 }