private static string GetDefaultIconPath(
            Win32Registry.Key baseKey,
            string schemeName)
        {
            if (baseKey == null || string.IsNullOrWhiteSpace(schemeName))
            {
                return(null);
            }

            var relativeKeyPath = $"{schemeName}\\DefaultIcon";

            using (var subKey = baseKey.OpenSubKey(
                       relativeKeyPath,
                       Win32Registry.KeyPermissionCheck.ReadSubTree))
            {
                var value = subKey?.GetValue(null);
                if (value == null)
                {
                    return(null);
                }

                if (subKey.GetValueKind(null) == Win32Registry.ValueKind.String)
                {
                    return((string)value);
                }
            }

            return(null);
        }
        private static KeyValuePair <string, string> GetCommandPair(
            Win32Registry.Key baseKey,
            string schemeName,
            string realSchemeName,
            bool whitelistOnly)
        {
            var empty = new KeyValuePair <string, string>();

            if (baseKey == null || string.IsNullOrWhiteSpace(realSchemeName))
            {
                return(empty);
            }

            var relativeKeyPath = $"{realSchemeName}\\Shell\\open\\command";

            using (var subKey = baseKey.OpenSubKey(
                       relativeKeyPath,
                       Win32Registry.KeyPermissionCheck.ReadSubTree))
            {
                if (subKey == null)
                {
                    return(empty);
                }
                var value = subKey.GetValue(null);
                if (value == null)
                {
                    return(empty);
                }
                var data = string.Empty;
                if (subKey.GetValueKind(null) == Win32Registry.ValueKind.String)
                {
                    data = (string)value;
                }
                var result      = GetCommandPair(data);
                var commandPath = result.Key;
                if (!File.Exists(commandPath))
                {
                    return(empty);
                }

                var key = GetProtocolCommandPathKey(
                    schemeName,
                    new FileInfo(commandPath).Name.ToLower(CultureInfo.InvariantCulture)
                    );
                if (whitelistOnly && !ProtocolCommandPathWhitelist.Contains(key))
                {
                    Logger.GetInstance(typeof(DefaultUriSchemeManager)).Warn($"The command \"{commandPath}\" is not in {schemeName} whitelist");
                    return(empty);
                }

                return(result);
            }
        }