Пример #1
0
        private static void a(Exception A_0, string A_1, bool A_2)
        {
            if (A_0 == null)
            {
                return;
            }
            string name = A_0.GetType().Name;
            string text = A_0.Message;

            if (!string.IsNullOrEmpty(A_1))
            {
                text = string.Format("{0}{1}---{2}", text, Environment.NewLine, A_1);
            }
            StringBuilder stringBuilder = new StringBuilder("");
            StackTrace    stackTrace    = new StackTrace(A_0, true);
            int           frameCount    = stackTrace.FrameCount;

            for (int i = 0; i < frameCount; i++)
            {
                StackFrame frame = stackTrace.GetFrame(i);
                stringBuilder.AppendFormat("{0}.{1}", frame.GetMethod().DeclaringType.Name, frame.GetMethod().Name);
                ParameterInfo[] parameters = frame.GetMethod().GetParameters();
                if (parameters == null || parameters.Length == 0)
                {
                    stringBuilder.Append(" () ");
                }
                else
                {
                    stringBuilder.Append(" (");
                    int num = parameters.Length;
                    for (int j = 0; j < num; j++)
                    {
                        ParameterInfo parameterInfo = parameters[j];
                        stringBuilder.AppendFormat("{0} {1}", parameterInfo.ParameterType.Name, parameterInfo.Name);
                        if (j != num - 1)
                        {
                            stringBuilder.Append(", ");
                        }
                    }
                    stringBuilder.Append(") ");
                }
                string text2 = frame.GetFileName();
                if (!string.IsNullOrEmpty(text2) && !text2.ToLower().Equals("unknown"))
                {
                    text2 = text2.Replace("\\", "/");
                    int num2 = text2.ToLower().IndexOf("/assets/");
                    if (num2 < 0)
                    {
                        num2 = text2.ToLower().IndexOf("assets/");
                    }
                    if (num2 > 0)
                    {
                        text2 = text2.Substring(num2);
                    }
                    stringBuilder.AppendFormat("(at {0}:{1})", text2, frame.GetFileLineNumber());
                }
                stringBuilder.AppendLine();
            }
            CrashMonitor.g("UnhandleCaught  " + name, text, stringBuilder.ToString(), true);
        }
Пример #2
0
        private static void a(LogType A_0, string A_1, string A_2)
        {
            string text  = null;
            string text2 = null;

            if (A_0 != LogType.Exception)
            {
                return;
            }
            if (!string.IsNullOrEmpty(A_1))
            {
                try
                {
                    if (LogType.Exception == A_0 && A_1.Contains("Exception"))
                    {
                        Match match = new Regex("^(?<errorType>\\S+):\\s*(?<errorMessage>.*)").Match(A_1);
                        if (match.Success)
                        {
                            text  = match.Groups["errorType"].Value;
                            text2 = match.Groups["errorMessage"].Value.Trim();
                        }
                    }
                }
                catch
                {
                }
                if (string.IsNullOrEmpty(text2))
                {
                    text2 = A_1;
                }
            }
            if (string.IsNullOrEmpty(text))
            {
                text = string.Format("Unity{0}", A_0.ToString());
            }
            bool caught = true;

            CrashMonitor.g(text, text2, A_2, caught);
        }