本文整理汇总了C#中IniFile.AddSection方法的典型用法代码示例。如果您正苦于以下问题:C# IniFile.AddSection方法的具体用法?C# IniFile.AddSection怎么用?C# IniFile.AddSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IniFile
的用法示例。
在下文中一共展示了IniFile.AddSection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveConfig
public void SaveConfig()
{
Ini = new IniFile();
string dirs="";
foreach (String dir in SourceDirs) {
if(Directory.Exists(dir))
dirs += dir + "|";
}
Ini.AddSection("SOURCE_DIRS").AddKey("DIRS").SetValue(dirs);
dirs = "";
foreach (CloudStorage dir in CloudStorageLst) {
if (Directory.Exists(dir.Path))
dirs += dir.Name + ";" + dir.Path + ";" + dir.Size + "|";
}
Ini.AddSection("OUTPUT_DIRS").AddKey("DIRS").SetValue(dirs);
Ini.Save(ConfigFilename);
}
示例2: mainForm_FormClosing
private void mainForm_FormClosing(object sender, FormClosingEventArgs e)
{
int FormMaximizedI = 0;
Size formSize = new Size();
Point formPos = new Point();
string fontSize = fontDialog1.Font.Size.ToString();
string fontName = fontDialog1.Font.Name;
//Prepare and convert variables to strings for writing.
formSize.Height = this.Size.Height;
formSize.Width = this.Size.Width;
formPos.X = this.Location.X;
formPos.Y = this.Location.Y;
IniFile fsINI = new IniFile();
Uri uri = new Uri(settingsFile);
//System.IO.Path.GetDirectoryName(
//System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
switch(this.WindowState)
{
case FormWindowState.Maximized:
FormMaximizedI = 1;
break;
case FormWindowState.Normal:
FormMaximizedI = 0;
break;
default: break;
}
//Write the variables to Settings.ini
fsINI.SetKeyValue("User", "FontSize", fontSize);
fsINI.SetKeyValue("User", "FontName", fontName);
fsINI.SetKeyValue("Application", "FormH", formSize.Height.ToString());
fsINI.SetKeyValue("Application", "FormW", formSize.Width.ToString());
fsINI.SetKeyValue("Application", "FormX", formPos.X.ToString());
fsINI.SetKeyValue("Application", "FormY", formPos.Y.ToString());
fsINI.SetKeyValue("Application", "Maximized", FormMaximizedI.ToString());
fsINI.AddSection("User").AddKey("FileInTitle").Value = "1";
fsINI.Save(uri.LocalPath + "\\Settings.ini");
}