Example #1
0
        //
        // Version Number Helper Methods
        //

        public static string GetFileVersion(string path, bool ShortVersion = false)
        {
            try
            {
                var    versionInfo = FileVersionInfo.GetVersionInfo(path);
                string remainder   = "";
                // returns only up to the first space when ShortVersion is true - what's after that is text and not version #
                return(ShortVersion ? SmartString.ChopWord(versionInfo.FileVersion, ref remainder, " ", false, true) : versionInfo.FileVersion);
            }
            catch (Exception)
            {
                return("Not found");
            }
        }
Example #2
0
        //
        // Takes a service account name and determines whether it is a local account or a domain account
        // If it's a local account, returns the NETBIOS name of the computer - the account that's seen on the network
        //

        public static string TranslateServiceAccount(string Account, string NETBIOSName)
        {
            string acc       = Account.ToUpper();
            string remainder = "";

            if (acc.StartsWith(@"NT AUTHORITY\") ||
                acc.StartsWith(@"NT SERVICE\") ||
                acc == @"LOCALSYSTEM" ||
                (acc.Contains(@"\") == false && acc.Contains("@") == false) ||  // old name format has domain\account and UPN format has [email protected]
                SmartString.ChopWord(acc, ref remainder, @"\") == NETBIOSName.ToUpper())
            {
                Account = NETBIOSName;
            }
            return(Account);
        }