public static string GetOptions(string prefix)
        {
            if (ReturnDefaults)
            {
                return(null);
            }

            return(RegistryUtil.GetConfigValue <string>(prefix, null, null));
        }
Example #2
0
 public void Initialize()
 {
     try
     {
         _minLevel = (LogLevel)RegistryUtil.GetConfigValue <int>(null, Constants.PLUGIN_REGISTRY_LOGLEVEL, (int)_minLevel);
         OnLogLevelChanged();
     }
     catch (Exception) { }
     DoLog(_minLevel, this, "Level initialized", null);
 }
        private static Dictionary <string, Token> GetEffectiveTokens(string prefix)
        {
            Dictionary <string, Token> tokens = new Dictionary <string, Token>();

            foreach (bool localMachine in new bool[] { true, false })
            {
                string value = RegistryUtil.GetConfigValue <string>(localMachine, prefix, null);

                if (!string.IsNullOrEmpty(value))
                {
                    foreach (string token in value.Split(','))
                    {
                        if (!string.IsNullOrEmpty(token))
                        {
                            string[] keyVal = token.Split(new[] { '=' }, 2);
                            if (!string.IsNullOrEmpty(keyVal[0]))
                            {
                                string key = keyVal[0].ToLower();
                                if (key.StartsWith("-") || key.StartsWith("+"))
                                {
                                    key = key.Substring(1);
                                }

                                Token existing;
                                if (tokens.TryGetValue(key, out existing))
                                {
                                    existing.Value = token;
                                }
                                else
                                {
                                    existing = new Token()
                                    {
                                        Key = key, Value = token
                                    };
                                    existing.Order = tokens.Count;
                                    tokens.Add(key, existing);
                                }
                                if (localMachine)
                                {
                                    existing.HasLocalMachine   = true;
                                    existing.LocalMachineToken = token;
                                }
                                else
                                {
                                    existing.HasCurrentUser = true;
                                }
                            }
                        }
                    }
                }
            }

            return(tokens);
        }