﻿using System;
using System.Windows.Forms;

namespace AutoBack
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
        }

        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception ex = (Exception)e.ExceptionObject;
            MessageBox.Show($@"
An Unhandled Exception is occured in AutoBack.exe.
Please send the following information to tecdevs at www.tecdevs.cf.
Exception: {ex.ToString()}
Data: { ex.Data.ToString()}
HResult: {ex.HResult}
Source: {ex.Source}
StackTrace: {ex.StackTrace}
TargetSite: {ex.TargetSite}
Message: {ex.Message}
InnerException: {ex.InnerException.ToString()}", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
}
