using System;
using System.Web;
using System.Data;
using System.Text;
using System.Configuration;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
namespace HRMS
{
/// <summary>
/// ゅン巨摸
/// </summary>
public class FileOperate
{
public string sFilePath; //INIゅン
//羘弄糶INIゅンAPIㄧ计
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section,string key,string val,string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section,string key,string def,StringBuilder retVal,int size,string filePath);
/// <summary>
/// 摸篶硑ㄧ计肚患INIゅン
/// </summary>
/// <param name="INIPath">璶弄INIゅン隔畖㎝嘿</param>
public FileOperate(string INIPath)
{
//
// TODO: 矪睰篶硑ㄧ计呸胯
//
sFilePath = INIPath;
}
/// <summary>
/// 糶INIゅン计沮
/// </summary>
/// <param name="Section">跋办</param>
/// <param name="Key">跑秖</param>
/// <param name="Value"></param>
public void IniWriteValue(string Section,string Key,string Value)
{
WritePrivateProfileString(Section, Key, Value, this.sFilePath);
}
/// <summary>
/// 弄INIゅン计沮
/// </summary>
/// <param name="Section">跋办</param>
/// <param name="Key">跑秖</param>
/// <returns>才计沮</returns>
public string IniReadValue(string Section,string Key)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, "", temp, 255, this.sFilePath);
return temp.ToString();
}
}
}