-
Notifications
You must be signed in to change notification settings - Fork 9
/
Setting up your ASUS ROG Ally.cs
63 lines (54 loc) · 1.82 KB
/
Setting up your ASUS ROG Ally.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
Setup script coming soon!
// Setting up your ASUS ROG Ally
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Configuration;
using System.Diagnostics;
using System;
using System.IO;
using System.Reflection;
using System.Security.Principal;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using Wpf.Ui.Mvvm.Contracts;
using Wpf.Ui.Mvvm.Services;
using System.Net.NetworkInformation;
using System.Management;
using System.Security.Cryptography;
using Microsoft.Toolkit.Uwp.Notifications;
using System.ServiceProcess;
using System.Threading.Tasks;
namespace Windows Setup
{
public static bool IsAdministrator()
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
public static string mbo = "";
/// This occurs when the application is loading.
private async void OnStartup(object sender, StartupEventArgs e)
{
if (!App.IsAdministrator())
{
// Restart and run as admin
var exeName = Process.GetCurrentProcess().MainModule.FileName;
ProcessStartInfo startInfo = new ProcessStartInfo(exeName);
startInfo.Verb = "runas";
startInfo.UseShellExecute = true;
startInfo.Arguments = "restart";
Process.Start(startInfo);
Environment.Exit(0);
}
class Program
{
static void Main(string[] args)
{
//Program starts here...
Console.WriteLine("Hello, Welcome to Windows 11!");
}
}
}