private byte[] packObject(ProtocolObject obj) { MemoryStream memStream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(memStream); PacketOutputStream pos = new PacketOutputStream(writer); obj.save(pos); byte[] outBuf = new byte[memStream.Length]; memStream.Position = 0; memStream.Read(outBuf, 0, (int)memStream.Length); return outBuf; }
public byte[] pack(ProtocolObject obj) { byte[] outBuffer = packObject(obj); MemoryStream memStream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(memStream); writer.Write(System.Net.IPAddress.HostToNetworkOrder(outBuffer.Length + 5)); writer.Write(obj.classId()); writer.Write(outBuffer); byte[] outBuf = new byte[memStream.Length]; memStream.Position = 0; memStream.Read(outBuf, 0, (int)memStream.Length); return outBuf; }
private void select_0_0(long selector) { if (selector != 0L) { if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } } else if (!(this.dataObject is COMDT_TRANSACTION_MSG_IDIP_QUERYWORLDRANK_INFO)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (COMDT_TRANSACTION_MSG_IDIP_QUERYWORLDRANK_INFO)ProtocolObjectPool.Get(COMDT_TRANSACTION_MSG_IDIP_QUERYWORLDRANK_INFO.CLASS_ID); } }
private void select_0_0(long selector) { if (selector != 0L) { if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } } else if (!(this.dataObject is CSDT_RANKING_LIST_SUCC)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (CSDT_RANKING_LIST_SUCC)ProtocolObjectPool.Get(CSDT_RANKING_LIST_SUCC.CLASS_ID); } }
private void select_0_0(long selector) { if (selector == 0L) { if (!(this.dataObject is CSDT_BATTLE_PLAYER_BRIEF)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (CSDT_BATTLE_PLAYER_BRIEF)ProtocolObjectPool.Get(CSDT_BATTLE_PLAYER_BRIEF.CLASS_ID); } } else if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } }
private void select_1_1(long selector) { if (selector == 1L) { if (!(this.dataObject is COMDT_CHGMEMBER_INFO)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (COMDT_CHGMEMBER_INFO)ProtocolObjectPool.Get(COMDT_CHGMEMBER_INFO.CLASS_ID); } } else if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } }
private void select_1_1(long selector) { if (selector != 1L) { if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } } else if (!(this.dataObject is CSDT_RECONN_BAN_PICK_STATE_INFO)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (CSDT_RECONN_BAN_PICK_STATE_INFO)ProtocolObjectPool.Get(CSDT_RECONN_BAN_PICK_STATE_INFO.CLASS_ID); } }
private void select_0_0(long selector) { if (selector != 0L) { if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } } else if (!(this.dataObject is SCDT_USUTASKLIST)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (SCDT_USUTASKLIST)ProtocolObjectPool.Get(SCDT_USUTASKLIST.CLASS_ID); } }
private void select_0_0(long selector) { if (selector == 0L) { if (!(this.dataObject is SCDT_SETBATTLELISTOFARENA_SUCC)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (SCDT_SETBATTLELISTOFARENA_SUCC)ProtocolObjectPool.Get(SCDT_SETBATTLELISTOFARENA_SUCC.CLASS_ID); } } else if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } }
private void select_1_1(long selector) { if (selector != 1L) { if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } } else if (!(this.dataObject is COMDT_GAMEINFO_DETAIL)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (COMDT_GAMEINFO_DETAIL)ProtocolObjectPool.Get(COMDT_GAMEINFO_DETAIL.CLASS_ID); } }
public TdrError.ErrorType pack(long selector, ref TdrWriteBuf destBuf, uint cutVer) { if (cutVer == 0u || COMDT_ROOM_MEMBER_DETAIL.CURRVERSION < cutVer) { cutVer = COMDT_ROOM_MEMBER_DETAIL.CURRVERSION; } if (COMDT_ROOM_MEMBER_DETAIL.BASEVERSION > cutVer) { return(TdrError.ErrorType.TDR_ERR_CUTVER_TOO_SMALL); } TdrError.ErrorType result = TdrError.ErrorType.TDR_NO_ERROR; ProtocolObject protocolObject = this.select(selector); if (protocolObject != null) { return(protocolObject.pack(ref destBuf, cutVer)); } return(result); }
private void select_0_0(long selector) { if (selector != 0L) { if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } } else if (!(this.dataObject is COMDT_BURNING_LEVEL_DETAIL)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (COMDT_BURNING_LEVEL_DETAIL)ProtocolObjectPool.Get(COMDT_BURNING_LEVEL_DETAIL.CLASS_ID); } }
private void select_0_0(long selector) { if (selector == 0L) { if (!(this.dataObject is COMDT_ARENA_DESK_INFO)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (COMDT_ARENA_DESK_INFO)ProtocolObjectPool.Get(COMDT_ARENA_DESK_INFO.CLASS_ID); } } else if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } }
public TdrError.ErrorType unpack(long selector, ref TdrReadBuf srcBuf, uint cutVer) { if (cutVer == 0u || COMDT_SETTLE_UNION.CURRVERSION < cutVer) { cutVer = COMDT_SETTLE_UNION.CURRVERSION; } if (COMDT_SETTLE_UNION.BASEVERSION > cutVer) { return(TdrError.ErrorType.TDR_ERR_CUTVER_TOO_SMALL); } TdrError.ErrorType result = TdrError.ErrorType.TDR_NO_ERROR; ProtocolObject protocolObject = this.select(selector); if (protocolObject != null) { return(protocolObject.unpack(ref srcBuf, cutVer)); } return(result); }
public TdrError.ErrorType pack(long selector, ref TdrWriteBuf destBuf, uint cutVer) { if ((cutVer == 0) || (CURRVERSION < cutVer)) { cutVer = CURRVERSION; } if (BASEVERSION > cutVer) { return(TdrError.ErrorType.TDR_ERR_CUTVER_TOO_SMALL); } TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR; ProtocolObject obj2 = this.select(selector); if (obj2 != null) { return(obj2.pack(ref destBuf, cutVer)); } return(type); }
private void select_0_0(long selector) { if (selector == 0L) { if (!(this.dataObject is CSDT_GET_BURNING_REWARD_SUCC)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (CSDT_GET_BURNING_REWARD_SUCC)ProtocolObjectPool.Get(CSDT_GET_BURNING_REWARD_SUCC.CLASS_ID); } } else if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } }
private void select_1_1(long selector) { if (selector == 1L) { if (!(this.dataObject is CSDT_CLT_ACTION_SECRETARY)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (CSDT_CLT_ACTION_SECRETARY)ProtocolObjectPool.Get(CSDT_CLT_ACTION_SECRETARY.CLASS_ID); } } else if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } }
private void select_0_0(long selector) { if (selector == 0L) { if (!(this.dataObject is COMDT_JOINMULTGAMERSP_SUCC)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (COMDT_JOINMULTGAMERSP_SUCC)ProtocolObjectPool.Get(COMDT_JOINMULTGAMERSP_SUCC.CLASS_ID); } } else if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } }
private void select_0_0(long selector) { if (selector == 0L) { if (!(this.dataObject is CSDT_FIGHTHISTORY_RECORD_DETAIL_SUCC)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (CSDT_FIGHTHISTORY_RECORD_DETAIL_SUCC)ProtocolObjectPool.Get(CSDT_FIGHTHISTORY_RECORD_DETAIL_SUCC.CLASS_ID); } } else if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } }
private void select_0_0(long selector) { if (selector != 0L) { if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } } else if (!(this.dataObject is CSDT_ACNT_DETAIL_INFO)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (CSDT_ACNT_DETAIL_INFO)ProtocolObjectPool.Get(CSDT_ACNT_DETAIL_INFO.CLASS_ID); } }
public void loadFromFile() { if (!File.Exists(this.DBLocation)) { return; } StreamReader streamReader = new StreamReader(this.DBLocation); string str; while ((str = streamReader.ReadLine()) != null) { char[] charArray = " ".ToCharArray(); string[] strArray = str.Split(charArray, 3); int key = 0; int port = 0; int type = 0; string description = ""; for (int index = 0; index < strArray.Length; ++index) { switch (index) { case 0: key = port = Convert.ToInt32(strArray[0]); break; case 1: type = Convert.ToInt32(strArray[1]); break; case 2: description = strArray[2]; break; } } if (!this.db.ContainsKey(key)) { ProtocolObject protocolObject = new ProtocolObject(port, type, description); this.db.Add(key, protocolObject); } } streamReader.Close(); }
/** * Unpack a byte sequence into a concrete ProtocolObject. */ public ProtocolObject unpack(byte[] inBuffer) { MemoryStream memStream = new MemoryStream(inBuffer); BinaryReader reader = new BinaryReader(memStream); int payloadLength = System.Net.IPAddress.NetworkToHostOrder(reader.ReadInt32()); // Styx by default uses length exclusive from the length header if ((memStream.Length - memStream.Position) < payloadLength - HEADER_SIZE) { throw new DataMisalignedException("Packet not fully read! Want " + payloadLength + " bytes, available: " + (int)(memStream.Length - memStream.Position)); } byte classId = reader.ReadByte(); ProtocolObject po = factory.create(classId); po.load(new PacketInputStream(reader)); return(po); }
private void select_30_183(long selector) { if (selector != 182L) { if (selector != 183L) { if (selector != 30L) { if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } } else if (!(this.dataObject is SCDT_NTF_REGISTERERRCODE)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (SCDT_NTF_REGISTERERRCODE)ProtocolObjectPool.Get(SCDT_NTF_REGISTERERRCODE.CLASS_ID); } } else if (!(this.dataObject is SCDT_NTF_REDIRECT_LOGICWORLDID)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (SCDT_NTF_REDIRECT_LOGICWORLDID)ProtocolObjectPool.Get(SCDT_NTF_REDIRECT_LOGICWORLDID.CLASS_ID); } } else if (!(this.dataObject is SCDT_NTF_SWITCHDETAIL)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (SCDT_NTF_SWITCHDETAIL)ProtocolObjectPool.Get(SCDT_NTF_SWITCHDETAIL.CLASS_ID); } }
private void select_0_28(long selector) { if (selector != 0L) { if (selector != 17L) { if (selector != 28L) { if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } } else if (!(this.dataObject is COMDT_TEAM_ERR_FORBIDLADDER)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (COMDT_TEAM_ERR_FORBIDLADDER)ProtocolObjectPool.Get(COMDT_TEAM_ERR_FORBIDLADDER.CLASS_ID); } } else if (!(this.dataObject is COMDT_TEAM_ERR_BEPUNISH)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (COMDT_TEAM_ERR_BEPUNISH)ProtocolObjectPool.Get(COMDT_TEAM_ERR_BEPUNISH.CLASS_ID); } } else if (!(this.dataObject is COMDT_TEAM_INFO)) { if (this.dataObject != null) { this.dataObject.Release(); } this.dataObject = (COMDT_TEAM_INFO)ProtocolObjectPool.Get(COMDT_TEAM_INFO.CLASS_ID); } }
public TdrError.ErrorType construct(long selector) { TdrError.ErrorType result = TdrError.ErrorType.TDR_NO_ERROR; ProtocolObject protocolObject = this.select(selector); if (protocolObject != null) { return(protocolObject.construct()); } if (selector == 20L) { if (this.szLeaveAcntName == null) { this.szLeaveAcntName = new byte[64]; } } else { this.bReserved = 0; } return(result); }
public override void OnRelease() { if (this.dataObject != null) { this.dataObject.Release(); this.dataObject = null; } this.bReverse = 0; this.dwCoin = 0; this.dwCoupons = 0; this.dwBurningCoin = 0; this.dwArenaCoin = 0; this.dwAP = 0; this.dwPvpCoin = 0; this.dwHeroPoolExp = 0; this.dwSkinCoin = 0; this.dwSymbolCoin = 0; this.dwDiamond = 0; this.dwHuoYueDu = 0; this.dwMatchPointPer = 0; this.dwMatchPointGuild = 0; }
public TdrError.ErrorType pack(long selector, ref TdrWriteBuf destBuf, uint cutVer) { if (cutVer == 0u || COMDT_APOLLO_TRANK_USERBUFFER_EXTRA_DATA.CURRVERSION < cutVer) { cutVer = COMDT_APOLLO_TRANK_USERBUFFER_EXTRA_DATA.CURRVERSION; } if (COMDT_APOLLO_TRANK_USERBUFFER_EXTRA_DATA.BASEVERSION > cutVer) { return(TdrError.ErrorType.TDR_ERR_CUTVER_TOO_SMALL); } ProtocolObject protocolObject = this.select(selector); if (protocolObject != null) { return(protocolObject.pack(ref destBuf, cutVer)); } TdrError.ErrorType errorType = destBuf.writeUInt8(this.bReverse); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } return(errorType); }
public TdrError.ErrorType pack(long selector, ref TdrWriteBuf destBuf, uint cutVer) { if (cutVer == 0u || UN_GAMING_UPER_DT.CURRVERSION < cutVer) { cutVer = UN_GAMING_UPER_DT.CURRVERSION; } if (UN_GAMING_UPER_DT.BASEVERSION > cutVer) { return(TdrError.ErrorType.TDR_ERR_CUTVER_TOO_SMALL); } ProtocolObject protocolObject = this.select(selector); if (protocolObject != null) { return(protocolObject.pack(ref destBuf, cutVer)); } TdrError.ErrorType errorType = destBuf.writeInt8(this.chReserve); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } return(errorType); }
public TdrError.ErrorType unpack(long selector, ref TdrReadBuf srcBuf, uint cutVer) { if (cutVer == 0u || SCDT_NTF_ERRCODE.CURRVERSION < cutVer) { cutVer = SCDT_NTF_ERRCODE.CURRVERSION; } if (SCDT_NTF_ERRCODE.BASEVERSION > cutVer) { return(TdrError.ErrorType.TDR_ERR_CUTVER_TOO_SMALL); } ProtocolObject protocolObject = this.select(selector); if (protocolObject != null) { return(protocolObject.unpack(ref srcBuf, cutVer)); } TdrError.ErrorType errorType = srcBuf.readUInt8(ref this.bReserved); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } return(errorType); }
public TdrError.ErrorType pack(long selector, ref TdrWriteBuf destBuf, uint cutVer) { if (cutVer == 0u || COMDT_OPER_TEAM_DETAIL.CURRVERSION < cutVer) { cutVer = COMDT_OPER_TEAM_DETAIL.CURRVERSION; } if (COMDT_OPER_TEAM_DETAIL.BASEVERSION > cutVer) { return(TdrError.ErrorType.TDR_ERR_CUTVER_TOO_SMALL); } ProtocolObject protocolObject = this.select(selector); if (protocolObject != null) { return(protocolObject.pack(ref destBuf, cutVer)); } TdrError.ErrorType errorType = destBuf.writeUInt8(this.bReserved); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } return(errorType); }
public TdrError.ErrorType pack(long selector, ref TdrWriteBuf destBuf, uint cutVer) { if (cutVer == 0u || SCDT_UDPTASK.CURRVERSION < cutVer) { cutVer = SCDT_UDPTASK.CURRVERSION; } if (SCDT_UDPTASK.BASEVERSION > cutVer) { return(TdrError.ErrorType.TDR_ERR_CUTVER_TOO_SMALL); } ProtocolObject protocolObject = this.select(selector); if (protocolObject != null) { return(protocolObject.pack(ref destBuf, cutVer)); } TdrError.ErrorType errorType = destBuf.writeUInt8(this.bNouse); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } return(errorType); }
public TdrError.ErrorType unpack(long selector, ref TdrReadBuf srcBuf, uint cutVer) { if (cutVer == 0u || COMDT_JOIN_TEAM_RSP.CURRVERSION < cutVer) { cutVer = COMDT_JOIN_TEAM_RSP.CURRVERSION; } if (COMDT_JOIN_TEAM_RSP.BASEVERSION > cutVer) { return(TdrError.ErrorType.TDR_ERR_CUTVER_TOO_SMALL); } ProtocolObject protocolObject = this.select(selector); if (protocolObject != null) { return(protocolObject.unpack(ref srcBuf, cutVer)); } TdrError.ErrorType errorType = srcBuf.readInt8(ref this.chReserve); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } return(errorType); }