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; }
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); }
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); } }