-
Notifications
You must be signed in to change notification settings - Fork 22
/
Util.cs
26 lines (23 loc) · 828 Bytes
/
Util.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
using System;
using System.Security.Principal;
namespace FFXIVOpcodeWizard
{
public static class Util
{
public static string NumberToString(int input, NumberDisplayFormat format)
{
var formatString = format switch
{
NumberDisplayFormat.Decimal => "",
NumberDisplayFormat.HexadecimalUppercase => "X4",
NumberDisplayFormat.HexadecimalLowercase => "x4",
_ => throw new NotImplementedException(),
};
return !string.IsNullOrEmpty(formatString) ? $"0x{input.ToString(formatString)}" : input.ToString();
}
public static bool Elevated()
{
return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
}
}
}