This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
67 lines (63 loc) · 2.45 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com
using System;
using System.Windows.Forms;
using Common_Library.App;
using Common_Library.GUI.WinForms.Forms;
using Derpi_Downloader.Forms;
using Derpi_Downloader.Settings;
namespace Derpi_Downloader
{
public static class Program
{
static Program()
{
App.Version = new AppVersion(Globals.Version);
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main(String[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
try
{
Application.Run(new MainForm(args));
}
catch (Exception exception)
{
try
{
if (MessageForm.GetDialogResultOnException(exception,
Globals.Localization.CriticalExceptionOccurredText,
Globals.Localization.CriticalExceptionOccurred, MessageBoxButtons.RetryCancel,
new[]
{
Globals.Localization.CriticalExceptionOccurredRestartButton,
Globals.Localization.CriticalExceptionOccurredExitButton
}) == DialogResult.Retry)
{
Application.Restart();
}
}
catch (Exception)
{
try
{
MessageForm.GetDialogResultOnException(exception, Globals.Localization.InitializeStageException,
Globals.Localization.InitializeExceptionOccured, MessageBoxButtons.OK, new[] {Globals.Localization.Exit});
}
catch (Exception)
{
MessageForm.GetDialogResultOnException(exception, "Exception on initialize stage",
"Initialize exception occured", MessageBoxButtons.OK, new[] {"Exit"});
}
}
Environment.Exit(exception.HResult);
}
}
}
}