色www,五月婷婷深爱五月,午夜国产一级片,色噜噜综合,国产大胸无码视频,清纯美女被操黄网站在线观看,波多野结衣av高清一区二区三区

asp.net 操作INI文件讀寫類實例代碼

時間:2024-07-28 17:24:04 ASP 我要投稿
  • 相關(guān)推薦

asp.net 操作INI文件讀寫類實例代碼

  復制代碼 代碼如下:

  using System;

  using System.Runtime.InteropServices;

  using System.Text;

  using System.IO;

  namespace Common

  {

  ///

  /// INI文件讀寫類。

  ///

  public class INIFile

  {

  public string path;

  public INIFile(string INIPath)

  {

  path = INIPath;

  }

  [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);

  [DllImport("kernel32")]

  private static extern int GetPrivateProfileString(string section, string key, string defVal, Byte[] retVal, int size, string filePath);

  ///

  /// 寫INI文件

  ///

  ///

  ///

  ///

  public void IniWriteValue(string Section,string Key,string Value)

  {

  WritePrivateProfileString(Section,Key,Value,this.path);

  }

  ///

  /// 讀取INI文件

  ///

  ///

  ///

  ///

  public string IniReadValue(string Section,string Key)

  {

  StringBuilder temp = new StringBuilder(255);

  int i = GetPrivateProfileString(Section,Key,"",temp, 255, this.path);

  return temp.ToString();

  }

  public byte[] IniReadValues(string section, string key)

  {

  byte[] temp = new byte[255];

  int i = GetPrivateProfileString(section, key, "", temp, 255, this.path);

  return temp;

  }

  ///

  /// 刪除ini文件下所有段落

  ///

  public void ClearAllSection()

  {

  IniWriteValue(null,null,null);

  }

  ///

  /// 刪除ini文件下personal段落下的所有鍵

  ///

  ///

  public void ClearSection(string Section)

  {

  IniWriteValue(Section,null,null);

  }

  }

  }

  沒有太多含量,做雕蟲小技是還是用得上。

【 asp.net 操作INI文件讀寫類實例代碼】相關(guān)文章:

php解析ini配置文件07-13

ASP.NET MVC異常處理模塊簡單教程-ASP.NET教程實例推薦07-19

ASP.NET連SQL7接口的源代碼06-06

Java文件解壓縮實例詳解201607-26

Linux文件系統(tǒng)操作命令大全07-03

關(guān)于ASP.NET使用JavaScript顯示信息提示窗口實現(xiàn)原理及代碼05-09

ASP網(wǎng)頁程序設(shè)計中10個非常有用的實例代碼08-12

Linux操作系統(tǒng)文件系統(tǒng)基礎(chǔ)知識07-25

2016職稱英語綜合類A代碼12考試答案09-14

Mac電腦設(shè)置自動排列文件圖標的操作方法07-04