BlackHole.Slave.Helper.WindowsHelper.WindowsHelper C# (CSharp) Method

WindowsHelper() static private method

static private WindowsHelper ( ) : System
return System
        static WindowsHelper()
        {
            using (var identity = WindowsIdentity.GetCurrent())
            {
                if (identity != null)
                {
                    AccountType = "Unknow";
                    var principal = new WindowsPrincipal(identity);
                    if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                        AccountType = "Admin";
                    else if (principal.IsInRole(WindowsBuiltInRole.User))
                        AccountType = "User";
                    else if (principal.IsInRole(WindowsBuiltInRole.Guest))
                        AccountType = "Guest";
                }
            }
            UserName = Environment.UserName + $" ({AccountType})";
            MachineName = Environment.MachineName;
        }
WindowsHelper