Line | |
---|
1 | unit UConsoleApp;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | UConsole, UFileSystem, UTextScreen, UKeyboard;
|
---|
7 |
|
---|
8 | type
|
---|
9 | TConsoleApp = class
|
---|
10 | private
|
---|
11 | public
|
---|
12 | Console: TConsole;
|
---|
13 | Screen: TTextScreen;
|
---|
14 | Keyboard: TKeyboard;
|
---|
15 | function GetCurrentDirectory: TDirectory;
|
---|
16 | procedure Execute; virtual; abstract;
|
---|
17 | constructor Create;
|
---|
18 | destructor Destroy; override;
|
---|
19 | procedure KeyboardShowKey(Key: Char);
|
---|
20 | end;
|
---|
21 |
|
---|
22 | implementation
|
---|
23 |
|
---|
24 | { TConsoleApp }
|
---|
25 |
|
---|
26 | constructor TConsoleApp.Create;
|
---|
27 | begin
|
---|
28 | Console := TConsole.Create;
|
---|
29 | Screen := TTextScreen.Create;
|
---|
30 | Keyboard := TKeyboard.Create;
|
---|
31 | Keyboard.OnShowKey := KeyboardShowKey;
|
---|
32 | end;
|
---|
33 |
|
---|
34 | destructor TConsoleApp.Destroy;
|
---|
35 | begin
|
---|
36 | Keyboard.Free;
|
---|
37 | Screen.Free;
|
---|
38 | Console.Destroy;
|
---|
39 | inherited;
|
---|
40 | end;
|
---|
41 |
|
---|
42 | function TConsoleApp.GetCurrentDirectory: TDirectory;
|
---|
43 | begin
|
---|
44 |
|
---|
45 | end;
|
---|
46 |
|
---|
47 | procedure TConsoleApp.KeyboardShowKey(Key: Char);
|
---|
48 | begin
|
---|
49 | Screen.Write(Key);
|
---|
50 | end;
|
---|
51 |
|
---|
52 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.