-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsing_box_drover.dpr
More file actions
72 lines (61 loc) · 1.61 KB
/
Copy pathsing_box_drover.dpr
File metadata and controls
72 lines (61 loc) · 1.61 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
program sing_box_drover;
{$R *.dres}
uses
Winapi.Windows,
Winapi.Messages,
System.SysUtils,
Vcl.Forms,
Main in 'Main.pas' {frmMain},
SystemProxy in 'SystemProxy.pas',
Drover in 'Drover.pas',
Options in 'Options.pas',
JsonUtils in 'JsonUtils.pas',
CoreSupervisor in 'CoreSupervisor.pas',
Logger in 'Logger.pas',
AppArgs in 'AppArgs.pas',
AppElevation in 'AppElevation.pas',
AppSingleInstance in 'AppSingleInstance.pas',
SingBoxConfig in 'SingBoxConfig.pas',
CoreApiClient in 'CoreApiClient.pas',
SingBoxBpf in 'SingBoxBpf.pas',
ConfigReader in 'ConfigReader.pas',
ConfigUpdater in 'ConfigUpdater.pas',
ElevatedTrayIcon in 'ElevatedTrayIcon.pas',
Autostart in 'Autostart.pas',
SingBoxCli in 'SingBoxCli.pas',
AppState in 'AppState.pas';
{$R *.res}
const
APP_TITLE = 'sing-box-drover';
var
Drover: TDrover;
flags: TAppFlags;
s: string;
begin
try
flags := GetAppFlags;
if not AcquireSingleInstance('SingBoxDrover_SingleInstance_Mutex', afRestart in flags) then
raise Exception.Create('Another instance of this application is already running.');
Drover := TDrover.Create(flags);
except
on E: Exception do
begin
s := E.Message;
if s = '' then
s := 'Unknown error.';
MessageBox(0, PChar(s), PChar(APP_TITLE), MB_ICONERROR);
exit;
end;
end;
Application.Initialize;
Application.Title := APP_TITLE;
Application.MainFormOnTaskbar := false;
Application.ShowMainForm := false;
Application.CreateForm(TfrmMain, frmMain);
frmMain.InitDrover(Drover);
try
Application.Run;
finally
FreeAndNil(Drover);
end;
end.