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


C# IniFile.SectionExists方法代码示例

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


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

示例1: NGameLobby_Load


//.........这里部分代码省略.........
                pNameTextBoxes[tbId] = new TextBox();
                TextBox pNameTextBox = pNameTextBoxes[tbId];
                pNameTextBox.Location = getPlayerNameCMBFromId(tbId + 1).Location;
                pNameTextBox.Size = getPlayerNameCMBFromId(tbId + 1).Size;
                pNameTextBox.BorderStyle = BorderStyle.FixedSingle;
                pNameTextBox.Font = cmbP1Name.Font;
                pNameTextBox.GotFocus += playerNameTextBox_GotFocus;
                pNameTextBox.ForeColor = cAltUiColor;
                pNameTextBox.BackColor = cBackColor;
                panel1.Controls.Add(pNameTextBox);
                pNameTextBox.Visible = false;
            }

            pSideLabels = new TextBox[8];
            for (int labelId = 0; labelId < pSideLabels.Length; labelId++)
            {
                pSideLabels[labelId] = new TextBox();
                TextBox forcedSideBox = pSideLabels[labelId];
                forcedSideBox.Anchor = AnchorStyles.Top | AnchorStyles.Left;
                forcedSideBox.BackColor = cBackColor;
                forcedSideBox.BorderStyle = BorderStyle.FixedSingle;
                forcedSideBox.ForeColor = cLabelColor;
                Point sLocation = getPlayerSideCMBFromId(labelId + 1).Location;
                forcedSideBox.Location = sLocation;
                forcedSideBox.Size = getPlayerSideCMBFromId(labelId + 1).Size;
                panel1.Controls.Add(forcedSideBox);
                forcedSideBox.Visible = false;
                forcedSideBox.GotFocus += playerNameTextBox_GotFocus;
            }

            string[] checkBoxes = clIni.GetStringValue("GameLobby", "CheckBoxes", "none").Split(',');
            foreach (string checkBoxName in checkBoxes)
            {
                if (clIni.SectionExists(checkBoxName))
                {
                    string chkText = clIni.GetStringValue(checkBoxName, "Text", "No description");
                    string associatedSpawnIniOption = clIni.GetStringValue(checkBoxName, "AssociateSpawnIniOption", "none");
                    AssociatedCheckBoxSpawnIniOptions.Add(associatedSpawnIniOption);
                    string associatedCustomIni = clIni.GetStringValue(checkBoxName, "AssociateCustomIni", "none");
                    AssociatedCheckBoxCustomInis.Add(associatedCustomIni);
                    bool defaultValue = clIni.GetBooleanValue(checkBoxName, "DefaultValue", false);
                    bool reversed = clIni.GetBooleanValue(checkBoxName, "Reversed", false);
                    string[] location = clIni.GetStringValue(checkBoxName, "Location", "0,0").Split(',');
                    Point pLocation = new Point(Convert.ToInt32(location[0]), Convert.ToInt32(location[1]));
                    string toolTip = clIni.GetStringValue(checkBoxName, "ToolTip", String.Empty);

                    UserCheckBox chkBox = new UserCheckBox(cLabelColor, cAltUiColor, chkText);
                    chkBox.AutoSize = true;
                    chkBox.Location = pLocation;
                    chkBox.Name = checkBoxName;
                    if (defaultValue)
                        chkBox.Checked = true;
                    else
                        chkBox.Checked = false;
                    if (!isHost)
                        chkBox.IsEnabled = false;
                    chkBox.CheckedChanged += new UserCheckBox.OnCheckedChanged(GenericChkBox_CheckedChanged);

                    if (!String.IsNullOrEmpty(toolTip))
                    {
                        toolTip1.SetToolTip(chkBox, toolTip);
                        toolTip1.SetToolTip(chkBox.label1, toolTip);
                        toolTip1.SetToolTip(chkBox.button1, toolTip);
                    }

                    IsCheckBoxReversed.Add(reversed);
开发者ID:GrantBartlett,项目名称:ClientGUI,代码行数:67,代码来源:NGameLobby.cs

示例2: WriteStringNoSection

 public void WriteStringNoSection()
 {
     using (IniFile ini = new IniFile(fileName)) {
         Assert.IsFalse(ini.SectionExists("doesnotexist"));
         ini.WriteString("doesnotexist", "foo", "bar");
         Assert.IsTrue(ini.SectionExists("doesnotexist"));
         Assert.AreEqual("bar", ini.ReadString("doesnotexist", "foo"));
     }
     using (IniFile ini = new IniFile(fileName)) {
         Assert.IsTrue(ini.SectionExists("doesnotexist"));
         Assert.AreEqual("bar", ini.ReadString("doesnotexist", "foo"));
     }
 }
开发者ID:d0k,项目名称:ninifile,代码行数:13,代码来源:IniTest.cs

示例3: EraseSection

 private static void EraseSection(string remove, string exists)
 {
     using (IniFile ini = new IniFile(fileName)) {
         Assert.IsTrue(ini.SectionExists(remove));
         ini.EraseSection(remove);
         Assert.IsFalse(ini.SectionExists(remove));
         Assert.IsTrue(ini.SectionExists(exists));
     }
     using (IniFile ini = new IniFile(fileName)) {
         Assert.IsFalse(ini.SectionExists(remove));
         Assert.IsTrue(ini.SectionExists(exists));
     }
 }
开发者ID:d0k,项目名称:ninifile,代码行数:13,代码来源:IniTest.cs

示例4: SectionExists

 public void SectionExists()
 {
     using (IniFile ini = new IniFile(fileName)) {
         Assert.IsTrue(ini.SectionExists("Test"));
         Assert.IsFalse(ini.SectionExists("doesnotexisT"));
         Assert.IsTrue(ini.SectionExists("Section1"));
     }
 }
开发者ID:d0k,项目名称:ninifile,代码行数:8,代码来源:IniTest.cs


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