Esempio n. 1
0
        /// <summary>
        /// Obtiene el texto en el formato establecido en Debug.ErrorsExportFormat (XML, JSON, HTML o Texto Plano)
        /// </summary>
        /// <param name="dErr">Error actual</param>
        /// <returns>Texto en el formato actual</returns>
        public static string GetDefaultExportText(DebugErrorData dErr)
        {
            string exportText = "";

            switch (Debug.ErrorsExportFormat)
            {
            case ErrorToFile.Xml:
                exportText = dErr.XMLData;
                break;

            case ErrorToFile.Json:
                exportText = dErr.JSONData;
                break;

            case ErrorToFile.Html:
                exportText = dErr.HTMLData;
                break;

            default:
                exportText = dErr.ToString() + Environment.NewLine + dErr.SystemInformation.ToString();
                break;
            }

            return(exportText);
        }
Esempio n. 2
0
        private static void onException(object sender, Exception ex)
        {
            Debug.WriteDebugger("Debug -> onException -> Start");
            DebugErrorData dErr = new DebugErrorData(ex);


            Debug.WriteDebugger("Debug -> onException - Generate export text");
            string exportText = Debug.GetDefaultExportText(dErr);

            if (onDebuggerError != null)
            {
                DebuggerErrorEvenArgs args = new DebuggerErrorEvenArgs(dErr);
                onDebuggerError(sender, args);
                if (args.Cancel)
                {
                    return;
                }
            }


            if (ErrorsExportFormat != ErrorToFile.None && Debug.DirectoryLogs != null && Debug.DirectoryLogs.Exists)
            {
                Debug.WriteDebugger("Debug -> onException - Save file exception.");
                Debug.SaveFileException(dErr);
            }

            Debug.WriteDebugger("Debug -> onException - Open form");
            Debug.FormException.ShowDialog(dErr);
            Debug.WriteLine(ex);
        }
Esempio n. 3
0
        /// <summary>
        /// Muestra el formulario con los datos de la excepción especifiada
        /// </summary>
        /// <param name="dEx">Datos de la excepción</param>
        /// <returns></returns>
        public DialogResult Show(DebugErrorData dEx)
        {
            this.Error = dEx;

            Initialize();
            this.Show();
            return(this.DialogResult);
        }
Esempio n. 4
0
        /// <summary>
        /// Envia un email con los datos de la excepción
        /// </summary>
        /// <param name="dErr">Excepcion que se desea enviar</param>
        /// <returns></returns>
        public static bool SaveFileException(DebugErrorData dErr)
        {
            string exportText = Debug.GetDefaultExportText(dErr);

            string file = Debug.DirectoryLogs + "\\" + DateTime.Now.Ticks + ".err";

            File.WriteAllText(file, exportText);

            return(true);
        }
Esempio n. 5
0
 public DebuggerErrorEvenArgs(DebugErrorData dEx) : base(dEx.Exception)
 {
     this.DebugException = dEx;
 }