![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Code
///10月16日更新
/// <summary>
/// 添加新的ini文件
/// </summary>
/// <param name="IniData">The ini data.</param>
/// <param name="iniPath">ini文件路径</param>
/// <param name="Category">新添加的节点名</param>
/// <returns></returns>
public bool AddIniCategory(IniStructure IniOper, string iniPath, string Category)
{
//如果没有meeting项目
if (!IniOper.Categories.ContainsKey(Category))
{
if (Category == "meeting")
{
IniOper.AddCategory(Category);
IniOper.AddValue(Category, "use", "0");
IniOper.AddValue(Category, "web", "http://192.168.0.151:8080");
}
IniStructure.WriteIni(IniOper, iniPath);
return true;
}
else
{
return false;
}
}
第一个参数IniOper就是一个类对象作为参数传递
下面是调用
IniOper = IniStructure.ReadIni(this.GetConfigPath()); //返回一个类的对象
//添加WebConfig.ini新节点
if ((new IniStructure()).AddIniCategory(IniOper, this.GetConfigPath(), "meeting") == true)
{
//更新后重新读取ini文件
IniOper = IniStructure.ReadIni(this.GetConfigPath());
}
就像用户注册一样 最后传递的是一个类的对象 所有的用户信息都包括在类的对象中