Exemple #1
0
    void InitBuglySDK()
    {
        Debug.Log("InitBuglySDK");
        // TODO NOT Required. Set the crash reporter type and log to report
        // BuglyAgent.ConfigCrashReporter (1, 2);
#if DEBUG
        // 开启SDK的日志打印, 发布版本请务必关闭
        BuglyAgent.ConfigDebugMode(true);
#endif
        // TODO NOT Required. Register log callback with 'BuglyAgent.LogCallbackDelegate' to replace the 'Application.RegisterLogCallback(Application.LogCallback)'
        // BuglyAgent.RegisterLogCallback (CallbackDelegate.Instance.OnApplicationLogCallbackHandler);

        // BuglyAgent.ConfigDefault ("Bugly", null, "ronnie", 0);

#if UNITY_IPHONE || UNITY_IOS
        BuglyAgent.InitWithAppId(BuglyAppIDForiOS);
#elif UNITY_ANDROID
        BuglyAgent.InitWithAppId(BuglyAppIDForAndroid);
#endif

        // TODO Required. If you do not need call 'InitWithAppId(string)' to initialize the sdk(may be you has initialized the sdk it associated Android or iOS project),
        // please call this method to enable c# exception handler only.
        BuglyAgent.EnableExceptionHandler();

        // TODO NOT Required. If you need to report extra data with exception, you can set the extra handler
        // BuglyAgent.SetLogCallbackExtrasHandler (MyLogCallbackExtrasHandler);

        BuglyAgent.PrintLog(LogSeverity.LogInfo, "Init the bugly sdk");
    }
Exemple #2
0
    public static void Initialize()
    {
        //---- Enable the debug log print,Release下需要设为false
#if DEBUG
        BuglyAgent.ConfigDebugMode(true);
#else
        BuglyAgent.ConfigDebugMode(false);
#endif

        //---- Config default channel, version, user
        //BuglyAgent.ConfigDefault (null, null, null, 0);

        //---- Config auto report log level, default is LogSeverity.LogError, so the LogError, LogException log will auto report
        BuglyAgent.ConfigAutoReportLogLevel(LogSeverity.LogError);

        //---- Config auto quit the application make sure only the first one c# exception log will be report, please don't set TRUE if you do not known what are you doing.
        //BuglyAgent.ConfigAutoQuitApplication (false);

        //---- If you need register Application.RegisterLogCallback(LogCallback), you can replace it with this method to make sure your function is ok.
        //BuglyAgent.RegisterLogCallback (null);

        //---- Init the bugly sdk and enable the c# exception handler.
        BuglyAgent.InitWithAppId(_BuglyAppID);

        //---- TODO Required. If you do not need call 'InitWithAppId(string)' to initialize the sdk(may be you has initialized the sdk it associated Android or iOS project),
        //---- please call this method to enable c# exception handler only.
        //BuglyAgent.EnableExceptionHandler ();

        //---- TODO NOT Required. If you need to report extra data with exception, you can set the extra handler
        //BuglyAgent.SetLogCallbackExtrasHandler (MyLogCallbackExtrasHandler);

        BuglyAgent.PrintLog(LogSeverity.LogInfo, "Bugly init complete, time: {0}", System.DateTime.Now);
        //Debug.Log(HobaString.Format("Bugly init complete, time: {0}, verion: v{1}", System.DateTime.Now, BuglyAgent.PluginVersion));
    }
        //---------------------------------------------------------------------
        void _onSocketError(object rec, SocketErrorEventArgs args)
        {
            BuglyAgent.PrintLog(LogSeverity.Log, args.Exception.Message);
            BuglyAgent.ReportException(args.Exception, args.Exception.Message);

            _onSocketClose();
        }
Exemple #4
0
 static public int PrintLog_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
         LogSeverity a1;
         a1 = (LogSeverity)LuaDLL.luaL_checkinteger(l, 1);
         System.String a2;
         checkType(l, 2, out a2);
         System.Object[] a3;
         checkParams(l, 3, out a3);
         BuglyAgent.PrintLog(a1, a2, a3);
         pushValue(l, true);
         return(1);
     }
     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
 }
Exemple #5
0
        //---------------------------------------------------------------------
        IEnumerator _localLoadAssetBundleAsync(string url, Action <AssetBundle> cb)
        {
            AssetBundle ab = null;

            using (UnityWebRequest www_request = UnityWebRequest.Get(url))
            {
                yield return(www_request.SendWebRequest());

                if (www_request.isHttpError || www_request.isNetworkError)
                {
                    BuglyAgent.PrintLog(LogSeverity.LogError, www_request.error);
                }
                else
                {
                    if (www_request.responseCode == 200)
                    {
                        ab = DownloadHandlerAssetBundle.GetContent(www_request);
                    }
                }
            }

            if (cb != null)
            {
                cb.Invoke(ab);
            }
        }
Exemple #6
0
        //---------------------------------------------------------------------
        IEnumerator _wwwLoadTextureAsync(string url, Action <Texture> cb)
        {
            Texture texture = null;

            using (UnityWebRequest www_request = UnityWebRequest.Get(url))
            {
                www_request.downloadHandler = new DownloadHandlerTexture();
                yield return(www_request.SendWebRequest());

                if (www_request.isHttpError || www_request.isNetworkError)
                {
                    BuglyAgent.PrintLog(LogSeverity.LogError, www_request.error);
                }
                else
                {
                    if (www_request.responseCode == 200)
                    {
                        texture = ((DownloadHandlerTexture)www_request.downloadHandler).texture;
                    }
                }
            }

            if (cb != null)
            {
                cb.Invoke(texture);
            }
        }
Exemple #7
0
        //---------------------------------------------------------------------
        IEnumerator _wwwLoadTextAsync(string url, Action <string> cb)
        {
            string s = string.Empty;

            using (UnityWebRequest www_request = UnityWebRequest.Get(url))
            {
                yield return(www_request.SendWebRequest());

                if (www_request.isHttpError || www_request.isNetworkError)
                {
                    BuglyAgent.PrintLog(LogSeverity.LogError, www_request.error);
                }
                else
                {
                    if (www_request.responseCode == 200)
                    {
                        s = www_request.downloadHandler.text;
                    }
                }
            }

            if (cb != null)
            {
                cb.Invoke(s);
            }
        }
Exemple #8
0
        //---------------------------------------------------------------------
        IEnumerator _wwwLoadTextListAsync(List <string> list_url, Action <List <string> > cb)
        {
            List <string> list_string = new List <string>();

            foreach (var i in list_url)
            {
                using (UnityWebRequest www_request = UnityWebRequest.Get(i))
                {
                    yield return(www_request.SendWebRequest());

                    if (www_request.isHttpError || www_request.isNetworkError)
                    {
                        BuglyAgent.PrintLog(LogSeverity.LogError, www_request.error);
                    }
                    else
                    {
                        if (www_request.responseCode == 200)
                        {
                            list_string.Add(www_request.downloadHandler.text);
                        }
                    }
                }
            }

            if (cb != null)
            {
                cb.Invoke(list_string);
            }
        }
Exemple #9
0
    // Extra data handler to packet data and report them with exception.
    // Please do not do hard work in this handler
    static Dictionary <string, string> MyLogCallbackExtrasHandler()
    {
        // TODO Test log, please do not copy it
        BuglyAgent.PrintLog(LogSeverity.Log, "extra handler");

        // TODO Sample code, please do not copy it
        Dictionary <string, string> extras = new Dictionary <string, string> ();

        extras.Add("ScreenSolution", string.Format("{0}x{1}", Screen.width, Screen.height));
        extras.Add("deviceModel", SystemInfo.deviceModel);
        extras.Add("deviceName", SystemInfo.deviceName);
        extras.Add("deviceType", SystemInfo.deviceType.ToString());

        extras.Add("deviceUId", SystemInfo.deviceUniqueIdentifier);
        extras.Add("gDId", string.Format("{0}", SystemInfo.graphicsDeviceID));
        extras.Add("gDName", SystemInfo.graphicsDeviceName);
        extras.Add("gDVdr", SystemInfo.graphicsDeviceVendor);
        extras.Add("gDVer", SystemInfo.graphicsDeviceVersion);
        extras.Add("gDVdrID", string.Format("{0}", SystemInfo.graphicsDeviceVendorID));

        extras.Add("graphicsMemorySize", string.Format("{0}", SystemInfo.graphicsMemorySize));
        extras.Add("systemMemorySize", string.Format("{0}", SystemInfo.systemMemorySize));
        extras.Add("UnityVersion", Application.unityVersion);

        BuglyAgent.PrintLog(LogSeverity.LogInfo, "Package extra data");
        return(extras);
    }
Exemple #10
0
 private void Start()
 {
     BuglyAgent.PrintLog(LogSeverity.LogInfo, "Demo Start()", new object[0]);
     this.SetupGUIStyle();
     this.InitBuglySDK();
     BuglyAgent.PrintLog(LogSeverity.LogWarning, "Init bugly sdk done", new object[0]);
     BuglyAgent.SetScene(3450);
 }
Exemple #11
0
 /// <summary>
 /// 场景加载后的回调
 /// </summary>
 /// <param name="scene"></param>
 /// <param name="mode"></param>
 void OnSceneLoaded(Scene scene, LoadSceneMode mode)
 {
     if (scene != null)
     {
         string info = string.Format("sceneload: {0}, graphics: {1}", scene.name, GlobalSettings.GetInstance().GraphicLevel);
         //Debug.Log(info);
         BuglyAgent.PrintLog(LogSeverity.LogInfo, info);
     }
 }
Exemple #12
0
    /// <summary>
    /// 初始化bugly
    /// </summary>
    public void InitBuglySDK()
    {
#if UNITY_ANDROID || UNITY_IPHONE || UNITY_IOS
        // TODO NOT Required. Set the crash reporter type and log to report
        // BuglyAgent.ConfigCrashReporter (1, 2);

        // TODO NOT Required. Enable debug log print, please set false for release version
#if DEBUG
        BuglyAgent.ConfigDebugMode(true);
#endif
        //BuglyAgent.ConfigDebugMode(true);
        // TODO NOT Required. Register log callback with 'BuglyAgent.LogCallbackDelegate' to replace the 'Application.RegisterLogCallback(Application.LogCallback)'
        // BuglyAgent.RegisterLogCallback (CallbackDelegate.Instance.OnApplicationLogCallbackHandler);

        // BuglyAgent.ConfigDefault ("Bugly", null, "ronnie", 0);

#if UNITY_IPHONE || UNITY_IOS
        if (Const.Region == RegionType.CHINA)
        {
            var channel = string.Format("{0}_{1}", GlobalConfig.Instance.Channel, GlobalConfig.Instance.SubChannel);

            BuglyAgent.ConfigDefault(channel, null, null, 0);
            BuglyAgent.InitWithAppId("d47e3e83c9");
        }
        else if (Const.Region == RegionType.HKTW)
        {
            BuglyAgent.InitWithAppId("af2d9108c7");
        }
        else if (Const.Region == RegionType.KOREA)
        {
            BuglyAgent.InitWithAppId("c5ab48ff08");
        }
        else if (Const.Region == RegionType.SEASIA)
        {
            BuglyAgent.InitWithAppId("9baaf461f1");
        }
        // iOS工程启动初始化
#elif UNITY_ANDROID
        // BuglyAgent.InitWithAppId ("900036622");
        // android工程启动初始化
#endif

        //BuglyAgent.SetUserId();
        // TODO Required. If you do not need call 'InitWithAppId(string)' to initialize the sdk(may be you has initialized the sdk it associated Android or iOS project),
        // please call this method to enable c# exception handler only.
        BuglyAgent.EnableExceptionHandler();

        // If you need to report extra data with exception, you can set the extra handler
        //BuglyAgent.SetLogCallbackExtrasHandler(LogCallbackExtrasHandler);



        BuglyAgent.ConfigAutoReportLogLevel(LogSeverity.LogException);
        BuglyAgent.PrintLog(LogSeverity.LogInfo, "Init the bugly sdk");
        LogExtraInfo();
#endif
    }
Exemple #13
0
    /// <summary>
    /// 应用内存不足时候的回调
    /// </summary>
    void OnLowMemory()
    {
        if (mLowMemoryCount >= 60)
        {
            return;
        }

        BuglyAgent.PrintLog(LogSeverity.LogInfo, "low memory");
        mLowMemoryCount++;
    }
Exemple #14
0
//    private void findGameObjectByTag ()
//    {
//        System.Console.Write ("it will throw UnityException");
//        GameObject go = GameObject.FindWithTag ("test");
//
//        string gName = go.name;
//        System.Console.Write (gName);
//    }
//
//    private void findGameObject ()
//    {
//        System.Console.Write ("it will throw NullReferenceException");
//
//        GameObject go = GameObject.Find ("test");
//        string gName = go.name;
//
//        System.Console.Write (gName);
//    }
//
    private void throwException(Exception e)
    {
        if (e == null)
        {
            return;
        }

        BuglyAgent.PrintLog(LogSeverity.LogWarning, "Throw exception: {0}", e.ToString());

        testDeepFrame(e);
    }
Exemple #15
0
    /// <summary>
    /// Raises the application log callback handler event.
    /// </summary>
    /// <param name="condition">Condition.</param>
    /// <param name="stackTrace">Stack trace.</param>
    /// <param name="type">Type.</param>
    public override void OnApplicationLogCallbackHandler(string condition, string stackTrace, LogType type)
    {
        BuglyAgent.PrintLog(LogSeverity.Log, "\n------\n[\n{0} - {1}\n{2}\n]\n------", type.ToString(), condition, stackTrace);

//      System.Console.Write ("------------------");
//
//      System.Console.Write ("Current thread: {0}", Thread.CurrentThread.ManagedThreadId);
//      System.Console.WriteLine ();
//
//      System.Console.Write ("[{0}] - {1}\n{2}",type.ToString(), condition, stackTrace);
//
//      System.Console.Write ("------------------");
    }
    private void InitBuglySDK()
    {
        BuglyAgent.ConfigDebugMode(false);
        BuglyAgent.InitWithAppId("004e85ad39");

        BuglyAgent.EnableExceptionHandler();
        BuglyAgent.PrintLog(LogSeverity.LogInfo, "Init the bugly sdk");

        // set tag
#if UNITY_ANDROID
        BuglyAgent.SetScene(3450);
#else
        BuglyAgent.SetScene(3261);
#endif
    }
Exemple #17
0
//    // Extra data handler to packet data and report them with exception.
//    // Please do not do hard work in this handler
//    Dictionary<string, string> MyLogCallbackExtrasHandler ()
//    {
//        // TODO Test log, please do not copy it
//        BuglyAgent.PrintLog (LogSeverity.Log, "extra handler");
//
//        // TODO Sample code, please do not copy it
//        Dictionary<string, string> extras = new Dictionary<string, string> ();
//        extras.Add ("ScreenSolution", string.Format ("{0}x{1}", Screen.width, Screen.height));
//        extras.Add ("deviceModel", SystemInfo.deviceModel);
//        extras.Add ("deviceName", SystemInfo.deviceName);
//        extras.Add ("deviceType", SystemInfo.deviceType.ToString ());
//
//        extras.Add ("deviceUId", SystemInfo.deviceUniqueIdentifier);
//        extras.Add ("gDId", string.Format ("{0}", SystemInfo.graphicsDeviceID));
//        extras.Add ("gDName", SystemInfo.graphicsDeviceName);
//        extras.Add ("gDVdr", SystemInfo.graphicsDeviceVendor);
//        extras.Add ("gDVer", SystemInfo.graphicsDeviceVersion);
//        extras.Add ("gDVdrID", string.Format ("{0}", SystemInfo.graphicsDeviceVendorID));
//
//        extras.Add ("graphicsMemorySize", string.Format ("{0}", SystemInfo.graphicsMemorySize));
//        extras.Add ("systemMemorySize", string.Format ("{0}", SystemInfo.systemMemorySize));
//        extras.Add ("UnityVersion", Application.unityVersion);
//
//        BuglyAgent.PrintLog (LogSeverity.LogInfo, "Package extra data");
//        return extras;
//    }

    // Use this for initialization
    void Start()
    {
        BuglyAgent.PrintLog(LogSeverity.LogInfo, "Demo Start()");

        SetupGUIStyle();

        InitBuglySDK();

        BuglyAgent.PrintLog(LogSeverity.LogWarning, "Init bugly sdk done");
        // set tag
#if UNITY_ANDROID
        BuglyAgent.SetScene(3450);
#else
        BuglyAgent.SetScene(3261);
#endif
    }
Exemple #18
0
        public void Awake()
        {
            if (Instance == null)
            {
                Log.Debug("bugly sdk init");
                Instance = this;
                if (Application.isEditor)
                {
                    isRuntime = false;
                    return;
                }
#if DEBUG
                //BuglyAgent.ConfigDebugMode(true);
#endif
                //logcall = RegisterCallBack;
                //BuglyAgent.RegisterLogCallback(logcall);
                BuglyAgent.ConfigDefault(channel, Application.version, Application.productName, 0);

                if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    if (GlobalData.Instance.serverType == 2)
                    {
                        BuglyAgent.InitWithAppId("1bef60b664");//正式服
                    }
                    else if (GlobalData.Instance.serverType == 1)
                    {
                        BuglyAgent.InitWithAppId("809b83eaa2");//测试服
                    }
                }
                else if (Application.platform == RuntimePlatform.Android)
                {
                    if (GlobalData.Instance.serverType == 2)
                    {
                        BuglyAgent.InitWithAppId("b15be2578e");//正式服
                    }
                    else if (GlobalData.Instance.serverType == 1)
                    {
                        BuglyAgent.InitWithAppId("02cceece35");//测试服
                    }
                }
                BuglyAgent.EnableExceptionHandler();
                BuglyAgent.PrintLog(LogSeverity.LogInfo, "bugly sdk init");
            }
        }
Exemple #19
0
        //---------------------------------------------------------------------
        IEnumerator _postUrlWithFormData(string url, WWWForm form_data, Action <int, string> cb)
        {
            using (UnityWebRequest www_request = UnityWebRequest.Post(url, form_data))
            {
                www_request.downloadHandler = new DownloadHandlerBuffer();
                yield return(www_request.SendWebRequest());

                int http_statuscode = (int)www_request.responseCode;
                if (www_request.isNetworkError)
                {
                    BuglyAgent.PrintLog(LogSeverity.LogError, www_request.error);
                }

                if (cb != null)
                {
                    cb.Invoke(http_statuscode, www_request.downloadHandler.text);
                }
            }
        }
Exemple #20
0
    private Dictionary <string, string> MyLogCallbackExtrasHandler()
    {
        BuglyAgent.PrintLog(LogSeverity.Log, "extra handler", new object[0]);
        Dictionary <string, string> dictionary = new Dictionary <string, string>();

        dictionary.Add("ScreenSolution", string.Format("{0}x{1}", Screen.width, Screen.height));
        dictionary.Add("deviceModel", SystemInfo.deviceModel);
        dictionary.Add("deviceName", SystemInfo.deviceName);
        dictionary.Add("deviceType", SystemInfo.deviceType.ToString());
        dictionary.Add("deviceUId", SystemInfo.deviceUniqueIdentifier);
        dictionary.Add("gDId", string.Format("{0}", SystemInfo.graphicsDeviceID));
        dictionary.Add("gDName", SystemInfo.graphicsDeviceName);
        dictionary.Add("gDVdr", SystemInfo.graphicsDeviceVendor);
        dictionary.Add("gDVer", SystemInfo.graphicsDeviceVersion);
        dictionary.Add("gDVdrID", string.Format("{0}", SystemInfo.graphicsDeviceVendorID));
        dictionary.Add("graphicsMemorySize", string.Format("{0}", SystemInfo.graphicsMemorySize));
        dictionary.Add("systemMemorySize", string.Format("{0}", SystemInfo.systemMemorySize));
        dictionary.Add("UnityVersion", Application.unityVersion);
        BuglyAgent.PrintLog(LogSeverity.LogInfo, "Package extra data", new object[0]);
        return(dictionary);
    }
Exemple #21
0
        static int _m_PrintLog_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    LogSeverity _level; translator.Get(L, 1, out _level);
                    string      _format = LuaAPI.lua_tostring(L, 2);
                    object[]    _args   = translator.GetParams <object>(L, 3);

                    BuglyAgent.PrintLog(_level, _format, _args);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Exemple #22
0
        //---------------------------------------------------------------------
        IEnumerator _sendUrl(string url, Action <string> cb)
        {
            using (UnityWebRequest www_request = UnityWebRequest.Get(url))
            {
                yield return(www_request.SendWebRequest());

                if (www_request.error != null)
                {
                    BuglyAgent.PrintLog(LogSeverity.LogError, www_request.error);
                }
                else
                {
                    if (www_request.responseCode == 200)
                    {
                        if (cb != null)
                        {
                            cb.Invoke(www_request.downloadHandler.text);
                        }
                    }
                }
            }
        }
Exemple #23
0
    void InitBuglySDK()
    {
        if (AppConst.LuaByteMode)
        {
            BuglyAppIDForiOS     = "ec087313d2";
            BuglyAppIDForAndroid = "0f2d24b14a";
        }
        else
        {
            BuglyAppIDForiOS     = "37df5c565c";
            BuglyAppIDForAndroid = "d41a27b748";
        }


#if DEBUG
        BuglyAgent.ConfigDebugMode(true);
#endif
        BuglyAgent.ConfigDebugMode(true);
        // TODO NOT Required. Register log callback with 'BuglyAgent.LogCallbackDelegate' to replace the 'Application.RegisterLogCallback(Application.LogCallback)'
        // BuglyAgent.RegisterLogCallback (CallbackDelegate.Instance.OnApplicationLogCallbackHandler);

        // BuglyAgent.ConfigDefault ("Bugly", null, "ronnie", 0);

#if UNITY_IPHONE || UNITY_IOS
        BuglyAgent.InitWithAppId(BuglyAppIDForiOS);
#elif UNITY_ANDROID
        BuglyAgent.InitWithAppId(BuglyAppIDForAndroid);
#endif

        // TODO Required. If you do not need call 'InitWithAppId(string)' to initialize the sdk(may be you has initialized the sdk it associated Android or iOS project),
        // please call this method to enable c# exception handler only.
        BuglyAgent.EnableExceptionHandler();

        // TODO NOT Required. If you need to report extra data with exception, you can set the extra handler
        //        BuglyAgent.SetLogCallbackExtrasHandler (MyLogCallbackExtrasHandler);

        BuglyAgent.PrintLog(LogSeverity.LogInfo, "Init the bugly sdk");
    }
Exemple #24
0
        //---------------------------------------------------------------------
        IEnumerator _postUrl(string url, string post_data, Action <int, string> cb)
        {
            using (UnityWebRequest www_request = new UnityWebRequest(url, "POST"))
            {
                byte[] post_bytes = System.Text.Encoding.UTF8.GetBytes(post_data);
                www_request.uploadHandler   = new UploadHandlerRaw(post_bytes);
                www_request.downloadHandler = new DownloadHandlerBuffer();
                www_request.SetRequestHeader("Content-Type", "application/json");

                yield return(www_request.SendWebRequest());

                int http_statuscode = (int)www_request.responseCode;
                if (www_request.isNetworkError)
                {
                    BuglyAgent.PrintLog(LogSeverity.LogError, www_request.error);
                }

                if (cb != null)
                {
                    cb.Invoke(http_statuscode, www_request.downloadHandler.text);
                }
            }
        }
Exemple #25
0
    //    // Extra data handler to packet data and report them with exception.
    //    // Please do not do hard work in this handler
    //    Dictionary<string, string> MyLogCallbackExtrasHandler ()
    //    {
    //        // TODO Test log, please do not copy it
    //        BuglyAgent.PrintLog (LogSeverity.Log, "extra handler");
    //
    //        // TODO Sample code, please do not copy it
    //        Dictionary<string, string> extras = new Dictionary<string, string> ();
    //        extras.Add ("ScreenSolution", string.Format ("{0}x{1}", Screen.width, Screen.height));
    //        extras.Add ("deviceModel", SystemInfo.deviceModel);
    //        extras.Add ("deviceName", SystemInfo.deviceName);
    //        extras.Add ("deviceType", SystemInfo.deviceType.ToString ());
    //
    //        extras.Add ("deviceUId", SystemInfo.deviceUniqueIdentifier);
    //        extras.Add ("gDId", string.Format ("{0}", SystemInfo.graphicsDeviceID));
    //        extras.Add ("gDName", SystemInfo.graphicsDeviceName);
    //        extras.Add ("gDVdr", SystemInfo.graphicsDeviceVendor);
    //        extras.Add ("gDVer", SystemInfo.graphicsDeviceVersion);
    //        extras.Add ("gDVdrID", string.Format ("{0}", SystemInfo.graphicsDeviceVendorID));
    //
    //        extras.Add ("graphicsMemorySize", string.Format ("{0}", SystemInfo.graphicsMemorySize));
    //        extras.Add ("systemMemorySize", string.Format ("{0}", SystemInfo.systemMemorySize));
    //        extras.Add ("UnityVersion", Application.unityVersion);
    //
    //        BuglyAgent.PrintLog (LogSeverity.LogInfo, "Package extra data");
    //        return extras;
    //    }

    // Use this for initialization
    void Start()
    {
        BuglyAgent.PrintLog(LogSeverity.LogInfo, "Bugly Component Start()");
        InitBuglySDK();
        BuglyAgent.PrintLog(LogSeverity.LogWarning, "Init bugly sdk done");
    }
Exemple #26
0
 public void BuglyPrintLog(int logLevel, string log)
 {
     BuglyAgent.PrintLog((LogSeverity)logLevel, log);
 }
Exemple #27
0
    private void TrigException(int selGridInt)
    {
        BuglyAgent.PrintLog(LogSeverity.LogWarning, "Trigge Exception: {0}", new object[]
        {
            selGridInt
        });
        switch (selGridInt)
        {
        case 0:
            this.throwException(new Exception("Non-fatal error, an base C# exception"));
            break;

        case 1:
            this.throwException(new SystemException("Fatal error, a system exception"));
            break;

        case 2:
            this.throwException(new ApplicationException("Fatal error, an application exception"));
            break;

        case 3:
            this.throwException(new ArgumentException(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 4:
            this.throwException(new FormatException(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 5:
            break;

        case 6:
            this.throwException(new MemberAccessException(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 7:
            this.throwException(new FieldAccessException(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 8:
            this.throwException(new MethodAccessException(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 9:
            this.throwException(new MissingMemberException(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 10:
            this.throwException(new MissingMethodException(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 11:
            this.throwException(new MissingFieldException(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 12:
            this.throwException(new IndexOutOfRangeException(string.Format("Non-Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 13:
            this.throwException(new ArrayTypeMismatchException(string.Format("Non-Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 14:
            this.throwException(new RankException(string.Format("Non-Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 15:
        case 16:
        case 17:
        case 18:
        case 19:
        case 20:
            try
            {
                this.throwException(new Exception(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            }
            catch (Exception e)
            {
                BuglyAgent.ReportException(e, "Caught an exception.");
            }
            break;

        case 21:
            this.throwException(new ArithmeticException(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 22:
            this.throwException(new NotFiniteNumberException(string.Format("Fatal error, {0} ", this.selGridItems[selGridInt])));
            break;

        case 23:
        {
            int num = 0;
            num = 2 / num;
            break;
        }

        case 24:
            this.throwException(new OutOfMemoryException("Fatal error, OOM"));
            break;

        case 25:
            this.findGameObject();
            break;

        case 26:
        {
            Exception ex = null;
            IndexOutOfRangeException arg = (IndexOutOfRangeException)ex;
            Console.Write(string.Empty + arg);
            break;
        }

        case 27:
            this.findGameObjectByTag();
            break;

        case 28:
            this.DoCrash();
            break;

        case 29:
        case 30:
            this.TestCrashNative();
            this.TestCrash();
            break;

        default:
            try
            {
                this.throwException(new OutOfMemoryException("Fatal error, out of memory"));
            }
            catch (Exception exception)
            {
                Debug.LogException(exception);
            }
            break;
        }
    }
Exemple #28
0
    private void TrigException(int selGridInt)
    {
        BuglyAgent.PrintLog(LogSeverity.LogWarning, "Trigge Exception: {0}", selGridInt);

        switch (selGridInt)
        {
        case 0:
            ExceptionProbe.NormalException();
            break;

        case 1:
            ExceptionProbe.NormalSystemException();
            break;

        case 2:
            ExceptionProbe.ArgumentException();
            break;

        case 3:
            ExceptionProbe.ArgumentException();
            break;

        case 4:
            ExceptionProbe.FormatException();
            break;

        case 5: // ignore
            break;

        case 6:
            ExceptionProbe.MemberAccessException();
            break;

        case 7:
            ExceptionProbe.FieldAccessException();
            break;

        case 8:
            ExceptionProbe.MethodAccessException();
            break;

        case 9:
            ExceptionProbe.MissingMemberException();
            break;

        case 10:
            ExceptionProbe.MissingMethodException();
            break;

        case 11:
            ExceptionProbe.MissingFieldException();
            break;

        case 12:
            ExceptionProbe.IndexOutOfRangeException();
            break;

        case 13:
            ExceptionProbe.ArrayTypeMismatchException();
            break;

        case 14:
            ExceptionProbe.RankException();
            break;

        case 15:
            ExceptionProbe.IOException();
            break;

        case 16:
            ExceptionProbe.DirectoryNotFoundException();
            break;

        case 17:
            ExceptionProbe.FileNotFoundException();
            break;

        case 18:
            ExceptionProbe.EndOfStreamException();
            break;

        case 19:
            ExceptionProbe.FileLoadException();
            break;

        case 20:
            ExceptionProbe.PathTooLongException();
            break;

        case 21:
            ExceptionProbe.ArithmeticException();
            break;

        case 22:
            ExceptionProbe.NotFiniteNumberException();
            break;

        case 23:
            ExceptionProbe.DivideByZero();
            break;

        case 24:
            ExceptionProbe.OutOfMemory();
            break;

        case 25:
            ExceptionProbe.NRE();
            break;

        case 26:
            ExceptionProbe.InvalidCastException();
            break;

        case 27:
            ExceptionProbe.InvalidOperationException();
            break;

        case 28:
            ExceptionProbe.OverflowException();
            break;

        case 29:
            ExceptionProbe.StackOverflow();
            break;

        default:
            try {
                throwException(new System.OutOfMemoryException("Fatal error, out of memory"));
            } catch (System.Exception e) {
                UnityEngine.Debug.LogException(e);
            }
            break;
        }
    }
Exemple #29
0
 // Token: 0x06015650 RID: 87632 RVA: 0x0056D494 File Offset: 0x0056B694
 private static void _reportException(bool uncaught, string name, string reason, string stackTrace)
 {
     if (string.IsNullOrEmpty(name))
     {
         return;
     }
     if (string.IsNullOrEmpty(stackTrace))
     {
         stackTrace = StackTraceUtility.ExtractStackTrace();
     }
     if (string.IsNullOrEmpty(stackTrace))
     {
         stackTrace = "Empty";
     }
     else
     {
         try
         {
             string[] array = stackTrace.Split(new char[]
             {
                 '\n'
             });
             if (array != null && array.Length > 0)
             {
                 StringBuilder stringBuilder = new StringBuilder();
                 int           num           = array.Length;
                 for (int i = 0; i < num; i++)
                 {
                     string text = array[i];
                     if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text.Trim()))
                     {
                         text = text.Trim();
                         if (!text.StartsWith("System.Collections.Generic.") && !text.StartsWith("ShimEnumerator"))
                         {
                             if (!text.StartsWith("Bugly"))
                             {
                                 if (!text.Contains("..ctor"))
                                 {
                                     int num2 = text.ToLower().IndexOf("(at");
                                     int num3 = text.ToLower().IndexOf("/assets/");
                                     if (num2 > 0 && num3 > 0)
                                     {
                                         stringBuilder.AppendFormat("{0}(at {1}", text.Substring(0, num2).Replace(":", "."), text.Substring(num3));
                                     }
                                     else
                                     {
                                         stringBuilder.Append(text.Replace(":", "."));
                                     }
                                     stringBuilder.AppendLine();
                                 }
                             }
                         }
                     }
                 }
                 stackTrace = stringBuilder.ToString();
             }
         }
         catch
         {
             BuglyAgent.PrintLog(LogSeverity.LogWarning, "{0}", new object[]
             {
                 "Error to parse the stack trace"
             });
         }
     }
     BuglyAgent.PrintLog(LogSeverity.LogError, "ReportException: {0} {1}\n*********\n{2}\n*********", new object[]
     {
         name,
         reason,
         stackTrace
     });
     BuglyAgent._uncaughtAutoReportOnce = (uncaught && BuglyAgent._autoQuitApplicationAfterReport);
     BuglyAgent.ReportException((!uncaught) ? BuglyAgent.EXCEPTION_TYPE_CAUGHT : BuglyAgent.EXCEPTION_TYPE_UNCAUGHT, name, reason, stackTrace, uncaught && BuglyAgent._autoQuitApplicationAfterReport);
 }
Exemple #30
0
    // Extra data handler to packet data and report them with exception.
    // Please do not do hard work in this handler
    void LogExtraInfo()
    {
        Dictionary <string, string> extras = new Dictionary <string, string>();

        //----设备信息------
        extras.Add("solution", string.Format("{0}x{1}", Screen.width, Screen.height));
        extras.Add("deviceModel", SystemInfo.deviceModel);
        extras.Add("deviceName", SystemInfo.deviceName);
        extras.Add("deviceType", SystemInfo.deviceType.ToString());
        extras.Add("deviceUId", SystemInfo.deviceUniqueIdentifier);
        //系统内存大小
        extras.Add("systemMemorySize", SystemInfo.systemMemorySize.ToString());

        //----显卡信息------
        //显卡设备标识ID
        extras.Add("gDeviceID", SystemInfo.graphicsDeviceID.ToString());
        //显卡名称
        extras.Add("gDeviceName", SystemInfo.graphicsDeviceName);
        //显卡类型
        extras.Add("gDeviceType", SystemInfo.graphicsDeviceType.ToString());
        //显卡供应商
        extras.Add("gDeviceVendor", SystemInfo.graphicsDeviceVendor);
        //显卡供应唯一ID
        extras.Add("gDeviceVendorID", SystemInfo.graphicsDeviceVendorID.ToString());
        //显卡版本号
        extras.Add("gDeviceVersion", SystemInfo.graphicsDeviceVersion);
        //显卡内存大小
        extras.Add("gMemorySize", SystemInfo.graphicsMemorySize.ToString());
        extras.Add("gShaderLevel", SystemInfo.graphicsShaderLevel.ToString());

        //----CPU信息------
        //CPU核数
        extras.Add("processorCount", SystemInfo.processorCount.ToString());
        //CPU主频
        extras.Add("processorFrequency", SystemInfo.processorFrequency.ToString());
        //CPU类型
        extras.Add("processorType", SystemInfo.processorType);

        //extras.Add("graphicLevel", QualitySetting.GraphicLevel.ToString());

        var    bridge       = DBOSManager.getDBOSManager().getBridge();
        string res1_version = "0";
        string res2_version = "0";

        if (bridge != null)
        {
            // 解析res1
            var version_str = bridge.getBaseVersionJsonStr();
            if (string.IsNullOrEmpty(version_str) == false)
            {
                Hashtable jsonObject = MiniJSON.JsonDecode(version_str) as Hashtable;
                if (jsonObject != null)
                {
                    res1_version = (string)jsonObject["version"];
                }
            }

            // 解析res2

#if UNITY_IPHONE
            version_str = bridge.getExVersionJsonStr();

            if (string.IsNullOrEmpty(version_str) == false)
            {
                Debug.Log("current res2 version_str : " + version_str);
                Hashtable verTabel = MiniJSON.JsonDecode(version_str) as Hashtable;
                if (verTabel != null)
                {
                    res2_version = verTabel["ver"].ToString();
                }
                Debug.Log("current res2 res2_version:" + res2_version);
            }
            else
            {
                Debug.Log("current res2 version_str is null");
            }
#else
            version_str = bridge.getExVersionJsonStr();
            if (string.IsNullOrEmpty(version_str) == false)
            {
                ArrayList version_list = MiniJSON.JsonDecode(version_str) as ArrayList;

                if (version_list != null && version_list.Count > 0)
                {
                    Hashtable version_table = version_list[0] as Hashtable;
                    if (version_table != null)
                    {
                        res2_version = string.Format("{0}", (System.Int32)(System.Double) version_table["version"]);
                    }
                }
            }
#endif
        }

        //----版本信息------
        extras.Add("res1_version", res1_version);
        extras.Add("res2_version", res2_version);
        mRes1Version = res1_version;
        mRes2Version = res2_version;

        //----场景等附加信息------
        var active_scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene();
        if (active_scene != null)
        {
            extras.Add("sceneName", active_scene.name);
        }
        else
        {
            extras.Add("sceneName", "unknown");
        }

        foreach (var k in extras.Keys)
        {
            var info = extras[k];
            BuglyAgent.PrintLog(LogSeverity.LogInfo, string.Format("{0}:{1}", k, info));
        }
    }