-
Notifications
You must be signed in to change notification settings - Fork 0
/
start this before anything.cmd
76 lines (67 loc) · 2.56 KB
/
start this before anything.cmd
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
cd.. Desktop
nano "executable"
using System;
using System.IO;
using System.Net;
using System.Threading;
using System.Windows.Forms;
using CorporateClash.Enums;
using CorporateClash.Forms;
namespace CorporateClash
{
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Application.ThreadException += Application_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Initialize();
}
private static async void Initialize()
{
try
{
Log.Initialize(LogType.Info);
#if (!DEBUG)
Updater.CheckForUpdates();
#endif
string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string filesDir = Path.Combine(appDataPath, "Project Altis");
if (!Directory.Exists(filesDir))
Directory.CreateDirectory(filesDir);
Directory.SetCurrentDirectory(filesDir);
// First run
// This may be used in the future for first-run messages or configuration
Settings.Instance.FirstRun = false;
Log.Info("Loaded altis launcher v" + typeof(Program).Assembly.GetName().Version);
Log.Info("Current time: " + DateTime.Now.ToLongDateString() + "|" + DateTime.Now.TimeOfDay);
Log.Info("Working directory: " + Directory.GetCurrentDirectory());
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmMain());
}
catch (Exception e)
{
Log.Error(e);
Log.TryOpenUrl(Path.Combine(Directory.GetCurrentDirectory(), "Logs"));
Environment.Exit(1);
}
}
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
Log.Error(e.Exception);
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Log.Error(e.ExceptionObject as Exception);
}
}
}
pause