-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathuServerIni.pas
More file actions
101 lines (80 loc) · 1.98 KB
/
uServerIni.pas
File metadata and controls
101 lines (80 loc) · 1.98 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
unit uServerIni;
interface
uses
IniFiles, SysUtils;
var
Ini: TIniFile;
function IniPort: Integer;
function IniDBPath: String;
function IniDBUser: String;
function IniDBPass: String;
function IniDBRole: String;
function IniSNUpdTO: Integer;
function IniLogOn: Boolean;
function IniLogRecv: Boolean;
function IniDTBin: Boolean;
function IniLogErrors: Boolean;
implementation
Const
TCP_SEC = 'TCP';
PORT_IDENT = 'PORT';
DB_SEC = 'DATABASE';
DBPATH_IDENT = 'PATH';
DBUSER_IDENT = 'USER';
DBPASS_IDENT = 'PASS';
DBROLE_IDENT = 'ROLE';
SNUPD_IDENT = 'SN_UPDATE_TIMEOUT';
LOG_SEG = 'LOGFILE';
LOG_ON_IDENT = 'LOG_ON';
LOG_RECV_IDENT = 'LOG_RECV';
LOG_DATE_BIN_IDENT = 'DATE_BIN';
LOG_ONLY_ERRORS = 'ONLY_ERRORS';
function IniDTBin: Boolean;
begin
Result := Ini.ReadBool(LOG_SEG, LOG_DATE_BIN_IDENT, False);
end;
function IniLogOn: Boolean;
begin
Result := Ini.ReadBool(LOG_SEG, LOG_ON_IDENT, True);
end;
function IniLogRecv: Boolean;
begin
Result := Ini.ReadBool(LOG_SEG, LOG_RECV_IDENT, True);
end;
function IniLogErrors: Boolean;
begin
Result := Ini.ReadBool(LOG_SEG, LOG_ONLY_ERRORS, True);
end;
function IniPort: Integer;
begin
Result := Ini.ReadInteger(TCP_SEC, PORT_IDENT, 8228);
end;
function IniDBPath: String;
begin
Result := Ini.ReadString(DB_SEC, DBPATH_IDENT, 'localhost:c:\Program Files\3C\3C.fdb');
end;
function IniDBUser: String;
begin
Result := Ini.ReadString(DB_SEC, DBUSER_IDENT, 'sysdba');
end;
function IniDBPass: String;
begin
Result := Ini.ReadString(DB_SEC, DBPASS_IDENT, 'masterkey');
end;
function IniDBRole: String;
begin
Result := Ini.ReadString(DB_SEC, DBROLE_IDENT, '');
end;
{
Âû÷èòàòü èíòåðâàë îáíîâëåíèÿ ñïèñêà ñåðèéíûõ íîìåðîâ â ñåêóíäàõ
0 - âû÷èòûâàòü ïðè êàæäîé àâòîðèçàöèè
Ïî óìîë÷àíèþ 600 - 1 ðàç â 10 ìèíóò}
function IniSNUpdTO: Integer;
begin
Result := Ini.ReadInteger(DB_SEC, SNUPD_IDENT, 600);
end;
initialization
Ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'TCPServer3C.ini');
finalization
Ini.Free;
end.