static void Main() { Config.Setup(); //Environment.OSVersion.Platform AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs args) { var exception = (Exception)args.ExceptionObject; string logFile = Path.Combine(Logger.GetPath(), "Crash Log.txt"); using (TextWriter tw = new StreamWriter(logFile, true)) { tw.WriteLine(""); tw.WriteLine("{0} {1}", Application.ProductName, Application.ProductVersion); tw.WriteLine("{0}", DateTime.Now); tw.WriteLine("Unhandled exception: " + exception); } MessageBox.Show(string.Format("Unexpected Error, please send '{0}' to [email protected]", logFile), "Unexpected Error"); Environment.Exit(1); }; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Logger.SetExitFunc(engine.seg043.print_and_exit); main = new MainForm(); ThreadStart threadDelegate = new ThreadStart(EngineThread); engineThread = new Thread(threadDelegate); engineThread.Name = "Engine"; engineThread.Start(); Application.Run(main); }