-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUST_IniFile.pas
More file actions
72 lines (52 loc) · 1.68 KB
/
UST_IniFile.pas
File metadata and controls
72 lines (52 loc) · 1.68 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
unit UST_IniFile;
interface
uses Classes, IniFiles, UST_Common;
type
TST_Inifile = class(TIniFile)
public
function ReadString(const Section, Ident, Default: string): string; override;
procedure WriteString(const Section, Ident, Value: String); override;
procedure ReadSectionValues(const Section: string; Strings: TStrings); override;
constructor Create(const FileName: string);
destructor Destroy; override;
end;
implementation
constructor TST_Inifile.Create(const FileName: string);
begin
inherited Create(FileName);
end;
destructor TST_Inifile.Destroy();
begin
inherited Destroy;
end;
function TST_Inifile.ReadString(const Section, Ident, Default: string): string;
var
sTmp : string;
begin
sTmp := inherited ReadString(Section, Ident, Default);
sTmp := ReplaceInString(sTmp, '<#LF#>', Chr(10));
sTmp := ReplaceInString(sTmp, '<#CR#>', Chr(13));
result := sTmp;
end;
procedure TST_Inifile.WriteString(const Section, Ident, Value: String);
var
sTmp : string;
begin
sTmp := Value;
sTmp := ReplaceInString(sTmp, Chr(10), '<#LF#>');
sTmp := ReplaceInString(sTmp, Chr(13), '<#CR#>');
inherited WriteString(Section, Ident, sTmp);
end;
procedure TST_Inifile.ReadSectionValues(const Section: string; Strings: TStrings);
var
i : integer;
begin
inherited ReadSectionValues(Section, Strings);
Strings.BeginUpdate;
for i := 0 to (Strings.Count - 1) do begin
Strings[i] := ReplaceInString(Strings[i], '<#LF#>', Chr(10));
Strings[i] := ReplaceInString(Strings[i], '<#CR#>', Chr(13));
end;
Strings.EndUpdate;
end;
end.