Exemplo n.º 1
0
        public void DoWork(GameWorld world)
        {
            CMD_BASE_MESSAGE mss2 = MessageTransformation.Deserialize <CMD_BASE_MESSAGE>(_Ms);

            Console.WriteLine("cmd:{0},message:{1} ThreadId:{2}", mss2.Cmd, mss2.Message, Thread.CurrentThread.ManagedThreadId.ToString());

            //TODO::报文解析业务实现
        }
Exemplo n.º 2
0
        public void DoWork(GameWorld world)
        {
            try
            {
                CMD_BASE_MESSAGE mss2 = MessageTransformation.Deserialize <CMD_BASE_MESSAGE>(_Ms);

                world.ExecuteCmd(mss2.Cmd, mss2.Message, _Session);
            }
            catch (Exception ex)
            {
                LogHelper.Error("MessageWorkItem:DoWork error:{0}", ex.Message);
            }
        }
Exemplo n.º 3
0
        private void PushLocalBuffer(byte[] buffer, int offset, int count)
        {
            if ((_ReceiveOffset + count) > _ReceiveBuffer.Length)
            {
                throw new Exception("客户端信息数据超出当前接收缓存大小!");
            }

            Array.Copy(buffer, offset, _ReceiveBuffer, _ReceiveOffset, count);

            _ReceiveOffset += count;

            Console.WriteLine("添加数据缓存 当前缓存长度:{0}", _ReceiveOffset);

            List <byte[]> messagebuffers = MessageCoder.MessageDecoding(ref _ReceiveBuffer, ref _ReceiveOffset);

            foreach (var mm in messagebuffers)
            {
                MemoryStream ms = new MemoryStream(mm, 0, mm.Length);

                CMD_BASE_MESSAGE mss2 = MessageTransformation.Deserialize <CMD_BASE_MESSAGE>(ms);

                strReceiveMessage += "|" + mss2.Message;
            }
        }