46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using FinalSolution.Properties;
|
|
|
|
namespace FinalSolution
|
|
{
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
if (Settings.Default.AllocConsole) // should open a console box
|
|
{
|
|
NativeUtils.AllocConsole();
|
|
Console.WriteLine(@"Hello from the Children of Planet Earth!");
|
|
}
|
|
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
Application.ThreadException += (sender, args) =>
|
|
{
|
|
var ex = args.Exception;
|
|
|
|
var dt = DateTime.Now;
|
|
var fileName = $"crash-report_{dt.Day}_{dt.Month}_{dt.Year}-{dt.Hour}_{dt.Minute}_{dt.Second}.txt";
|
|
|
|
using (var writer = new StreamWriter(fileName, true))
|
|
{
|
|
writer.WriteLine("##############" + dt + "##############");
|
|
writer.WriteLine("An exception occurred while running Final Solution");
|
|
writer.WriteLine(ex);
|
|
}
|
|
|
|
MessageBox.Show(string.Format(Resources.Program_Main_Crash_Dialog, fileName));
|
|
};
|
|
Application.Run(new MainForm());
|
|
}
|
|
}
|
|
} |