예제 #1
0
        //save crash info when app crash
        public void crashDataProceed(UnhandledExceptionEventArgs ex, string flag = "ums crash")
        {
            Exception e                       = ex.Exception;
            string    err_title               = "" + ex.Message + e.Message;
            string    err_stack_trace         = e.StackTrace == null ? "" : e.StackTrace;
            string    error_title_statcktrace = err_title + "\r\n" + err_stack_trace;

            while (e.InnerException != null)
            {
                e = e.InnerException;
                error_title_statcktrace += "\r\n" + e.StackTrace;
            }

            ErrorInfo error = new ErrorInfo();

            error.appkey = appkey;
            //error.stacktrace = ex.Message+"\r\n"+ex.StackTrace;
            error.stacktrace = error_title_statcktrace;
            error.time       = Utility.getTime();
            error.version    = Utility.getApplicationVersion() == null ? "" : Utility.getApplicationVersion();
            error.activity   = Utility.getCurrentPageName();
            error.deviceid   = Utility.getDeviceId();
            error.os_version = Utility.getOsVersion();
            string error_info = UmsJson.Serialize(error);

            CrashListener.ReportException(error_info, flag);
        }
예제 #2
0
        //all data
        private string allData2jsonstr()
        {
            AllInfo allinfo = new AllInfo();

            allinfo.appkey = UmsManager.appkey;
            string ret = "";
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings.Contains("clientdata"))
            {
                List <ClientData> list_client_data = (List <ClientData>)settings["clientdata"];
                allinfo.clientData = list_client_data;
            }

            if (settings.Contains("tagdata"))
            {
                List <Tag> list_tag_data = (List <Tag>)settings["tagdata"];
                allinfo.tagListInfo = list_tag_data;
            }


            if (settings.Contains("eventdata"))
            {
                List <Event> list_event_data = (List <Event>)settings["eventdata"];
                allinfo.eventInfo = list_event_data;
            }


            try
            {
                string    err_str = CrashListener.CheckForPreviousException();
                ErrorInfo error   = UmsJson.Deserialize <ErrorInfo>(err_str);
                if (error != null)
                {
                    List <ErrorInfo> err_list = new List <ErrorInfo>();
                    err_list.Add(error);
                    allinfo.errorInfo = err_list;
                }
            }
            catch (Exception e)
            {
                DebugTool.Log(e.Message);
            }


            if (settings.Contains("pageinfo"))
            {
                List <PageInfo> list_pageinfo_data = (List <PageInfo>)settings["pageinfo"];

                allinfo.activityInfo = list_pageinfo_data;
            }
            ret = UmsJson.Serialize(allinfo);
            return(ret);
        }
예제 #3
0
        //check is exist crash log
        public static bool isExistCrashLog()
        {
            try
            {
                string    err_str = CrashListener.CheckForPreviousException();
                ErrorInfo o       = UmsJson.Deserialize <ErrorInfo>(err_str);


                if (o != null)
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                DebugTool.Log(e.Message);
                return(false);
            }
            return(false);
        }
예제 #4
0
파일: Obj2Json.cs 프로젝트: milkmeat/razor
        //all data
        private async Task <string> allData2jsonstr()
        {
            AllInfo allinfo = new AllInfo();

            allinfo.appkey = UmsManager.appkey;
            string ret = "";

            Windows.Storage.ApplicationDataContainer settings = Windows.Storage.ApplicationData.Current.LocalSettings;

            allinfo.clientData = await ApplicationSettings.GetSettingFromXmlFileAsync <List <ClientData> >(SettingKeys.CLIENT_DATA, null);

            allinfo.eventInfo = await ApplicationSettings.GetSettingFromXmlFileAsync <List <Event> >(SettingKeys.EVENT_DATA, null);

            allinfo.activityInfo = await ApplicationSettings.GetSettingFromXmlFileAsync <List <PageInfo> >(SettingKeys.PAGE_INFO, null);

            //patch: we nolonger use in storage settings anymore, just remove it for old versions
            ApplicationSettings.RemoveSetting(SettingKeys.CLIENT_DATA);
            ApplicationSettings.RemoveSetting(SettingKeys.EVENT_DATA);
            ApplicationSettings.RemoveSetting(SettingKeys.PAGE_INFO);

            try
            {
                string    err_str = CrashListener.CheckForPreviousException();
                ErrorInfo error   = UmsJson.Deserialize <ErrorInfo>(err_str);
                if (error != null)
                {
                    List <ErrorInfo> err_list = new List <ErrorInfo>();
                    err_list.Add(error);
                    allinfo.errorInfo = err_list;
                }
            }
            catch (Exception e)
            {
                DebugTool.Log(e.Message);
            }

            ret = UmsJson.Serialize(allinfo);
            return(ret);
        }