-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
37 lines (31 loc) · 1.06 KB
/
App.xaml.cs
File metadata and controls
37 lines (31 loc) · 1.06 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
// Copyright (c) 2026 talkdedsec & threatvec. All Rights Reserved.
// TweakForge -- Ultimate Windows Tweaker | github.com/threatvec/tweakforge
using System.Windows;
namespace TweakForge;
public partial class App : Application
{
public const string AppName = "TweakForge";
public const string AppVersion = "1.0.0";
public const string Credits = "Made by talkdedsec & threatvec";
public const string Author1 = "talkdedsec";
public const string Author2 = "threatvec";
public static bool IsAdmin { get; private set; }
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
IsAdmin = CheckAdmin();
}
private static bool CheckAdmin()
{
try
{
var identity = System.Security.Principal.WindowsIdentity.GetCurrent();
var principal = new System.Security.Principal.WindowsPrincipal(identity);
return principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator);
}
catch
{
return false;
}
}
}