/// <summary> /// 写入指定段名的整段数据 /// </summary> /// <param name="segName">写入数据的段名</param> /// <param name="keys">写入数据的键集合</param> /// <param name="values">写入数据的值集合</param> public void WriteSection(string segName, string[] keys, string[] values) { if (keys.Length != values.Length) { throw new Exception("WriteSection(): 缺失参数"); } for (int i = 0; i < keys.Length; i++) { HmzWin32App.WritePrivateProfileString(segName, keys[i], values[i], this.path); } }
/// <summary> /// 写入浮点型数据 /// </summary> /// <param name="segName">写入数据的段名</param> /// <param name="keyName">写入数据的键名</param> /// <param name="value">写入数据的值</param> public void WriteDouble(string segName, string keyName, double value) { HmzWin32App.WritePrivateProfileString(segName, keyName, value.ToString(), this.path); }
/// <summary> /// 删除指定段名的整段数据信息 /// </summary> /// <param name="segName">需要删除的数据的段名</param> /// <returns>执行成功返回true</returns> public bool DeleteSection(string segName) { return(HmzWin32App.WritePrivateProfileString(segName, null, null, this.path)); }
/// <summary> /// 写入字符串数据 /// </summary> /// <param name="segName">写入数据的段名</param> /// <param name="keyName">写入数据的键名</param> /// <param name="value">写入数据的值</param> public void WriteString(string segName, string keyName, string value) { HmzWin32App.WritePrivateProfileString(segName, keyName, value, this.path); }
/// <summary> /// 删除指定段名及键名的数据信息 /// </summary> /// <param name="segName">需要删除的数据的段名</param> /// <param name="keyName">需要删除的数据的键名</param> /// <returns>执行成功返回true</returns> public bool DeleteKey(string segName, string keyName) { return(HmzWin32App.WritePrivateProfileString(segName, keyName, null, this.path)); }