本文整理汇总了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");
}
示例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"));
}
示例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"));
}
示例4: SetUp
public void SetUp()
{
_configManager = ConfigManager.GetInstance();
if (_configManager.GetConfigFile(XmlConfigFile) == null)
_configManager.Load(XmlConfigFile);
}
示例5: SetUp
public void SetUp()
{
_configManager = ConfigManager.GetInstance();
_configManager.Load(@"test_files\AccuracyTest.ini");
_namespaces[0] = _configManager.GetNamespace("AccuracyNamespace1");
_namespaces[1] = _configManager.GetNamespace("AccuracyNamespace2");
}
示例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");
}
示例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);
}
示例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);
}
示例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;
}
示例10: SetUp
protected void SetUp()
{
_configManager = ConfigManager.GetInstance();
_configManager.Load("test_files/failure_tests.xml");
}