本文整理汇总了C#中IniParser.FileIniDataParser.SaveFile方法的典型用法代码示例。如果您正苦于以下问题:C# FileIniDataParser.SaveFile方法的具体用法?C# FileIniDataParser.SaveFile怎么用?C# FileIniDataParser.SaveFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IniParser.FileIniDataParser
的用法示例。
在下文中一共展示了FileIniDataParser.SaveFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
//Create an instance of a ini file parser
FileIniDataParser fileIniData = new FileIniDataParser();
if (File.Exists("NewTestIniFile.ini"))
File.Delete("NewTestIniFile.ini");
//Parse the ini file
IniData parsedData = fileIniData.LoadFile("TestIniFile.ini");
//Write down the contents of the ini file to the console
Console.WriteLine("---- Printing contents of the INI file ----\n");
Console.WriteLine(parsedData.ToString());
//Get concrete data from the ini file
Console.WriteLine("---- Printing contents concrete data from the INI file ----");
Console.WriteLine("setMaxErrors = " + parsedData["GeneralConfiguration"]["setMaxErrors"]);
Console.WriteLine();
//Modify the INI contents and save
Console.WriteLine();
//Write down the contents of the modified ini file to the console
Console.WriteLine("---- Printing contents of the new INI file ----\n");
IniData modifiedParsedData = ModifyINIData(parsedData);
Console.WriteLine(modifiedParsedData.ToString());
//Save to a file
fileIniData.SaveFile("NewTestIniFile.ini", modifiedParsedData);
}
示例2: EmuleAdunanzASetUdpPort
public static void EmuleAdunanzASetUdpPort(int port)
{
if ((port > 65554) && (port == 0))
{
throw new Exception("la Porta UDP da configurare non e' valida");
}
//Create an instance of a ini file parser
IniParser.FileIniDataParser iniparser = new FileIniDataParser();
IniData data = iniparser.ReadFile(EmuleAdunanzAConfigFileGetPath());
data["eMule"]["UDPPort"] = port.ToString();
iniparser.SaveFile(EmuleAdunanzAConfigFileGetPath(), data);
}
示例3: EmuleAdunanzaConfigSetKey
public static void EmuleAdunanzaConfigSetKey(string key, string value)
{
//Create an instance of a ini file parser
IniParser.FileIniDataParser iniparser = new FileIniDataParser();
IniData data = iniparser.ReadFile(EmuleAdunanzAConfigFileGetPath());
data["eMule"][key] = value;
iniparser.SaveFile(EmuleAdunanzAConfigFileGetPath(), data);
}
示例4: AmuleAdunanzaSetTcpPort
public static void AmuleAdunanzaSetTcpPort(int port)
{
if ((port > 65554) && (port == 0))
{
throw new Exception("la Porta TCP da configurare non e' valida");
}
var conf = AmuleAdunanzaAduboxConfigFileGetPath();
//Create an instance of a ini file parser
IniParser.FileIniDataParser iniparser = new FileIniDataParser();
IniData data = iniparser.ReadFile(conf);
data["eMule"]["Port"] = port.ToString();
iniparser.SaveFile(conf, data);
}
示例5: Tour_FormClosed
private void Tour_FormClosed(object sender, FormClosedEventArgs e)
{
FileIniDataParser parser = new FileIniDataParser();
this.config["settings"]["tourEnabled"] = (!this.checkBox1.Checked).ToString();
parser.SaveFile(this.configFilePath, this.config);
}
示例6: Save
public void Save()
{
try
{
IniData data = new IniData();
data.Sections.AddSection("Settings");
data.Sections.GetSectionData("Settings").Keys.AddKey("AutoLoad", AutoLoad.ToString());
data.Sections.GetSectionData("Settings").Keys.AddKey("AutoUpdate", AutoUpdate.ToString());
data.Sections.GetSectionData("Settings").Keys.AddKey("LastLoadPath", LastLoadPath);
data.Sections.GetSectionData("Settings").Keys.AddKey("SteamID", SteamID.ToString());
data.Sections.GetSectionData("Settings").Keys.AddKey("UserKey", UserKey);
FileIniDataParser parser = new FileIniDataParser();
parser.SaveFile(SettingPath, data);
}
catch (Exception e)
{
Debug.WriteLine(e.ToString());
}
}
示例7: Save
protected void Save(string filePath, IniData iniData)
{
IniParser.FileIniDataParser parser = new IniParser.FileIniDataParser();
parser.SaveFile(filePath, iniData);
}