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


C# IniFile.KeyExists方法代码示例

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


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

示例1: ReadFallout4PrefIni

        public bool ReadFallout4PrefIni(string s = "none")
        {
            string iniFolfder = GetIniFolder();

            if (File.Exists(iniFolfder + "Fallout4Prefs.ini"))
            {
                if (s == "none")
                {

                    IniFile fallout4Custom = new IniFile(iniFolfder + "Fallout4Prefs.ini");
                    IniFile fallout4ini = new IniFile(iniFolfder + "Fallout4.ini");
                   // ReadCustomValues();
                    for (int i = 0; i < AllFalloutSettings.Count; i++)
                    {
                        if (AllFalloutSettings[i].pref)
                        {
                            if (fallout4Custom.KeyExists(AllFalloutSettings[i].VarName, AllFalloutSettings[i].Section))
                            {
                                AllFalloutSettings[i].ChangeValue(fallout4Custom.Read(AllFalloutSettings[i].VarName, AllFalloutSettings[i].Section));
                                MainWindow.Console.WriteToConsole("AntiAliasing value " + GlobalVar.sAntiAliasing.VarValue);

                            }
                        }
                        else
                        {
                            if (fallout4ini.KeyExists(AllFalloutSettings[i].VarName, AllFalloutSettings[i].Section))
                            {
                                AllFalloutSettings[i].ChangeValue(fallout4ini.Read(AllFalloutSettings[i].VarName, AllFalloutSettings[i].Section));
                                MainWindow.Console.WriteToConsole("AntiAliasing value " + GlobalVar.sAntiAliasing.VarValue);

                            }
                        }
                    }
                }
                else
                {
                    //   GenerateXMLAttributes
                    XmlReader xl = XmlReader.Create(s);

                    XmlSerializer file = new XmlSerializer(typeof(List<AppSettingFormat>), "test");
                    List<AppSettingFormat> FileFalloutSettings = new List<AppSettingFormat>();
                    FileFalloutSettings = (List<AppSettingFormat>)file.Deserialize(xl);
                    for (int i = 0; i < AllFalloutSettings.Count; i++)
                    {
                        AllFalloutSettings[i].ChangeValue(FileFalloutSettings[i].VarValue);
                    }
                    xl.Dispose();
                }

                ReadApplicationIni();
                return true;
            }
            ReadApplicationIni();
            return false;
        }
开发者ID:DelGruth,项目名称:FO4AlternativeLauncher,代码行数:55,代码来源:GlobalVar.cs

示例2: ReadApplicationIni

 public static void ReadApplicationIni()
 {
     IniFile settingFile = new IniFile(AppSettingPath);
     if (settingFile.KeyExists(OpenConsole.VarName, "Main"))
     {
         OpenConsole.VarValue = settingFile.Read(OpenConsole.VarName, OpenConsole.Section);
     }
     if (settingFile.KeyExists("EXEPath", "Main"))
     {
         EXEPath.ChangeValue(settingFile.Read("EXEPath", "Main"));
     }
     else if (MainWindow.exeIndex != -1)
     {
         EXEPath.ChangeValue(MainWindow.PossibleFallout4Paths[MainWindow.exeIndex]);
     }
     else
     {
         try
         {
             EXEPath.ChangeValue(Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\bethesda softworks\Fallout4\").GetValue("Installed Path").ToString() + "Fallout4.exe");
             return;
         }
         catch
         {
             MessageBox.Show("Could not determine path to Fallout4.exe,please set it manually at the launcher tab");
         }
     }
     MainWindow.Console.WriteToConsole("OpenConsoleValue is: " + OpenConsole.VarValue.ToString());
 }
开发者ID:DelGruth,项目名称:FO4AlternativeLauncher,代码行数:29,代码来源:GlobalVar.cs


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