private void RecordReplay(CSDT_FRAPBOOT_INFO fbid) { CSPkg msg = NetworkModule.CreateDefaultCSPKG(0x40a); SCPKG_FRAPBOOT_SINGLE stFrapBootSingle = msg.stPkgData.stFrapBootSingle; int usedSize = 0; if (fbid.pack(ref stFrapBootSingle.szInfoBuff, stFrapBootSingle.szInfoBuff.Length, ref usedSize, 0) == TdrError.ErrorType.TDR_NO_ERROR) { stFrapBootSingle.wLen = (ushort)usedSize; Singleton <GameReplayModule> .instance.RecordMsg(msg); } msg.Release(); }
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 FlushRecord() { bool flag; if (!this.HasRecord) { return(false); } try { if (this.endKFraqNo > 0) { CSDT_FRAPBOOT_INFO csdt_frapboot_info = new CSDT_FRAPBOOT_INFO { dwKFrapsNo = this.endKFraqNo, bNum = 0 }; int usedSize = 0; if (((csdt_frapboot_info.pack(ref this.streamBuffer, this.streamBuffer.Length, ref usedSize, 0) == TdrError.ErrorType.TDR_NO_ERROR) && (usedSize > 0)) && (usedSize < 0x7fff)) { this.recordWriter.Write((short)usedSize); this.recordWriter.Write(this.streamBuffer, 0, usedSize); } } this.streamPath = string.Format("{0}/{1}.abc", ReplayFolder, DateTime.Now.ToString("yyyyMMdd_HHmmss")); FileStream stream = new FileStream(this.streamPath, FileMode.Create, FileAccess.Write); this.recordStream.WriteTo(stream); stream.Flush(); stream.Close(); flag = true; } catch { flag = false; if (File.Exists(this.streamPath)) { File.Delete(this.streamPath); } } this.ClearRecord(); return(flag); }
public bool FlushRecord() { if (!this.HasRecord) { return(false); } bool result; try { if (this.endKFraqNo > 0u) { CSDT_FRAPBOOT_INFO cSDT_FRAPBOOT_INFO = new CSDT_FRAPBOOT_INFO(); cSDT_FRAPBOOT_INFO.dwKFrapsNo = this.endKFraqNo; cSDT_FRAPBOOT_INFO.bNum = 0; int num = 0; if (cSDT_FRAPBOOT_INFO.pack(ref this.streamBuffer, this.streamBuffer.Length, ref num, 0u) == TdrError.ErrorType.TDR_NO_ERROR && num > 0 && num < 32767) { this.recordWriter.Write((short)num); this.recordWriter.Write(this.streamBuffer, 0, num); } } this.streamPath = string.Format("{0}/{1}.abc", GameReplayModule.ReplayFolder, DateTime.get_Now().ToString("yyyyMMdd_HHmmss")); FileStream fileStream = new FileStream(this.streamPath, 2, 2); fileStream.Write(this.recordStream.GetBuffer(), 0, (int)this.recordStream.get_Position()); fileStream.Flush(); fileStream.Close(); result = true; } catch { result = false; if (File.Exists(this.streamPath)) { File.Delete(this.streamPath); } } this.ClearRecord(); return(result); }
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); } } }