-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
43 lines (41 loc) · 1.77 KB
/
Program.cs
File metadata and controls
43 lines (41 loc) · 1.77 KB
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
using System;
using System.Diagnostics;
using System.Linq;
using System.Windows.Forms;
namespace GameOCRTTS
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args.Length > 0 && args.Count(x => x.ToLower() == "-forceupdate") > 0)
{
var liveUpdater = new LiveUpdate(MainForm.GithubUsername);
DialogResult dialogresult = MessageBox.Show("WARNING: The -forceupdate parameter should ONLY BE USED IF THERE IS AN ISSUE WITH THE LIVE UPDATER. It's for debugging purposes ONLY. Proceed with caution.", "-forceupdate parameter - WARNING", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
if (dialogresult == DialogResult.OK)
{
if (liveUpdater.NewerVersionAvailable())
{
DialogResult dr = MessageBox.Show($"A newer version is available online. Download now?\n\n" +
$"Current version: {liveUpdater.CurrentVersion}\n" +
$"Latest version: {liveUpdater.LatestVersion}",
"Live update", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dr == DialogResult.Yes)
{
liveUpdater.DownloadInstaller();
Process.Start($"{liveUpdater.InstallerFileName}");
}
}
}
return;
}
Application.Run(new MainForm());
}
}
}