⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inipas.pas

📁 EasyGasDpr 瓶装液化气 钢瓶 SQL,用户名:SYSTEM 密码:空
💻 PAS
字号:
unit INIPAS ;

interface
uses INIFiles,SysUtils,Forms;

  Function ReadINIStr(Const BASE_NAME,SUB_NAME,DEFAULT_RESULT:String):String;
  Function ReadINIInt(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Integer):Integer;
  Function ReadINIBool(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Boolean):Boolean;
  Function WriteINIStr(Const BASE_NAME,SUB_NAME,DEFAULT_RESULT:String):Boolean;
  Function WriteINIInt(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Integer):Boolean;

implementation

Function ReadINIStr(Const BASE_NAME,SUB_NAME,DEFAULT_RESULT:String):String;
var INI:TINIFile;
Begin
  INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
  With INI do
  Begin
    Result:=ReadString(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
  end;
  INI.Free;
end;

Function ReadINIInt(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Integer):Integer;
var INI:TINIFile;
Begin
  INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
  With INI do
  Begin
  Result:=ReadInteger(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
  end;
  INI.Free;
end;

Function ReadINIBool(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Boolean):Boolean;
var INI:TINIFile;
Begin
  INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
  With INI do
  Begin
    Result:=ReadBool(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
  end;
  INI.Free;
end;

Function WriteINIStr(Const BASE_NAME,SUB_NAME,DEFAULT_RESULT:String):Boolean;
var INI:TINIFile;
Begin
  Result:=True; Try
  INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
  With INI do
  Begin
    WriteString(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
  end;
  INI.Free;
  Except Result:=False; end;
end;

Function WriteINIInt(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Integer):Boolean;
var INI:TINIFile;
Begin
  Result:=True; Try
  INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
  With INI do
  Begin
    WriteInteger(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
  end;
  INI.Free;
  Except Result:=False; end;
end;

Function WriteINIBool(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Boolean):Boolean;
var INI:TINIFile;
Begin
  Result:=True; Try
  INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
  With INI do
  Begin
    WriteBool(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
  end;
  INI.Free;
  Except Result:=False; end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -