forked from AdriaanBoshoff/Rust-Server-Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uDataModule.pas
71 lines (55 loc) · 1.64 KB
/
uDataModule.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
unit uDataModule;
interface
uses
System.SysUtils, System.Classes, Vcl.Dialogs, IniFiles, Vcl.Menus,
System.ImageList, Vcl.ImgList, Vcl.Controls, FolderDialog, Tlhelp32;
type
TdmDataModule = class(TDataModule)
dlgOpensteamcmd: TOpenDialog;
imglst: TImageList;
fldrdlgautobackup: TFolderDialog;
procedure DataModuleCreate(Sender: TObject);
function LoadSettingString(Section, Name, Value: string): string;
procedure SaveSettingString(Section, Name, Value: string);
private
{ Private declarations }
public
//dsfsf
end;
var
dmDataModule: TdmDataModule;
ini_rsm_settings, ini_server_config, steamcmdpath, serveridentity, RSMdir: string;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
procedure TdmDataModule.DataModuleCreate(Sender: TObject);
begin
RSMdir := ExtractFileDir(ParamStr(0));
ini_rsm_settings := RSMdir + '\rsm-config.ini';
serveridentity := LoadSettingString('Application Settings', 'serveridentity', 'default');
ini_server_config := RSMdir + '\server\' + serveridentity + '\rsm-server-config.ini';
steamcmdpath := LoadSettingString('Application Settings', 'steamcmd', 'steamcmd\steamcmd.exe');
end;
function TdmDataModule.LoadSettingString(Section, Name, Value: string): string;
var
ini: TiniFile;
begin
ini := TIniFile.Create(ini_rsm_settings);
try
Result := ini.ReadString(Section, Name, Value);
finally
ini.Free;
end;
end;
procedure TdmDataModule.SaveSettingString(Section, Name, Value: string);
var
ini: TiniFile;
begin
ini := TIniFile.Create(ini_rsm_settings);
try
ini.WriteString(Section, Name, Value);
finally
ini.Free;
end;
end;
end.