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


C# IConfig.Contains方法代码示例

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


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

示例1: Initialise

        public void Initialise(IConfigSource config)
        {
            m_windConfig = config.Configs["Wind"];
//            string desiredWindPlugin = m_dWindPluginName;

            if (m_windConfig != null)
            {
                m_enabled = m_windConfig.GetBoolean("enabled", true);

                m_frameUpdateRate = m_windConfig.GetInt("wind_update_rate", 150);

                // Determine which wind model plugin is desired
                if (m_windConfig.Contains("wind_plugin"))
                {
                    m_dWindPluginName = m_windConfig.GetString("wind_plugin", m_dWindPluginName);
                }
            }

            if (m_enabled)
            {
                m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);

            }

        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:25,代码来源:WindModule.cs

示例2: Initialise

 public void Initialise(IConfigSource source)
 {
     m_Config = source.Configs["OMP.WebSocket.RegionModule"];
     if (m_Config != null && m_Config.Contains("Enabled"))
         Enabled = m_Config.GetBoolean("Enabled");
     else
         Enabled = false;
 }
开发者ID:rryk,项目名称:omp-addon,代码行数:8,代码来源:RegionModule.cs

示例3: WindConfig

 public void WindConfig(IScene scene, IConfig windConfig)
 {
     if (windConfig != null)
     {
         if (windConfig.Contains("strength"))
         {
             m_strength = windConfig.GetFloat("strength", 1.0F);
         }
     }
 }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:10,代码来源:SimpleRandomWind.cs

示例4: Initialise

        public void Initialise(IConfigSource config)
        {
            windConfig = config.Configs["Wind"];
            desiredWindPlugin = m_dWindPluginName;

            if (windConfig != null)
            {
                m_enabled = windConfig.GetBoolean("enabled", true);

                m_frameUpdateRate = windConfig.GetInt("wind_update_rate", 150);

                // Determine which wind model plugin is desired
                if (windConfig.Contains("wind_plugin"))
                {
                    desiredWindPlugin = windConfig.GetString("wind_plugin");
                }
            }
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:18,代码来源:WindModule.cs

示例5: InitializefromParameters

 // Under the [BulletSim] section, one can change the individual material
 //    attribute values. The format of the configuration parameter is:
 //        <materialName><Attribute>["Physical"] = floatValue
 //    For instance:
 //        [BulletSim]
 //             StoneFriction = 0.2
 //             FleshRestitutionPhysical = 0.8
 // Materials can have different parameters for their static and
 //    physical instantiations. When setting the non-physical value,
 //    both values are changed. Setting the physical value only changes
 //    the physical value.
 public static void InitializefromParameters(IConfig pConfig)
 {
     foreach (KeyValuePair<string, MaterialAttributes.Material> kvp in MaterialMap)
     {
         string matName = kvp.Key;
         foreach (string attribName in MaterialAttributes.MaterialAttribs)
         {
             string paramName = matName + attribName;
             if (pConfig.Contains(paramName))
             {
                 float paramValue = pConfig.GetFloat(paramName);
                 SetAttributeValue((int)kvp.Value, attribName, paramValue);
                 // set the physical value also
                 SetAttributeValue((int)kvp.Value + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue);
             }
             paramName += "Physical";
             if (pConfig.Contains(paramName))
             {
                 float paramValue = pConfig.GetFloat(paramName);
                 SetAttributeValue((int)kvp.Value + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue);
             }
         }
     }
 }
开发者ID:justasabc,项目名称:opensim75grid,代码行数:35,代码来源:BSMaterials.cs

示例6: ParamBoolean

 // A helper function that handles a true/false parameter and returns the proper float number encoding
 float ParamBoolean(IConfig config, string parmName, float deflt)
 {
     float ret = deflt;
     if (config.Contains(parmName))
     {
         ret = ConfigurationParameters.numericFalse;
         if (config.GetBoolean(parmName, false))
         {
             ret = ConfigurationParameters.numericTrue;
         }
     }
     return ret;
 }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:14,代码来源:BSScene.cs

示例7: BindClasses

        private void BindClasses(IKernel k, IConfig config, string configFile, UUID hostID)
        {
            k.Unbind<IPrimFactory>();
            k.Unbind<IConfigSource>();

            k.Bind<IPrimFactory>().To<MRMPrimFactory>().InSingletonScope().WithConstructorArgument("hostID", hostID);
            k.Bind<IConfigSource>().To<DotNetConfigSource>().InSingletonScope().WithConstructorArgument("path", configFile);

            if (!config.Contains(CONTROL + ASSEMBLY))
                throw new Exception("Unable to start up. Control is not properly specified in the configuration file. " +
                    "Config must include the key '" + CONTROL + ASSEMBLY + "' in section 'Bootstrap'.");
            if (!config.Contains(MODEL + ASSEMBLY))
                throw new Exception("Unable to start up. Model is not properly specified in the configuration file. " +
                    "Config must include the key '" + MODEL + ASSEMBLY + "' in section 'Bootstrap'.");
            if (!config.Contains(VIEW + ASSEMBLY))
                throw new Exception("Unable to start up. View is not properly specified in the configuration file. " +
                    "Config must include the key '" + VIEW + ASSEMBLY + "' in section 'Bootstrap'.");

            if (!config.Contains(CONTROL + CLASS))
                throw new Exception("Unable to start up. Control is not properly specified in the configuration file. " +
                    "Config must include the key '" + CONTROL + CLASS + "' in section 'Bootstrap'.");
            if (!config.Contains(MODEL + CLASS))
                throw new Exception("Unable to start up. Model is not properly specified in the configuration file. " +
                    "Config must include the key '" + MODEL + CLASS + "' in section 'Bootstrap'.");
            if (!config.Contains(VIEW + CLASS))
                throw new Exception("Unable to start up. View is not properly specified in the configuration file. " +
                    "Config must include the key '" + VIEW + CLASS + "' in section 'Bootstrap'.");

            string baseDir = AppDomain.CurrentDomain.BaseDirectory;
            string controlAssembly = Path.Combine(baseDir, config.GetString(CONTROL + ASSEMBLY));
            string modelAssembly = Path.Combine(baseDir, config.GetString(MODEL + ASSEMBLY));
            string viewAssembly = Path.Combine(baseDir, config.GetString(VIEW + ASSEMBLY));

            string controlName = config.GetString(CONTROL + CLASS);
            string modelName = config.GetString(MODEL + CLASS);
            string ViewName = config.GetString(VIEW + CLASS);

            TestModule(CONTROL, controlAssembly, controlName, typeof(IControl));
            TestModule(MODEL, modelAssembly, modelName, typeof(IModel));
            TestModule(VIEW, viewAssembly, ViewName, typeof(IView));

            IDynamicLoaderModule loader = k.Get<IDynamicLoaderModule>();

            k.Unbind<IView>();
            k.Unbind<IModel>();
            k.Unbind<IControl>();
            loader.BindDynamic(typeof(IView), viewAssembly, ViewName, true);
            loader.BindDynamic(typeof(IModel), modelAssembly, modelName, true);
            loader.BindDynamic(typeof(IControl), controlAssembly, controlName, true);

            k.Unbind<IKeyTableFactory>();
            string tableLibrary = Path.Combine(baseDir, config.GetString(TABLE + ASSEMBLY, typeof(MapTableFactory).Assembly.Location));
            string tableType = config.GetString(TABLE + CLASS, typeof(MapTableFactory).FullName);
            loader.BindDynamic(typeof(IKeyTableFactory), tableLibrary, tableType, true);

            k.Unbind<IAlgorithm>();
            string algorithmFolder = Path.Combine(baseDir, config.GetString("AlgorithmFolder", "."));
            loader.BindAllInFolder(typeof(IAlgorithm), algorithmFolder);

            _clearCreated = config.GetBoolean("ClearCreated", true);
        }
开发者ID:JohnMcCaffery,项目名称:RoutingIsland,代码行数:61,代码来源:MRMSystem.cs

示例8: InitCoordinator


//.........这里部分代码省略.........
            masterConfig = config.Configs["Master"];
            IConfig generalConfig = config.Configs["General"];

            if (Init.Has(masterConfig, "Help")) {
                Console.WriteLine("Master Help");
                Console.WriteLine(Init.HelpHeaders);
                foreach (string line in Init.Help("Master").OrderBy(l => l))
                    Console.WriteLine(line);
                return null;
            }

            AddFile(config, file);

            LogManager.GetLogger("Master").Info("\nCreating Master.");

            Config proxyConfig = new Config(args, "Master", AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
            Core m = new Core(proxyConfig);

            bool autostartMaster = Get(masterConfig, "AutoStartMaster", true);

            if (Get(masterConfig, "GUI", true)) {
                if (autostartMaster)
                    new Thread(() => {
                        Thread.Sleep(500);
                        m.StartMaster();
                    }).Begin();
            } else {
                if (autostartMaster)
                    m.StartMaster();
                if (Get(masterConfig, "AutoStartClient", false) || Get(masterConfig, "AutoStartProxy", false))
                    m.StartProxy();
                if (Get(masterConfig, "AutoStartClient", false))
                    m.StartClient();
            }

            return m;
        }

        public static Window InitWindow(string[] args, out IConfig slaveConfig) {
            ArgvConfigSource argConfig = InitArgConfig(args);
            argConfig.AddSwitch("General", "Name", "n");
            argConfig.AddSwitch("General", "File", "f");

            string file;
            IConfigSource config = AddFile(argConfig, out file);
            string name = Init.Get(config.Configs["General"], "Name", "Slave1");

            argConfig.AddSwitch(name, "AutoConnectSlave", "as");
            argConfig.AddSwitch(name, "AutoStartProxy", "ap");
            argConfig.AddSwitch(name, "AutoStartClient", "ac");
            argConfig.AddSwitch(name, "GUI", "g");
            argConfig.AddSwitch(name, "Help", "h");

            config = AddFile(argConfig, out file);

            slaveConfig = config.Configs[name];
            IConfig generalConfig = config.Configs["General"];

            if (Init.Has(slaveConfig, "Help")) {
                Console.WriteLine("Slave Help");
                Console.WriteLine(Init.HelpHeaders);

                IEnumerable<string> list = Init.Help(name);
                list = list.Concat(new string[] {
                    Init.MakeHelpLine("General", "Name", "n", "The name for this slave.", "Slave1")
                });
                foreach (string line in list.OrderBy(l => l))
                    Console.WriteLine(line);

                return null;
            }

            LogManager.GetLogger(name).Info("\nCreating " + name + ".");

            Config proxyConfig = new Config(args, name, AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
            Window s = new Window(name, proxyConfig);

            bool autostartSlave = Get(slaveConfig, "AutoConnectSlave", true);

            if (Init.Get(slaveConfig, "GUI", true)) {
                if (autostartSlave)
                    new Thread(() => {
                        Thread.Sleep(500);
                        s.Connect();
                    }).Begin();
            } else {
                if (autostartSlave)
                    s.Connect();
                if (Get(slaveConfig, "AutoStartClient", false) || Get(slaveConfig, "AutoStartProxy", false))
                    s.StartProxy();
                if (Get(slaveConfig, "AutoStartClient", false))
                    s.StartClient();
            }
            return s;
        }
        */
        public static bool Has(IConfig cfg, string key)
        {
            return cfg != null && cfg.Contains(key);
        }
开发者ID:JohnMcCaffery,项目名称:ChimeraClean,代码行数:101,代码来源:Init.cs


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