This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
58 lines (50 loc) · 1.77 KB
/
Program.cs
File metadata and controls
58 lines (50 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Diagnostics;
using System.Threading;
using xp_apps.sources;
namespace xp_apps
{
public static class Program
{
public static void Main()
{
Logger.SetupLog("xp-apps");
#if DEBUG
Logger.LogManager.Debug(
$"Current architecture: {Helper.OsArchitecture} | Current OS: {Environment.OSVersion}");
var args = Helper.GetCommandArgs()?.Length > 0
? string.Join(" ", Helper.GetCommandArgs())
: "No additional arguments";
Logger.LogManager.Debug($"Used command-line arguments: {args}");
#endif
Console.CancelKeyPress += OnExit;
if (Convert.ToBoolean(Updater.CheckForUpdates()))
{
Console.WriteLine(
"[Update]: A new version of the program is available.\n[Tip]: If you want to update, please run \"xp-apps --self-update\".");
Thread.Sleep(2000);
}
// Funny moment: this program works on Linux too
if (MainScreen.IsWindowsNt5)
{
Console.WriteLine("This program works only on Windows XP.");
Console.WriteLine("Press any key to exit...");
Console.ReadLine();
return;
}
MainScreen.ParseArgs();
}
private static void OnExit(object sender, ConsoleCancelEventArgs e)
{
Console.WriteLine("\nctrl + c key detected, exiting...");
Process.Start(new ProcessStartInfo
{
FileName = "taskkill",
Arguments = "/f /im curl.exe",
CreateNoWindow = true,
UseShellExecute = false
});
Environment.Exit(0);
}
}
}