private bool SendPackage(CSPkg msg) { if (base.connected && (base.connector != null)) { msg.stPkgHead.dwSvrPkgSeq = this.curSvrPkgSeq; int usedSize = 0; if (msg.pack(ref this.szSendBuffer, nBuffSize, ref usedSize, 0) == TdrError.ErrorType.TDR_NO_ERROR) { byte[] destinationArray = new byte[usedSize]; Array.Copy(this.szSendBuffer, destinationArray, usedSize); return(base.connector.WriteData(destinationArray, -1) == ApolloResult.Success); } } return(false); }
private bool SendPackage(CSPkg msg) { if (!this.connected || this.connector == null) { return(false); } msg.stPkgHead.dwSvrPkgSeq = this.curSvrPkgSeq; int num = 0; if (msg.pack(ref this.szSendBuffer, LobbyConnector.nBuffSize, ref num, 0u) == TdrError.ErrorType.TDR_NO_ERROR) { byte[] array = new byte[num]; Array.Copy(this.szSendBuffer, array, num); return(this.connector.WriteData(array, -1) == ApolloResult.Success); } return(false); }
public void CacheRecord(object obj) { if (this.IsReplaying) { return; } CSDT_FRAPBOOT_INFO cSDT_FRAPBOOT_INFO = obj as CSDT_FRAPBOOT_INFO; int num = 0; short num2 = 0; if (cSDT_FRAPBOOT_INFO != null) { if (cSDT_FRAPBOOT_INFO.pack(ref this.streamBuffer, this.streamBuffer.Length, ref num, 0u) == TdrError.ErrorType.TDR_NO_ERROR && num > 0 && num < 32767) { num2 = (short)num; } this.endKFraqNo = 0u; } else { WatchEntryData watchEntry = null; if (Singleton <WatchController> .GetInstance().IsWatching) { watchEntry = Singleton <COBSystem> .GetInstance().GetWatchEntryData(); } CSPkg cSPkg = obj as CSPkg; if (cSPkg.stPkgHead.dwMsgID == 1075u) { this.BeginRecord(cSPkg.stPkgData.stMultGameBeginLoad, watchEntry); } if (cSPkg.pack(ref this.streamBuffer, this.streamBuffer.Length, ref num, 0u) == TdrError.ErrorType.TDR_NO_ERROR && num > 0 && num < 32767) { num2 = -(short)num; } } if (this.recordWriter != null && num2 != 0) { this.recordWriter.Write(num2); this.recordWriter.Write(this.streamBuffer, 0, num); } else { Debug.LogError("Record Msg Failed! usedSize=" + num); } }
public bool SendPackage(CSPkg msg) { if (!this.connected || this.connector == null) { return(false); } int num = 0; if (msg.pack(ref this.szSendBuffer, this.nBuffSize, ref num, 0u) != null) { return(false); } if (this.initParam.bIsUDP && (msg.stPkgHead.dwMsgID == 1004u || msg.stPkgHead.dwMsgID == 1260u)) { return(this.connector.WriteUdpData(this.szSendBuffer, num) == 0); } return(this.connector.WriteData(this.szSendBuffer, num) == 0); }
public bool SendPackage(CSPkg msg) { if (!this.connected || this.connector == null) { return(false); } int len = 0; if (msg.pack(ref this.szSendBuffer, this.nBuffSize, ref len, 0u) != TdrError.ErrorType.TDR_NO_ERROR) { return(false); } if (this.initParam.bIsUDP && (msg.stPkgHead.dwMsgID == 1004u || msg.stPkgHead.dwMsgID == 1260u || msg.stPkgHead.dwMsgID == 1036u || msg.stPkgHead.dwMsgID == 1037u)) { return(this.connector.WriteUdpData(this.szSendBuffer, len) == ApolloResult.Success); } return(this.connector.WriteData(this.szSendBuffer, len) == ApolloResult.Success); }
public bool SendPackage(CSPkg msg) { if (!base.connected || (base.connector == null)) { return(false); } int usedSize = 0; if (msg.pack(ref this.szSendBuffer, this.nBuffSize, ref usedSize, 0) != TdrError.ErrorType.TDR_NO_ERROR) { return(false); } byte[] destinationArray = new byte[usedSize]; Array.Copy(this.szSendBuffer, destinationArray, usedSize); if (!base.initParam.bIsUDP || ((msg.stPkgHead.dwMsgID != 0x3ed) && (msg.stPkgHead.dwMsgID != 0x4ec))) { return(base.connector.WriteData(destinationArray, -1) == ApolloResult.Success); } return(base.connector.WriteUdpData(destinationArray, -1) == ApolloResult.Success); }
public void CacheRecord(object obj) { if (!Singleton <WatchController> .GetInstance().IsWatching) { CSDT_FRAPBOOT_INFO csdt_frapboot_info = obj as CSDT_FRAPBOOT_INFO; int usedSize = 0; short num2 = 0; if (csdt_frapboot_info != null) { if (((csdt_frapboot_info.pack(ref this.streamBuffer, this.streamBuffer.Length, ref usedSize, 0) == TdrError.ErrorType.TDR_NO_ERROR) && (usedSize > 0)) && (usedSize < 0x7fff)) { num2 = (short)usedSize; } this.endKFraqNo = 0; } else { CSPkg pkg = obj as CSPkg; if (pkg.stPkgHead.dwMsgID == 0x433) { this.BeginRecord(pkg.stPkgData.stMultGameBeginLoad); } if (((pkg.pack(ref this.streamBuffer, this.streamBuffer.Length, ref usedSize, 0) == TdrError.ErrorType.TDR_NO_ERROR) && (usedSize > 0)) && (usedSize < 0x7fff)) { num2 = (short)-usedSize; } } if ((this.recordWriter != null) && (num2 != 0)) { this.recordWriter.Write(num2); this.recordWriter.Write(this.streamBuffer, 0, usedSize); } else { Debug.LogError("Record Msg Failed! usedSize=" + usedSize); } } }
public bool SendPackage(CSPkg msg) { if (base.connected && (base.connector != null)) { int usedSize = 0; TdrError.ErrorType type = msg.pack(ref this.szSendBuffer, this.nBuffSize, ref usedSize, 0); if (type == TdrError.ErrorType.TDR_NO_ERROR) { ApolloResult result; byte[] destinationArray = new byte[usedSize]; Array.Copy(this.szSendBuffer, destinationArray, usedSize); if (base.initParam.bIsUDP && ((msg.stPkgHead.dwMsgID == 0x3ed) || (msg.stPkgHead.dwMsgID == 0x4ec))) { result = base.connector.WriteUdpData(destinationArray, -1); } else { result = base.connector.WriteData(destinationArray, -1); } if (result == ApolloResult.Success) { return(true); } if (msg.stPkgHead.dwMsgID == 0x438) { object[] objArray1 = new object[] { "WriteError: MsgID:", msg.stPkgHead.dwMsgID, " PackSize:", usedSize, " ApolloResult:", result }; this.ReportException(new WriteError(string.Concat(objArray1))); } } else { object[] objArray2 = new object[] { "PackError: MsgID:", msg.stPkgHead.dwMsgID, " TdrError:", type }; this.ReportException(new PackError(string.Concat(objArray2))); } } return(false); }