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


C# Config.Remove方法代码示例

本文整理汇总了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);
        }
开发者ID:Team2122,项目名称:SpudConf,代码行数:28,代码来源:ConfigTest.cs

示例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;
        }
开发者ID:stsy,项目名称:mappy,代码行数:30,代码来源:FFXIGameInstance.cs


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