本文整理汇总了C#中Config.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Config.Remove方法的具体用法?C# Config.Remove怎么用?C# Config.Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config.Remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Config_ChangeSet
public void Config_ChangeSet()
{
Config oldConfig = new Config();
oldConfig.Add("Test.Modified", new ConfigNode("NotModified"));
oldConfig.Add("Test.Removed", new ConfigNode("NotRemoved"));
Config newConfig = new Config(oldConfig);
newConfig.Remove("Test.Removed");
newConfig["Test.Modified"] = new ConfigNode("Modified");
newConfig.Add("Test.Added", new ConfigNode("Added"));
var changeSet = ConfigLoader.GenerateChangeSet(oldConfig, newConfig);
Assert.IsTrue(changeSet.ContainsNodeWithKey("Test.Modified"), "Modified change not recorded");
Assert.IsTrue(changeSet.ContainsNodeWithKey("Test.Removed"), "Removed change not recorded");
Assert.IsTrue(changeSet.ContainsNodeWithKey("Test.Added"), "Added change not recorded");
Assert.AreEqual(ChangeType.Modified, changeSet.WithKey("Test.Modified").Type);
Assert.AreEqual(ChangeType.Removed, changeSet.WithKey("Test.Removed").Type);
Assert.AreEqual(ChangeType.Added, changeSet.WithKey("Test.Added").Type);
Assert.AreEqual("NotModified", changeSet.WithKey("Test.Modified").Old.Value);
Assert.AreEqual("Modified", changeSet.WithKey("Test.Modified").New.Value);
Assert.AreEqual("NotRemoved", changeSet.WithKey("Test.Removed").Old.Value);
Assert.AreEqual(null, changeSet.WithKey("Test.Removed").New);
Assert.AreEqual(null, changeSet.WithKey("Test.Added").Old);
Assert.AreEqual("Added", changeSet.WithKey("Test.Added").New.Value);
}
示例2: LoadSignatures
private static void LoadSignatures(Config config)
{
if (sigloaded)
return;
//Determine if there are manually configured signatures
if (config.Exists("sigversion"))
{
//If so, first determine if there are new internally built ones and clobber the manual ones if so.
if (config.Get("sigversion", "") != Application.ProductVersion)
{
config.Remove("sigversion");
config.Remove("SIG_MY_ID");
config.Remove("SIG_MY_TARGET");
config.Remove("SIG_SPAWN_END");
config.Remove("SIG_SPAWN_START");
config.Remove("SIG_ZONE_ID");
config.Remove("SIG_ZONE_SHORT");
}
//push the manually configured signatures
SIG_MY_ID = config.Get("SIG_MY_ID", DEFAULT_SIG_MY_ID);
SIG_MY_TARGET = config.Get("SIG_MY_TARGET", DEFAULT_SIG_MY_TARGET);
SIG_SPAWN_END = config.Get("SIG_SPAWN_END", DEFAULT_SIG_SPAWN_END);
SIG_SPAWN_START = config.Get("SIG_SPAWN_START", DEFAULT_SIG_SPAWN_START);
SIG_ZONE_ID = config.Get("SIG_ZONE_ID", DEFAULT_SIG_ZONE_ID);
SIG_ZONE_SHORT = config.Get("SIG_ZONE_SHORT", DEFAULT_SIG_ZONE_SHORT);
}
sigloaded = true;
}