示例#1
0
		public Msg DeCode(byte[] data)
		{
            IoBuffer buffer = new IoBuffer();
            buffer.Write(data, 0, data.Length);
            IoBufferReader reader = new IoBufferReader(buffer);
			reader.readInt();
			int cmd = reader.readInt();
			Dictionary<object, object> param = (Dictionary<object, object>)reader.Read();
			Msg msg = new Msg(cmd);
			msg.ParamMap = param;
			return msg;
		}
示例#2
0
文件: Po.cs 项目: Pasdedeux/LTool
        public Po(byte[] data)
        {
            this.saveData = new Dictionary <object, object>();
            Init();
            if (data == null)
            {
                return;
            }
            IoBuffer buffer = new IoBuffer();

            buffer.Write(data, 0, data.Length);
            IoBufferReader rd = new IoBufferReader(buffer);
            Dictionary <object, object> saveData = (Dictionary <object, object>)rd.Read();

            if (saveData == null)
            {
                return;
            }
            ReadData(saveData);
        }
示例#3
0
 public int DeCode(Session session, OnPackageRev handler)
 {
     try
     {
         IoBuffer       buffer = session.ReceiveBuffer;
         IoBufferReader reader = new IoBufferReader(buffer);
         reader.readInt();
         int cmd = reader.readInt();
         Dictionary <object, object> param = (Dictionary <object, object>)reader.Read();
         Msg msg = new Msg(cmd);
         msg.ParamMap = param;
         handler(msg);
         return(OK);
     }
     catch (Exception e)
     {
         logReport.OnWarningReport("decode not ok,protocal erro,ex:" + e.StackTrace);
         return(NOT_OK);
     }
 }