#region INI 读取写入 [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); private string iniFilePath = Application.StartupPath + "\\public.ini"; /// <summary> /// 写入INI /// </summary> private void IniWrite(string section, string key, string value) { WritePrivateProfileString(section, key, value, iniFilePath); } /// <summary> /// 获取ini /// </summary> private string IniRead(string section, string key) { StringBuilder temp = new StringBuilder(255); int i = GetPrivateProfileString(section, key, "", temp, 255, iniFilePath); return temp.ToString(); } #endregion
欢迎转载,转载请注明:转载自[ http://www.cnblogs.com/zjfree/ ]