-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathTESTHAND.PAS
55 lines (45 loc) · 1.6 KB
/
TESTHAND.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
program testhand;
{test handler unit}
uses
support,
tdl_console,
tdl_config,
tdl_handlers;
var
_memavail:longint;
w:word;
th:PHandler;
s:string;
begin
_memavail:=memavail;
config:=new(pconfig,init('tdl.ini','distro'));
MsgConsole:=new(PMConsole,init('d:\projects\tdl\testhand.log'));
MsgConsole^.verboselog:=true;
Handlers:=new(PHandlers,init('d:\projects\tdl\distro\handlers.ini'));
if Handlers=nil then die('Handlers nil!');
writeln('---');
for w:=0 to Handlers^.count-1 do begin
th:=Handlers^.at(w);
with th^ do s:=extension+':'+template+':'+fullpath;
if length(s)>79 then byte(s[0]):=79;
writeln(s);
end;
Writeln('Handler exists for EXE: ',Handlers^.Exists('EXE')<>null);
Writeln('Handler exists for ZIP: ',Handlers^.Exists('ZIP')<>null);
Writeln('Handler exists for 123: ',Handlers^.Exists('123')<>null);
Handlers^.Handle('BAT','c:\temp\test.bat','c:\temp\');
Handlers^.Handle('IMG','c:\temp\image.img','c:\temp\');
{execute something}
Handlers^.Handle('COM','d:\projects\tdl\output\files\freeram.com','d:\projects\tdl\output\files\');
readln;
Handlers^.Handle('ZIP','d:\projects\tdl\output\files\pac-gal1.zip','c:\temp\testzip');
Handlers^.Handle('EXE','c:\temp\pac-gal1\pac-gal.exe','c:\temp\pac-gal1');
Handlers^.Handle('EXE','c:\utils\common\valet.exe','c:\utils\common\');
Handlers^.Handle('TXT','c:\autoexec.bat','c:\');
dispose(Handlers,done);
dispose(msgConsole,done);
dispose(config,done);
if _memavail<>memavail
then fatalerror(255,'Memory leak detected: '
+inttostr(_memavail-memavail)+' bytes unaccounted for');
end.