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


C# ConfigManager.Load方法代码示例

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


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

示例1: TestComplexSave

        public void TestComplexSave()
        {
            var baseConfig = CreateTestConfig("configbase.xml");
            var userConfig = new Configuration()
            {
                FilePath = Path.Combine(Path.GetDirectoryName(baseConfig.FilePath), "config.xml"),
                Parent = "configbase.xml"
            };
            baseConfig.ChildConfigurations.Add(userConfig);

            userConfig.Parameters.Add(new Parameter()
            {
                Name = "TestParam",
                Value = "uservalue",
                ValueComesFromConfiguration = userConfig
            });

            ConfigManager.SaveConfig(baseConfig);
            ConfigManager.SaveConfig(userConfig);

            var man = new ConfigManager(userConfig.FilePath);
            man.Load();
            var param = man.Config.Parameters.FirstOrDefault(p => p.Name == "TestParam");
            param.Value = "testnewvalue";
            man.Save();
            man.Load();
            param = man.Config.Parameters.FirstOrDefault(p => p.Name == "TestParam");
            Assert.IsTrue(param.Value == "testnewvalue");
        }
开发者ID:mdavid626,项目名称:triton,代码行数:29,代码来源:ConfigManagerTest.cs

示例2: Start

 // Use this for initialization
 void Start()
 {
     cm = GameObject.Find ("Configuration").GetComponent <ConfigManager>();// GetComponent<ConfigManager> ();
     pm = GameObject.Find("Player").GetComponent<PlayerManager>();
     pufferSlider.maxValue = (float)Double.Parse(cm.Load ("MaxPufferCharge"));;
     breathSlider.maxValue = (float)Double.Parse(cm.Load ("MaxBreath"));
 }
开发者ID:NUGameDev,项目名称:LungLunge,代码行数:8,代码来源:HUDUpdater.cs

示例3: Start

    // Use this for initialization
    void Start()
    {
        cm = GetComponent<ConfigManager>();
        yCenter = transform.position.y;
        yMove = 0f;
        pm = GameObject.Find("Player").GetComponent<PlayerManager>();

        pufferRecharge = (float)Double.Parse(cm.Load ("pufferRecharge"));
        pufferscore   = Int32.Parse(cm.Load ("pufferscore"));
    }
开发者ID:NUGameDev,项目名称:LungLunge,代码行数:11,代码来源:PufferPickup.cs

示例4: SetUp

        public void SetUp() 
        {
            _configManager = ConfigManager.GetInstance();

            if (_configManager.GetConfigFile(XmlConfigFile) == null)
                _configManager.Load(XmlConfigFile);
        }
开发者ID:spolnik,项目名称:Simple.Config,代码行数:7,代码来源:AccuracyTestConfigManager.cs

示例5: SetUp

        public void SetUp()
        {
            _configManager = ConfigManager.GetInstance();
            _configManager.Load(@"test_files\AccuracyTest.ini");

            _namespaces[0] = _configManager.GetNamespace("AccuracyNamespace1");
            _namespaces[1] = _configManager.GetNamespace("AccuracyNamespace2");
        }
开发者ID:spolnik,项目名称:Simple.Config,代码行数:8,代码来源:NamespaceAccuracyTest.cs

示例6: SetUp

        public void SetUp()
        {
            _configManager = ConfigManager.GetInstance();
            _configManager.Load(@"test_files\AccuracyTest.ini");

            _properties[0] = _configManager.GetProperty("AccuracyNamespace1", "AccuracyProp1");
            _properties[1] = _configManager.GetProperty("AccuracyNamespace1", "AccuracyProp2");
            _properties[2] = _configManager.GetProperty("AccuracyNamespace1", "AccuracyProp3");
            _properties[3] = _configManager.GetProperty("AccuracyNamespace2", "AccuracyProp1");
            _properties[4] = _configManager.GetProperty("AccuracyNamespace2", "AccuracyProp2");
            _properties[5] = _configManager.GetProperty("AccuracyNamespace2", "AccuracyProp3");
        }
开发者ID:spolnik,项目名称:Simple.Config,代码行数:12,代码来源:PropertyAccuracyTest.cs

示例7: Save_Load_ValuesAreSame

        void Save_Load_ValuesAreSame(string key, object value)
        {
            var configManager = new ConfigManager()
                .WithScope(DataProtectionScope.CurrentUser)
                .Set(key, value)
                .AtApplicationFolder()
                .Save();

            var loadedValue = configManager
                .Load()
                .Get<string>(key);

            Assert.Equal(value, loadedValue);
        }
开发者ID:FireAlkazar,项目名称:safe-config,代码行数:14,代码来源:ConfigManagerTests.cs

示例8: Save_Load_ValuesAreSame

        private void Save_Load_ValuesAreSame(string key, object value)
        {
            var configManager = new ConfigManager()
                .WithLocalMachineScope()
                .Set(key, value)
                .AtApplicationFolder()
                .Save();

            var loadedValue = configManager
                .Load()
                .Get<string>(key);

            Assert.Equal(value, loadedValue);
        }
开发者ID:alex-erygin,项目名称:safe-config,代码行数:14,代码来源:ConfigManagerTests.cs

示例9: Start

    // Use this for initialization
    void Start()
    {
        cm = GetComponent<ConfigManager> ();
        rb = GetComponent<Rigidbody>();
        actionController = GetComponentInChildren<ActionsNew> ();
        // load value from config file if they exist. Otherwise use the defaults from the unity editor.
        cm = GameObject.Find ("Configuration").GetComponent <ConfigManager>();// GetComponent<ConfigManager> ();

        MoveSpeed =  (float)Double.Parse(cm.Load ("MoveSpeed"));
        JumpSpeed =  (float)Double.Parse(cm.Load ("JumpSpeed"));
        JumpDepletionAmount =  (float)Double.Parse(cm.Load ("JumpDepletionAmount"));
        RunDepletionRate =  (float)Double.Parse(cm.Load ("RunDepletionRate"));
        BreathRecoveryTimeout =  Int32.Parse(cm.Load ("BreathRecoveryTimeout"));
        BreathRecoveryRate =  (float)Double.Parse(cm.Load ("BreathRecoveryRate"));
        if (isWinter) recoverModifier = WINTER_PENALTY/100; //if its winter then recovery is 25% less than normal
        PufferBreathRecovered =  (float)Double.Parse(cm.Load ("PufferBreathRecovered"))*recoverModifier;
        MaxBreath =  (float)Double.Parse(cm.Load ("MaxBreath"));
        MaxPufferCharge =  (float)Double.Parse(cm.Load ("MaxPufferCharge"));
        PufferCostSelf =  (float)Double.Parse(cm.Load ("PufferCostSelf"));
        PufferCostSpray =  (float)Double.Parse(cm.Load ("PufferCostSpray"));

        this.transform.position = GameObject.Find ("LevelStart").transform.position + new Vector3 (0.0f, 0.5f, 0.0f);
        currentBreath = MaxBreath;
        currentPufferCharge = MaxPufferCharge;
    }
开发者ID:NUGameDev,项目名称:LungLunge,代码行数:26,代码来源:PlayerManager.cs

示例10: SetUp

 protected void SetUp()
 {
     _configManager = ConfigManager.GetInstance();
     _configManager.Load("test_files/failure_tests.xml");
 }
开发者ID:spolnik,项目名称:Simple.Config,代码行数:5,代码来源:ConfigManagerTests.cs


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