using System;
using System.Windows.Forms;

namespace DomainJoinTool
{
    internal static class Program
    {
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += (s, e) =>
                System.IO.File.AppendAllText(@"C:\ProgramData\DomainJoinTool\crash.log",
                    DateTime.Now + ": " + e.Exception + Environment.NewLine);
            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
                System.IO.File.AppendAllText(@"C:\ProgramData\DomainJoinTool\crash.log",
                    DateTime.Now + ": " + e.ExceptionObject + Environment.NewLine);
            try
            {
                Application.Run(new MainForm());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Startfehler: " + ex.Message + "\n\n" + ex.StackTrace, "Fehler");
            }
        }
    }
}
