File tree 2 files changed +1
-37
lines changed
2 files changed +1
-37
lines changed Original file line number Diff line number Diff line change 2
2
// See the LICENCE file in the repository root for full licence text.
3
3
4
4
using System ;
5
- using System . Security . Principal ;
6
5
using osu . Framework ;
7
6
using osu . Framework . Allocation ;
8
7
using osu . Framework . Graphics ;
@@ -21,48 +20,14 @@ public partial class ElevatedPrivilegesChecker : Component
21
20
[ Resolved ]
22
21
private INotificationOverlay notifications { get ; set ; } = null ! ;
23
22
24
- private bool elevated ;
25
-
26
- [ BackgroundDependencyLoader ]
27
- private void load ( )
28
- {
29
- elevated = checkElevated ( ) ;
30
- }
31
-
32
23
protected override void LoadComplete ( )
33
24
{
34
25
base . LoadComplete ( ) ;
35
26
36
- if ( elevated )
27
+ if ( Environment . IsPrivilegedProcess )
37
28
notifications . Post ( new ElevatedPrivilegesNotification ( ) ) ;
38
29
}
39
30
40
- private bool checkElevated ( )
41
- {
42
- try
43
- {
44
- switch ( RuntimeInfo . OS )
45
- {
46
- case RuntimeInfo . Platform . Windows :
47
- if ( ! OperatingSystem . IsWindows ( ) ) return false ;
48
-
49
- var windowsIdentity = WindowsIdentity . GetCurrent ( ) ;
50
- var windowsPrincipal = new WindowsPrincipal ( windowsIdentity ) ;
51
-
52
- return windowsPrincipal . IsInRole ( WindowsBuiltInRole . Administrator ) ;
53
-
54
- case RuntimeInfo . Platform . macOS :
55
- case RuntimeInfo . Platform . Linux :
56
- return Mono . Unix . Native . Syscall . geteuid ( ) == 0 ;
57
- }
58
- }
59
- catch
60
- {
61
- }
62
-
63
- return false ;
64
- }
65
-
66
31
private partial class ElevatedPrivilegesNotification : SimpleNotification
67
32
{
68
33
public override bool IsImportant => true ;
Original file line number Diff line number Diff line change 24
24
</ItemGroup >
25
25
<ItemGroup Label =" Package References" >
26
26
<PackageReference Include =" Clowd.Squirrel" Version =" 2.11.1" />
27
- <PackageReference Include =" Mono.Posix.NETStandard" Version =" 1.0.0" />
28
27
<PackageReference Include =" System.IO.Packaging" Version =" 8.0.0" />
29
28
<PackageReference Include =" DiscordRichPresence" Version =" 1.2.1.24" />
30
29
</ItemGroup >
You can’t perform that action at this time.
0 commit comments