forked from DioExtreme/Tunetoon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
45 lines (38 loc) · 1.46 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Windows.Forms;
using Tunetoon.Forms;
namespace Tunetoon
{
internal static class Program
{
public static HttpClient HttpClient = new HttpClient();
[STAThread]
private static void Main()
{
ServicePointManager.DefaultConnectionLimit = 2 * Environment.ProcessorCount;
const string Github = "https://github.com/DioExtreme/Tunetoon";
HttpClient.DefaultRequestHeaders.Add("User-Agent", $"Tunetoon - A multi-toon launcher. ({Github})");
AppDomain.CurrentDomain.UnhandledException += App_UnhandledException;
Directory.SetCurrentDirectory(Application.StartupPath);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Launcher());
}
private static void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var ex = (Exception)e.ExceptionObject;
string strPath = "Crash" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt";
using (StreamWriter sw = File.AppendText(strPath))
{
sw.WriteLine("Crash occurred at: " + DateTime.Now);
sw.WriteLine();
sw.WriteLine(ex.Message);
sw.WriteLine(ex.StackTrace);
}
Application.Exit();
}
}
}