forked from jvano/VisualARM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
56 lines (48 loc) · 1.7 KB
/
Program.cs
File metadata and controls
56 lines (48 loc) · 1.7 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
using System;
using System.Diagnostics;
using System.Net;
using System.Windows.Forms;
namespace Vano.Tools.Azure
{
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main(string[] args)
{
if (args.Length == 0)
{
ReRunProgram();
return;
}
// For private deployments let's not enforce SSL validation
ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) =>
{
return true;
});
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception ex = e.ExceptionObject as Exception;
if (ex != null)
{
Trace.WriteLine(e.ToString());
}
}
private static void ReRunProgram()
{
Process process = new Process();
process.StartInfo.FileName = Process.GetCurrentProcess().MainModule.FileName;
process.StartInfo.Verb = "runas";
process.StartInfo.Arguments = "/elevated";
process.Start();
}
}
}