1 | program WowHosting;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | uses
|
---|
6 | {$IFDEF UNIX}{$IFDEF UseCThreads}
|
---|
7 | cthreads,
|
---|
8 | {$ENDIF}{$ENDIF}
|
---|
9 | Classes, SysUtils, CustApp
|
---|
10 | { you can add units after this };
|
---|
11 |
|
---|
12 | type
|
---|
13 |
|
---|
14 | { wowhosting }
|
---|
15 |
|
---|
16 | TWowHosting = class(TCustomApplication)
|
---|
17 | protected
|
---|
18 | procedure DoRun; override;
|
---|
19 | public
|
---|
20 | constructor Create(TheOwner: TComponent); override;
|
---|
21 | destructor Destroy; override;
|
---|
22 | procedure WriteHelp; virtual;
|
---|
23 | end;
|
---|
24 |
|
---|
25 | { wowhosting }
|
---|
26 |
|
---|
27 | procedure TWowHosting.DoRun;
|
---|
28 | var
|
---|
29 | ErrorMsg: String;
|
---|
30 | begin
|
---|
31 | // Quick check parameters
|
---|
32 | ErrorMsg := CheckOptions('h', 'help');
|
---|
33 | if ErrorMsg <> '' then begin
|
---|
34 | ShowException(Exception.Create(ErrorMsg));
|
---|
35 | Terminate;
|
---|
36 | Exit;
|
---|
37 | end;
|
---|
38 |
|
---|
39 | // parse parameters
|
---|
40 | if HasOption('h', 'help') then begin
|
---|
41 | WriteHelp;
|
---|
42 | Terminate;
|
---|
43 | Exit;
|
---|
44 | end;
|
---|
45 |
|
---|
46 | { add your program here }
|
---|
47 |
|
---|
48 | // stop program loop
|
---|
49 | Terminate;
|
---|
50 | end;
|
---|
51 |
|
---|
52 | constructor TWowHosting.Create(TheOwner: TComponent);
|
---|
53 | begin
|
---|
54 | inherited Create(TheOwner);
|
---|
55 | StopOnException := True;
|
---|
56 | end;
|
---|
57 |
|
---|
58 | destructor TWowHosting.Destroy;
|
---|
59 | begin
|
---|
60 | inherited Destroy;
|
---|
61 | end;
|
---|
62 |
|
---|
63 | procedure TWowHosting.WriteHelp;
|
---|
64 | begin
|
---|
65 | { add your help code here }
|
---|
66 | writeln('Usage: ', ExeName,' -h');
|
---|
67 | end;
|
---|
68 |
|
---|
69 | var
|
---|
70 | Application: TWowHosting;
|
---|
71 |
|
---|
72 | {$IFDEF WINDOWS}{$R wowhosting.rc}{$ENDIF}
|
---|
73 |
|
---|
74 | begin
|
---|
75 | Application := TWowHosting.Create(nil);
|
---|
76 | Application.Title :='WoW hosting';
|
---|
77 | Application.Run;
|
---|
78 | Application.Free;
|
---|
79 | end.
|
---|
80 |
|
---|