-
Notifications
You must be signed in to change notification settings - Fork 23
/
uinihelper.pas
46 lines (33 loc) · 900 Bytes
/
uinihelper.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
unit uIniHelper;
{$mode objfpc}{$H+}
{$modeswitch TypeHelpers}
interface
uses
Classes, SysUtils, IniFiles, uUtilsMore;
type
{ TIniFilesHelper }
TIniFilesHelper = class helper for TIniFile
public
function ReadHotKey(const Section, Ident: string; const Default: THotKey): THotKey;
procedure WriteHotKey(const Section, Ident: String; const Value: THotKey);
end;
implementation
{ TIniFilesHelper }
function TIniFilesHelper.ReadHotKey(const Section, Ident: string;
const Default: THotKey): THotKey;
var
ResultStr: String;
begin
ResultStr := ReadString(Section, Ident, Default.ToString);
try
Result.Parse(ResultStr);
except
Result := Default;
end;
end;
procedure TIniFilesHelper.WriteHotKey(const Section, Ident: String;
const Value: THotKey);
begin
WriteString(Section, Ident, Value.ToString);
end;
end.