/// <summary> /// 删除热更文件 /// </summary> /// <param name="onDelete"></param> public void DeleteHotfixDir(Action <bool> onDelete) { FileMark fileMark = new FileMark(Application.persistentDataPath, FileChecker.DeleteHotfixMark); fileMark.Delete(); DirectoryInfo dir = new DirectoryInfo(AssetLoader.ExternalHotfixPath); if (dir.Exists) { try { dir.Delete(true); onDelete?.Invoke(true); } catch (Exception e) { onDelete?.Invoke(false); fileMark.UpdateRecord("true"); BuglyAgent.ReportException("DeleteHotfixDir", e.Message, e.StackTrace); PopupManager.ShowAlertWindow(I18NManager.Get("Update_RepairFail"), null, I18NManager.Get("Update_RepairCloseGame")).WindowActionCallback = evt => { Application.Quit(); }; } } else { onDelete?.Invoke(true); } }
private static void HandleClientClientSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_CC ccSynDt) { int usedSize = 0; FRAME_CMD_PKG msg = FRAME_CMD_PKG.New(); TdrError.ErrorType type = msg.unpack(ref ccSynDt.stSyncInfo.szBuff, ccSynDt.stSyncInfo.wLen, ref usedSize, 0); DebugHelper.Assert(type == TdrError.ErrorType.TDR_NO_ERROR); if (type == TdrError.ErrorType.TDR_NO_ERROR) { IFrameCommand command = FrameCommandFactory.CreateFrameCommand(ref msg); if (command != null) { command.playerID = ccSynDt.dwObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } else { _frameExceptionCounter = (byte)(_frameExceptionCounter + 1); if (_frameExceptionCounter <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create ccSync frame command error!"); } } } else { _frameExceptionCounter = (byte)(_frameExceptionCounter + 1); if (_frameExceptionCounter <= 30) { BuglyAgent.ReportException(new Exception("TdrUnpackException"), "CCSync unpack error!"); } } msg.Release(); }
private void ReportException(Exception ecp) { if (++this.reportCount <= 15) { BuglyAgent.ReportException(ecp, ecp.Message); } }
//--------------------------------------------------------------------- void _onSocketError(object rec, SocketErrorEventArgs args) { BuglyAgent.PrintLog(LogSeverity.Log, args.Exception.Message); BuglyAgent.ReportException(args.Exception, args.Exception.Message); _onSocketClose(); }
private static void HandleClientStateSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_ACNTSTATE stateSyncDt) { IFrameCommand command = null; switch (stateSyncDt.bStateChgType) { case 1: command = FrameCommandFactory.CreateFrameCommand <SvrDisconnectCommand>(); break; case 2: command = FrameCommandFactory.CreateFrameCommand <SvrReconnectCommand>(); break; case 3: command = FrameCommandFactory.CreateFrameCommand <SvrRunawayCommand>(); break; } if (command != null) { command.playerID = stateSyncDt.dwObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } else { _frameExceptionCounter = (byte)(_frameExceptionCounter + 1); if (_frameExceptionCounter <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create stateChange frame command error!"); } } }
private static void CloseUpload() { if (SynchrReport._isUploading) { return; } if (SynchrReport._uploadList != null) { for (int i = 0; i < SynchrReport._uploadList.get_Count(); i++) { if (SynchrReport._uploadList.get_Item(i) != null) { SynchrReport._uploadList.get_Item(i).Close(); } } SynchrReport._uploadList = null; } SynchrReport._uploadIndex = -1; if (SynchrReport._isSelfUnsync && !SynchrReport._isAlerted) { SynchrReport._isAlerted = true; if (MonoSingleton <Reconnection> .instance.isProcessingRelayRecover) { Singleton <CUIManager> .GetInstance().OpenMessageBox(Singleton <CTextManager> .GetInstance().GetText("MultiGame_Not_Sync"), enUIEventID.Lobby_ConfirmErrExit, false); } else { Singleton <CUIManager> .GetInstance().OpenMessageBox(Singleton <CTextManager> .GetInstance().GetText("MultiGame_Not_Sync_Try"), enUIEventID.Battle_MultiHashInvalid, false); } DebugHelper.CustomLog("HashCheckInvalid!"); BuglyAgent.ReportException(new LobbyMsgHandler.HashCheckInvalide("HaskCheckInvalide"), "MultiGame not synced!"); } }
public override void Start() { if (AppConfig.Instance.needChooseServer == false) { //测试的时候不用选服 EnterGame(); return; } Debug.Log("versionServer=>" + AppConfig.Instance.versionServer); FileMark fileMark = new FileMark(Application.persistentDataPath, FileChecker.DeleteHotfixMark); if (_isCallbackTypeSwitch == LoginCallbackType.RepairResource || fileMark.ReadRecord() == "true") { if (_isCallbackTypeSwitch != LoginCallbackType.RepairResource) { BuglyAgent.ReportException("UpdateController Start", "app restart for repair", "none"); } FileChecker checker = new FileChecker(); checker.CleanForRepair(isDelete => { if (isDelete) { FlowText.ShowMessage(I18NManager.Get("Update_RepairFinish")); ConnetToServer(); } }); } else { ConnetToServer(); } }
private static void HandleClientClientSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_CC ccSynDt) { int num = 0; FRAME_CMD_PKG fRAME_CMD_PKG = FRAME_CMD_PKG.New(); TdrError.ErrorType errorType = fRAME_CMD_PKG.unpack(ref ccSynDt.stSyncInfo.szBuff, (int)ccSynDt.stSyncInfo.wLen, ref num, 0u); DebugHelper.Assert(errorType == 0); if (errorType == null) { IFrameCommand frameCommand = FrameCommandFactory.CreateFrameCommand(ref fRAME_CMD_PKG); if (frameCommand != null) { frameCommand.playerID = ccSynDt.dwObjID; frameCommand.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(frameCommand); } else if ((FrameWindow._frameExceptionCounter += 1) <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create ccSync frame command error!"); } } else if ((FrameWindow._frameExceptionCounter += 1) <= 30) { BuglyAgent.ReportException(new Exception("TdrUnpackException"), "CCSync unpack error!"); } fRAME_CMD_PKG.Release(); }
protected override void StartMain() { if (GameConfigProject.instance.testView) { return; } bool initSucess = false; try { luaState.DoFile(startLuaName); //初始化脚本,如果出错了,那么很有可能是更新出错,把本地的缓存删除再次尝试 initSucess = true; } catch (Exception ex) { #if !UNITY_EDITOR PlayerPrefs.DeleteAll(); FileUtility.DirectoryDelete(Application.persistentDataPath, true); BuglyAgent.ReportException(ex, "Lua初始化失败:"); #endif Debug.LogError("Lua初始化失败:" + ex); } if (!initSucess) { try { Debug.Log("Lua初始化失败,删除缓存再次尝试!"); luaState.DoFile(startLuaName); //初始化失败后,删除磁盘缓存,再次初始化 } catch (Exception ex) { BuglyAgent.ReportException(ex, "Lua初始化失败:"); Debug.LogError("Lua再次初始化失败:" + ex); } } levelLoaded = luaState.GetFunction("ApplicationEvent.on_level_was_loaded"); onApplicationFocus = luaState.GetFunction("ApplicationEvent.on_app_focus"); }
/// <summary> /// Reports the exception. /// </summary> /// <param name="e">E.</param> /// <param name="message">Message.</param> public void ReportException(System.Exception e, string mes) { if (!isRuntime) { return; } BuglyAgent.ReportException(e, mes); }
/// <summary> /// Reports the exception. /// </summary> /// <param name="name">Name.</param> /// <param name="message">Message.</param> /// <param name="stackTrace">Stack trace.</param> public void ReportException(string name, string message, string stackTrace) { if (!isRuntime) { return; } BuglyAgent.ReportException(name, message, stackTrace); }
//--------------------------------------------------------------------- public void ReportLogWithPlayerId(string name, string player_id, string message, string stackTrace) { if (CanReportLog && !string.IsNullOrEmpty(CanReportLogPlayerId) && CanReportLogPlayerId.Equals(player_id)) { BuglyAgent.ReportException(name, message, stackTrace); } }
//--------------------------------------------------------------------- public void ReportLogWithDeviceId(string name, string message, string stackTrace) { string device_id = SystemInfo.deviceUniqueIdentifier; if (CanReportLog && !string.IsNullOrEmpty(CanReportLogDeviceId) && CanReportLogDeviceId.Equals(device_id)) { BuglyAgent.ReportException(name, message, stackTrace); } }
public void ReportCrashToBugly(string serverid, string rolename, string openid, string version, string realtime, string content) { BuglyAgent.ReportException("Exception", string.Format("ServerID: {0} RoleName: {1} OpenID: {2} Version: {3} RealTime: {4}", new object[] { serverid, rolename, openid, version, realtime }), content); }
public virtual void OnCheckOrdersSuccess(CheckOrderRess resList) { Debug.Log("OnCheckOrdersSuccess==>ObjectDumper Length:" + resList.CheckOrderRess_.Count + "\n" + ObjectDumper.Dump(resList)); PayHelper.SetGlobal(resList); List <string> list = new List <string>(); foreach (var res in resList.CheckOrderRess_) { list.Add(res.OrderId); JSONObject json = new JSONObject(res.Extra); Debug.Log("OnCheckOrdersSuccess==>res.Extra " + res.Extra); ProductVo vo = GlobalData.PayModel.GetProduct(res.CommodityId); SdkHelper.StatisticsAgent.OnPayEnd(res.OrderId, PayChannel, vo); if (res.Amount <= 0 || string.IsNullOrEmpty(res.OrderId)) { BuglyAgent.ReportException("PayAgent", "Amount:" + res.Amount + " OrderId:" + res.OrderId, "none"); } payChecker.RemoveOrder(res.OrderId); } if (resList.Awards?.Count > 0) { RewardUtil.AddReward(resList.Awards); AwardWindow awardWindow = PopupManager.ShowWindow <AwardWindow>("GameMain/Prefabs/AwardWindow/AwardWindow"); awardWindow.SetData(resList.Awards, I18NManager.Get("Common_RechargeSuccess")); } Debug.Log("GlobalData.PlayerModel.PlayerVo.ExtInfo" + resList.UserExtraInfo); EventDispatcher.TriggerEvent(EventConst.GetPayInfoSuccess, resList.UserBuyRmbMall); if (resList.TriggerId != null && resList.TriggerId.Count > 0) { Debug.LogWarning("resList.TriggerId-------->" + resList.TriggerId[0]); EventDispatcher.TriggerEvent(EventConst.TriggerGiftPaySuccess, resList.TriggerId); } if (resList.UserBuyRmbMall == null) { string orderId = "none"; if (list.Count > 0) { orderId = list[0]; } BuglyAgent.ReportException("checkOrderSuccess UserBuyRmbMall", "resList.UserBuyRmbMall为空 orderId:" + orderId, ""); } }
private void OnCheckPayListSuccess(CheckOrderRess resList) { PayHelper.SetGlobal(resList); if (resList.Awards?.Count > 0) { RewardUtil.AddReward(resList.Awards); AwardWindow awardWindow = PopupManager.ShowWindow <AwardWindow>("GameMain/Prefabs/AwardWindow/AwardWindow"); awardWindow.SetData(resList.Awards); } EventDispatcher.TriggerEvent(EventConst.GetPayInfoSuccess, resList.UserBuyRmbMall); List <string> list = new List <string>(); foreach (var res in resList.CheckOrderRess_) { list.Add(res.OrderId); if (res.Status == OrderStatusPB.StatusFiish) { Debug.Log("充值成功---TransactionId:" + res.TransactionId); } else { Debug.Log("充值状态:" + res.Status + " ---TransactionId:" + res.TransactionId); } ProductVo vo = GlobalData.PayModel.GetProduct(res.CommodityId); SdkHelper.StatisticsAgent.IOSPay(res, vo); } Debug.Log("OnCheckPayListSuccess resList.TransactionId=======>" + ObjectDumper.Dump(resList.TransactionId)); Debug.Log("first" + GlobalData.PlayerModel.PlayerVo.FirstRecharges.Count); GalaSDKBaseFunction.EndPay(GalaSDKBaseFunction.GalaSDKType.Apple, resList.TransactionId.ToArray()); if (resList.TriggerId != null && resList.TriggerId.Count > 0) { Debug.LogWarning("resList.TriggerId-------->" + resList.TriggerId[0]); EventDispatcher.TriggerEvent(EventConst.TriggerGiftPaySuccess, resList.TriggerId); } if (resList.UserBuyRmbMall == null) { string orderId = "none"; if (list.Count > 0) { orderId = list[0]; } BuglyAgent.ReportException("checkOrderSuccess UserBuyRmbMall", "resList.UserBuyRmbMall为空 orderId:" + orderId, ""); } }
private void OnCheckOrdersSuccess(CheckOrderRess resList) { Debug.Log("OnCheckOrdersSuccess==>ObjectDumper Length:" + resList.CheckOrderRess_.Count + "\n" + ObjectDumper.Dump(resList)); PayHelper.SetGlobal(resList); List <string> list = new List <string>(); foreach (var res in resList.CheckOrderRess_) { JSONObject json = new JSONObject(res.Extra); Debug.Log("OnCheckOrdersSuccess==>res.Extra " + res.Extra); string data = json["signedData"].str; data = data.Replace("\\", ""); JSONObject signedData = new JSONObject(data); JSONObject purchaseToken = signedData["purchaseToken"]; Debug.Log("OnCheckOrdersSuccess==>purchaseToken " + purchaseToken.str); list.Add(purchaseToken.str); ProductVo vo = GlobalData.PayModel.GetProduct(res.CommodityId); SdkHelper.StatisticsAgent.OnPayEnd(res.OrderId, PayAgent.PayChannel, vo); if (res.Amount <= 0 || string.IsNullOrEmpty(res.OrderId)) { BuglyAgent.ReportException("GooglePlay_Pay", "Amount:" + res.Amount + " OrderId:" + res.OrderId, "none"); } } GalaSDKBaseFunction.EndPay(GalaSDKBaseFunction.GalaSDKType.Google, list.ToArray()); if (resList.Awards?.Count > 0) { RewardUtil.AddReward(resList.Awards); AwardWindow awardWindow = PopupManager.ShowWindow <AwardWindow>("GameMain/Prefabs/AwardWindow/AwardWindow"); awardWindow.SetData(resList.Awards); } Debug.Log("GlobalData.PlayerModel.PlayerVo.ExtInfo" + resList.UserExtraInfo); EventDispatcher.TriggerEvent(EventConst.GetPayInfoSuccess, resList.UserBuyRmbMall); if (resList.TriggerId != null && resList.TriggerId.Count > 0) { Debug.LogWarning("resList.TrigerId-------->" + resList.TriggerId[0]); EventDispatcher.TriggerEvent(EventConst.TriggerGiftPaySuccess, resList.TriggerId); } }
static public int ReportException_s(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); if (argc == 2) { System.Exception a1; checkType(l, 1, out a1); System.String a2; checkType(l, 2, out a2); BuglyAgent.ReportException(a1, a2); pushValue(l, true); return(1); } else if (argc == 3) { System.String a1; checkType(l, 1, out a1); System.String a2; checkType(l, 2, out a2); System.String a3; checkType(l, 3, out a3); BuglyAgent.ReportException(a1, a2, a3); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function ReportException to call"); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
private void OnUserLogin(UserLoginRes res) { //登陆状态不再走登陆流程 if (SdkHelper.AccountAgent.IsLogin) { BuglyAgent.ReportException("OnUserLogin", "SdkHelper.AccountAgent.IsLogin=true", "none"); return; } SdkHelper.AccountAgent.IsLogin = true; GlobalData.PlayerModel.UserLoginRes = res; SendMessage(new Message(MessageConst.CMD_LOGIN_LOAD_DATA)); }
public void IOSPay(CheckOrderRes res, ProductVo vo) { if (res.Amount <= 0 || string.IsNullOrEmpty(res.OrderId)) { BuglyAgent.ReportException("iOS_Pay", "Amount:" + res.Amount + " OrderId:" + res.OrderId, "none"); } OnStartPay(res.OrderId, PayAgent.PayChannel, vo); ClientTimer.Instance.DelayCall(() => { OnPayEnd(res.OrderId, PayAgent.PayChannel, vo); }, Random.Range(5f, 10.0f)); }
private static void HandleClientServerSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_CS csSynDt) { IFrameCommand frameCommand = FrameCommandFactory.CreateFrameCommandByCSSyncInfo(ref csSynDt.stSyncInfo); if (frameCommand != null) { frameCommand.playerID = csSynDt.dwObjID; frameCommand.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(frameCommand); } else if ((FrameWindow._frameExceptionCounter += 1) <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create csSync frame command error!"); } }
private void OnLowMemory() { StringBuilder sb = new StringBuilder("内存不足警告==>") .AppendLine(" bundle 内存占用:").Append(AssetManager.Instance.GetBundleTotalMemory()) .AppendLine(" bundle 数量:").Append(AssetManager.Instance.BundleCount) .AppendLine(" 当前模块:").Append(ModuleManager.Instance.CurrentModule) .AppendLine(" 模块数量:").Append(ModuleManager.Instance.ModuleCount) .AppendLine(" Mono内存:").Append(Util.GetSizeUnit(Profiler.GetMonoUsedSizeLong())); string msg = sb.ToString(); BuglyAgent.ReportException("Application.lowMemory", msg, "none"); Debug.LogWarning(msg); Resources.UnloadUnusedAssets(); }
private void OnPayFail(string data) { Debug.LogError("SDK_支付失败===>" + data); if (Channel.IsTencent) { return; } if (string.IsNullOrEmpty(data)) { BuglyAgent.ReportException("PayAgent.OnPayFail", "SDK_支付失败", ""); return; } OnPaySuccess(data); }
public static string Get(string filePath) { FileStream fileStream = null; try { fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); } catch (Exception e) { BuglyAgent.ReportException("Md5 Get:", "filePath->" + filePath, e.StackTrace); fileStream?.Close(); return(""); } return(Get(fileStream)); }
private static void HandleAIChgSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_AISTATE AIState) { FrameCommand <AutoAIChgCommand> frameCommand = FrameCommandFactory.CreateSCSyncFrameCommand <AutoAIChgCommand>(); frameCommand.cmdData.m_autoType = AIState.bType; frameCommand.cmdData.m_playerID = AIState.dwPlayerObjID; IFrameCommand frameCommand2 = frameCommand; if (frameCommand2 != null) { frameCommand2.playerID = AIState.dwPlayerObjID; frameCommand2.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(frameCommand2); } else if ((FrameWindow._frameExceptionCounter += 1) <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create aiChange frame command error!"); } }
/// <summary> /// 清理客户端缓存 /// </summary> /// <param name="onDelete"></param> public void CleanForRepair(Action <bool> onDelete) { PlayerPrefs.DeleteAll(); PlayerPrefs.Save(); string path = Application.persistentDataPath + "/DataCache"; DirectoryInfo dir = new DirectoryInfo(path); if (dir.Exists) { try { dir.Delete(true); } catch (Exception e) { BuglyAgent.ReportException("Repair Delete DataCache", e.Message, e.StackTrace); } } DeleteHotfixDir(onDelete); }
static int _m_ReportException_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && translator.Assignable <System.Exception>(L, 1) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)) { System.Exception _e = (System.Exception)translator.GetObject(L, 1, typeof(System.Exception)); string _message = LuaAPI.lua_tostring(L, 2); BuglyAgent.ReportException(_e, _message); return(0); } if (gen_param_count == 3 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING)) { string _name = LuaAPI.lua_tostring(L, 1); string _message = LuaAPI.lua_tostring(L, 2); string _stackTrace = LuaAPI.lua_tostring(L, 3); BuglyAgent.ReportException(_name, _message, _stackTrace); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to BuglyAgent.ReportException!")); }
private static void HandleAIChgSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_AISTATE AIState) { IFrameCommand command = null; FrameCommand <AutoAIChgCommand> command2 = FrameCommandFactory.CreateFrameCommand <AutoAIChgCommand>(); command2.cmdData.m_autoType = AIState.bType; command2.cmdData.m_playerID = AIState.dwPlayerObjID; command = command2; if (command != null) { command.playerID = AIState.dwPlayerObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } else { _frameExceptionCounter = (byte)(_frameExceptionCounter + 1); if (_frameExceptionCounter <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create aiChange frame command error!"); } } }
public void ReportException(string name, string message, string stackTrace) { BuglyAgent.ReportException(name, message, stackTrace); }
public void ReportException(Exception e, string message) { ADebug.Log("ApolloReportService ReportException:" + e.ToString() + " message:" + message); BuglyAgent.ReportException(e, message); }