本文整理汇总了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;
}
示例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());
}