当前位置: 首页>>代码示例>>C#>>正文


C# IConfig.GetKeys方法代码示例

本文整理汇总了C#中IConfig.GetKeys方法的典型用法代码示例。如果您正苦于以下问题:C# IConfig.GetKeys方法的具体用法?C# IConfig.GetKeys怎么用?C# IConfig.GetKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IConfig的用法示例。


在下文中一共展示了IConfig.GetKeys方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

        public List<ClientSetting> Get( )
        {
            List<ClientSetting> clientSetting = new List<ClientSetting>();
            for (int i = 0; i < source.Configs.Count; i++)
            {
                config = source.Configs[i];
                string[] keys = config.GetKeys();
                string[] values = config.GetValues();
                for (int j = 0; j < keys.Length; j++)
                {
                    string node = config.Name;
                    ClientSetting cs = new ClientSetting() { SettingGroup = node, Key = keys[j], Value = values[j] };
                    clientSetting.Add(cs);
                }
            }
            return clientSetting;

            //foreach (string node in nodes)
            //{

            //    config = source.Configs[node];
            //    string[] keys = config.GetKeys();
            //    string[] values = config.GetValues();
            //    for (int i = 0; i < keys.Length; i++)
            //    {
            //        ClientSetting cs = new ClientSetting() { SettingGroup = node, Key = keys[i], Value = values[i] };
            //        clientSetting.Add(cs);
            //    }
            //}
        }
开发者ID:shentianyi,项目名称:MoldSmartDevice,代码行数:30,代码来源:ConfigUtil.cs

示例2: Add

        public void Add(IConfig config) {
            if(configList.Contains(config))
                throw new ArgumentException("IConfig already exists");

            var existingConfig = this[config.Name];

            if(existingConfig != null) {
                // Set all new keys
                var keys = config.GetKeys();
                for(var i = 0; i < keys.Length; i++) {
                    existingConfig.Set(keys[i], config.Get(keys[i]));
                }
            }
            else {
                configList.Add(config);
                OnConfigAdded(new ConfigEventArgs(config));
            }
        }
开发者ID:debop,项目名称:NFramework,代码行数:18,代码来源:ConfigCollection.cs

示例3: RemoveConfigKeys

        /// <summary>
        /// Removes all XML keys that were removed as config keys.
        /// </summary>
        private void RemoveConfigKeys(IConfig config)
        {
            XmlNode section = GetChildElement (config.Name);

            // Remove old keys
            string[] configKeys = config.GetKeys ();
            foreach (string configKey in configKeys)
            {
                if (GetKey (section, configKey) == null) {
                    // Key doesn't exist, remove
                    config.Remove (configKey);
                }
            }

            // Add or set all new keys
            foreach (XmlNode node in section.ChildNodes)
            {
                if (node.NodeType == XmlNodeType.Element
                    && node.Name == "add") {
                    config.Set (node.Attributes["key"].Value,
                                node.Attributes["value"].Value);
                }
            }
        }
开发者ID:rwhitworth,项目名称:nini,代码行数:27,代码来源:DotNetConfigSource.cs

示例4: AddDataServicesVars

        private void AddDataServicesVars(IConfig config)
        {
            // Make sure the services given this way aren't in m_dataServices already
            List<string> servs = new List<string>(m_dataServices.Split(new char[] { ';' }));

            StringBuilder sb = new StringBuilder();
            string[] keys = config.GetKeys();

            if (keys.Length > 0)
            {
                IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("DATA_SRV_"));
                foreach (string serviceKey in serviceKeys)
                {
                    string keyValue = config.GetString(serviceKey, string.Empty).Trim();
                    if (!servs.Contains(keyValue))
                        sb.Append(keyValue).Append(";");
                }
            }

            m_dataServices = (m_dataServices == "noservices") ? sb.ToString() : sb.Append(m_dataServices).ToString();
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:21,代码来源:DataSnapshotManager.cs

示例5: Initialize

        public void Initialize(ScriptEngine engine, IConfig config)
        {
            m_config = config;
            m_scriptEngine = engine;
            EnabledAPIs = new List<string>(config.GetString("AllowedAPIs", "LSL").ToLower().Split(','));

            allowHTMLLinking = config.GetBoolean("AllowHTMLLinking", true);

            #region Limitation configs

            m_allowFunctionLimiting = config.GetBoolean("AllowFunctionLimiting", false);

            foreach (string kvp in config.GetKeys())
            {
                if (kvp.EndsWith("_Limit"))
                {
                    string functionName = kvp.Remove(kvp.Length - 6);
                    LimitDef limitDef = new LimitDef();
                    string limitType = config.GetString(functionName + "_LimitType", "None");
                    string limitAlert = config.GetString(functionName + "_LimitAlert", "None");
                    string limitAction = config.GetString(functionName + "_LimitAction", "None");
                    int limitTimeScale = config.GetInt(functionName + "_LimitTimeScale", 0);
                    int limitMaxNumberOfTimes = config.GetInt(functionName + "_LimitMaxNumberOfTimes", 0);
                    int limitFunctionsOverTimeScale = config.GetInt(functionName + "_LimitFunctionsOverTimeScale", 0);

                    try
                    {
                        limitDef.Type = (LimitType) Enum.Parse(typeof (LimitType), limitType, true);
                    }
                    catch
                    {
                    }
                    try
                    {
                        limitDef.Alert = (LimitAlert) Enum.Parse(typeof (LimitAlert), limitAlert, true);
                    }
                    catch
                    {
                    }
                    try
                    {
                        limitDef.Action = (LimitAction) Enum.Parse(typeof (LimitAction), limitAction, true);
                    }
                    catch
                    {
                    }

                    limitDef.TimeScale = limitTimeScale;
                    limitDef.MaxNumberOfTimes = limitMaxNumberOfTimes;
                    limitDef.FunctionsOverTimeScale = limitFunctionsOverTimeScale;
                    m_functionsToLimit[functionName] = limitDef;
                }
            }

            #endregion

            m_threatLevelNone = new ThreatLevelDefinition(ThreatLevel.None,
                                                          UserSetHelpers.ParseUserSetConfigSetting(config, "NoneUserSet",
                                                                                                   UserSet.None), this);
            m_threatLevelNuisance = new ThreatLevelDefinition(ThreatLevel.Nuisance,
                                                              UserSetHelpers.ParseUserSetConfigSetting(config,
                                                                                                       "NuisanceUserSet",
                                                                                                       UserSet.None),
                                                              this);
            m_threatLevelVeryLow = new ThreatLevelDefinition(ThreatLevel.VeryLow,
                                                             UserSetHelpers.ParseUserSetConfigSetting(config,
                                                                                                      "VeryLowUserSet",
                                                                                                      UserSet.None),
                                                             this);
            m_threatLevelLow = new ThreatLevelDefinition(ThreatLevel.Low,
                                                         UserSetHelpers.ParseUserSetConfigSetting(config, "LowUserSet",
                                                                                                  UserSet.None), this);
            m_threatLevelModerate = new ThreatLevelDefinition(ThreatLevel.Moderate,
                                                              UserSetHelpers.ParseUserSetConfigSetting(config,
                                                                                                       "ModerateUserSet",
                                                                                                       UserSet.None),
                                                              this);
            m_threatLevelHigh = new ThreatLevelDefinition(ThreatLevel.High,
                                                          UserSetHelpers.ParseUserSetConfigSetting(config, "HighUserSet",
                                                                                                   UserSet.None), this);
            m_threatLevelVeryHigh = new ThreatLevelDefinition(ThreatLevel.VeryHigh,
                                                              UserSetHelpers.ParseUserSetConfigSetting(config,
                                                                                                       "VeryHighUserSet",
                                                                                                       UserSet.None),
                                                              this);
            m_threatLevelSevere = new ThreatLevelDefinition(ThreatLevel.Severe,
                                                            UserSetHelpers.ParseUserSetConfigSetting(config,
                                                                                                     "SevereUserSet",
                                                                                                     UserSet.None), this);
            m_threatLevelNoAccess = new ThreatLevelDefinition(ThreatLevel.NoAccess,
                                                              UserSetHelpers.ParseUserSetConfigSetting(config,
                                                                                                       "NoAccessUserSet",
                                                                                                       UserSet.None),
                                                              this);
        }
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:95,代码来源:ScriptProtectionModule.cs

示例6: LoadDomainExceptionsFromConfig

        protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, Dictionary<int, List<string>> exceptions)
        {
            foreach (string keyName in config.GetKeys())
            {
                if (keyName.StartsWith(variable + "_Level_"))
                {
                    int level = 0;
                    if (Int32.TryParse(keyName.Replace(variable + "_Level_", ""), out level) && !exceptions.ContainsKey(level))
                    {
                        exceptions.Add(level, new List<string>());
                        string value = config.GetString(keyName, string.Empty);
                        string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                        foreach (string s in parts)
                            exceptions[level].Add(s.Trim());
                    }
                }
            }
        }
开发者ID:p07r0457,项目名称:opensim,代码行数:19,代码来源:UserAgentService.cs

示例7: LoadTripPermissionsFromConfig

 protected void LoadTripPermissionsFromConfig(IConfig config, string variable)
 {
     foreach (string keyName in config.GetKeys())
     {
         if (keyName.StartsWith(variable + "_Level_"))
         {
             int level = 0;
             if (Int32.TryParse(keyName.Replace(variable + "_Level_", ""), out level))
                 m_ForeignTripsAllowed.Add(level, config.GetBoolean(keyName, true));
         }
     }
 }
开发者ID:p07r0457,项目名称:opensim,代码行数:12,代码来源:UserAgentService.cs

示例8: Add

        /// <include file='ConfigCollection.xml' path='//Method[@name="Add"]/docs/*' />
        public void Add(IConfig config)
        {
            if (configList.Contains (config)) {
                throw new ArgumentException ("IConfig already exists");
            }
            IConfig existingConfig = this[config.Name];

            if (existingConfig != null) {
                // Set all new keys
                string[] keys = config.GetKeys ();
                for (int i = 0; i < keys.Length; i++)
                {
                    existingConfig.Set (keys[i], config.Get (keys[i]));
                }
            } else {
                configList.Add (config);
            }
        }
开发者ID:BackupTheBerlios,项目名称:player-sdk-svn,代码行数:19,代码来源:ConfigCollection.cs

示例9: RemoveConfigKeys

		/// <summary>
		/// Removes all INI keys that were removed as config keys.
		/// </summary>
		private void RemoveConfigKeys (IConfig config)
		{
			IniSection section = iniDocument.Sections[config.Name];

			// Remove old keys
			string[] configKeys = config.GetKeys ();
			foreach (string configKey in configKeys)
			{
				if (!section.Contains (configKey)) {
					// Key doesn't exist, remove
					config.Remove (configKey);
				}
			}

			// Add or set all new keys
			string[] keys = section.GetKeys ();
			for (int i = 0; i < keys.Length; i++)
			{
				string key = keys[i];
				config.Set (key, section.GetItem (i).Value);
			}
		}
开发者ID:NickyPerian,项目名称:Aurora,代码行数:25,代码来源:IniConfigSource.cs

示例10: RemoveConfigKeys

        /// <summary>
        /// Removes all XML keys that were removed as config keys.
        /// </summary>
        private void RemoveConfigKeys(IConfig config)
        {
            XmlNode section = GetSectionByName (config.Name);

            // Remove old keys
            string[] configKeys = config.GetKeys ();
            foreach (string configKey in configKeys)
            {
                if (GetKeyByName (section, configKey) == null) {
                    // Key doesn't exist, remove
                    config.Remove (configKey);
                }
            }

            // Add or set all new keys
            foreach (XmlNode node in section.ChildNodes)
            {
                // Loop through all key nodes and add to config
                if (node.NodeType == XmlNodeType.Element
                    && node.Name == "Key") {
                    config.Set (node.Attributes["Name"].Value,
                                node.Attributes["Value"].Value);
                }
            }
        }
开发者ID:e-lefort,项目名称:CSharpIniFileSerializer,代码行数:28,代码来源:XmlConfigSource.cs


注:本文中的IConfig.GetKeys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。