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


C# IniFile.Remove方法代码示例

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


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

示例1: RemoveAeroDataSection

 public static void RemoveAeroDataSection(string carDir) {
     var aeroIni = new IniFile(carDir, "aero.ini");
     aeroIni.Remove("DATA");
     aeroIni.Save(true);
 }
开发者ID:gro-ove,项目名称:actools,代码行数:5,代码来源:DataFixer.cs

示例2: Test


//.........这里部分代码省略.........
                    "Key 3 = 0.1\n"                                   +
                    "; Comment 4\n"                                   +
                    "Key 4 = 0.2\n"                                   +
                    "Key 5 = 0.1\n"                                   +
                    "; Comment 6\n"                                   +
                    "Key 6 = 0.2\n"                                   +
                    "Key 7 = True\n"                                  +
                    "; Comment 8\n"                                   +
                    "Key 8 = False\n"                                 +
                    "Key 9 = 010204080F235DA7D8\n"                    +
                    "; Comment 10\n"                                  +
                    "Key 10 = 010204080F235DA7D8\n"                   +
                    "Key 11 = [KeyPair: key=1, value=2, comment=3]\n" +
                    "; Comment 12\n"                                  +
                    "Key 12 = [KeyPair: key=1, value=2, comment=3]\n" +
                    "Key 13 = \" Hello\"\n"                          +
                    "; Comment 14\n"                                  +
                    "Key 14 = \"World \"\n");

        testIni2.Parse(testIni1.ToString());
        AssertEqual(testIni1, testIni2);
        #endregion

        // ---------------------------------------------------------------------------------

        #region IniFile ContainsKey function
        AssertEqual(testIni1.ContainsKey("Key 1"),   true);
        AssertEqual(testIni1.ContainsKey("Nothing"), false);
        #endregion

        // ---------------------------------------------------------------------------------

        #region IniFile Remove function
        AssertEqual(testIni1.Remove("Key 1"),   true);
        AssertEqual(testIni1.Remove("Key 7"),   true);
        AssertEqual(testIni1.Remove("Key 14"),  true);
        AssertEqual(testIni1.Remove("Nothing"), true);

        AssertEqual(testIni1.count,        11);
        AssertEqual(testIni1.keys.Count,   11);
        AssertEqual(testIni1.values.Count, 11);
        AssertEqual(testIni1.currentGroup, "");

        keys   = testIni1.keys;
        values = testIni1.values;

        AssertEqual(keys[0],  "Key 2");
        AssertEqual(keys[1],  "Key 3");
        AssertEqual(keys[2],  "Key 4");
        AssertEqual(keys[3],  "Key 5");
        AssertEqual(keys[4],  "Key 6");
        AssertEqual(keys[5],  "Key 8");
        AssertEqual(keys[6],  "Key 9");
        AssertEqual(keys[7],  "Key 10");
        AssertEqual(keys[8],  "Key 11");
        AssertEqual(keys[9],  "Key 12");
        AssertEqual(keys[10], "Key 13");

        AssertEqual(values[0].key,  "Key 2");
        AssertEqual(values[1].key,  "Key 3");
        AssertEqual(values[2].key,  "Key 4");
        AssertEqual(values[3].key,  "Key 5");
        AssertEqual(values[4].key,  "Key 6");
        AssertEqual(values[5].key,  "Key 8");
        AssertEqual(values[6].key,  "Key 9");
        AssertEqual(values[7].key,  "Key 10");
开发者ID:Gris87,项目名称:IniFile,代码行数:67,代码来源:IniFile_DemoScript.cs

示例3: PrepareIniRaceMode

        public static void PrepareIniRaceMode(RaceProperties properties) {
            var ini = Path.Combine(FileUtils.GetDocumentsCfgDirectory(), "race.ini");

            var iniFile = new IniFile(ini);
            for (var i = 1; i < 100; i++) {
                var key = "CAR_" + i;
                if (iniFile.ContainsKey(key)) {
                    iniFile.Remove(key);
                } else {
                    break;
                }
            }
            iniFile.Save();

            DisableGhostCar();

            IniFile.Write(ini, "RACE", "CARS", properties.BotCars.Count() + 1);
            IniFile.Write(ini, "RACE", "AI_LEVEL", properties.AiLevel);
            IniFile.Write(ini, "RACE", "DRIFT_MODE", "0");
            IniFile.Write(ini, "RACE", "RACE_LAPS", properties.RaceLaps);
            IniFile.Write(ini, "RACE", "FIXED_SETUP", properties.FixedSetup);
            IniFile.Write(ini, "RACE", "PENALTIES", properties.Penalties);

            IniFile.Write(ini, "GROOVE", "VIRTUAL_LAPS", "10");
            IniFile.Write(ini, "GROOVE", "MAX_LAPS", "30");
            IniFile.Write(ini, "GROOVE", "STARTING_LAPS", "0");

            IniFile.Write(ini, "SESSION_0", "NAME", "Quick Race");
            IniFile.Write(ini, "SESSION_0", "TYPE", "3");
            IniFile.Write(ini, "SESSION_0", "LAPS", properties.RaceLaps);
            IniFile.Write(ini, "SESSION_0", "STARTING_POSITION", properties.StartingPosition);
            IniFile.Write(ini, "SESSION_0", "DURATION_MINUTES", "0");
            IniFile.Write(ini, "SESSION_0", "SPAWN_SET", "START");

            var j = 0;
            foreach (var botCar in properties.BotCars) {
                var section = "CAR_" + ++j;
                IniFile.Write(ini, section, "MODEL", botCar.CarId);
                IniFile.Write(ini, section, "MODEL_CONFIG", "");
                IniFile.Write(ini, section, "SETUP", botCar.Setup);
                IniFile.Write(ini, section, "AI_LEVEL", botCar.AiLevel);
                IniFile.Write(ini, section, "SKIN", botCar.SkinId);
                IniFile.Write(ini, section, "DRIVER_NAME", botCar.DriverName);
                IniFile.Write(ini, section, "NATIONALITY", botCar.Nationality);
            }
        }
开发者ID:gro-ove,项目名称:actools,代码行数:46,代码来源:Game_Obsolete.cs


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