-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
59 lines (54 loc) · 1.88 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
using System.Diagnostics;
namespace coIT.Clockodo.TimeEntriesValidator
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
var updatesWurdenGefundenUndWerdenDurchgeführt = UpdaterAktualisiertAnwendung();
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
if (!updatesWurdenGefundenUndWerdenDurchgeführt)
{
ApplicationConfiguration.Initialize();
Application.Run(new TimeEntriesValidator());
}
}
public static bool UpdaterAktualisiertAnwendung()
{
var updaterPfad = ErwarteterPfadFürUpdater();
if (File.Exists(updaterPfad))
{
Process process = Process.Start(updaterPfad);
process.WaitForExit();
var code = process.ExitCode;
process.Close();
// Updater exit code 0 bedeutet, dass Updates gefunden wurden
// https://www.advancedinstaller.com/user-guide/updater.html#section370
var updateGefundenExitCode = 0;
return code == updateGefundenExitCode;
}
return false;
}
public static string ErwarteterPfadFürUpdater()
{
#if DEBUG
var appdataOrdner = Environment.GetFolderPath(
Environment.SpecialFolder.ApplicationData
);
return Path.Combine(
appdataOrdner,
"co-IT.eu GmbH",
"Time Entries Validator",
"updater.exe"
);
#else
return Path.Combine(Application.StartupPath, "..", "updater.exe");
#endif
}
}
}