source: oup/releases/0.31a/Unit10_leveldb.pas@ 1043

Last change on this file since 1043 was 34, checked in by alloc, 18 years ago
File size: 28.9 KB
RevLine 
[34]1UNIT Unit10_leveldb;
2INTERFACE
3USES
4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
5 Dialogs, ComCtrls, StdCtrls, StrUtils;
6
7TYPE
8 TForm10 = Class(TForm)
9 group_progress: TGroupBox;
10 progress: TProgressBar;
11 lbl_progress: TLabel;
12 btn_abortok: TButton;
13 lbl_estimation: TLabel;
14 PROCEDURE btn_abortokClick(Sender: TObject);
15 PRIVATE
16 PROCEDURE HandleFile(ext:String; fileid:LongWord; dir_dat2db:Boolean);
17 PROCEDURE stop_convert;
18 PUBLIC
19 PROCEDURE CreateDatabase(source,target:String);
20 PROCEDURE CreateLevel(source,target:String);
21 END;
22
23
24VAR
25 Form10: TForm10;
26
27IMPLEMENTATION
28{$R *.dfm}
29USES ABSMain, ABSDecUtil, Unit1_main, Unit2_functions, Unit3_data, Unit9_data_structures, Unit15_Classes;
30
31TYPE
32 THandler=PROCEDURE(fileid:LongWord; dir_dat2db:Boolean);
33 TConvertHandlers=RECORD
34 Ext:String[4];
35 needed:Boolean;
36 Handler:THandler;
37 END;
38VAR
39 ConvertHandlers:Array OF TConvertHandlers;
40 loaded_filename:String;
41 converting:Boolean=False;
42 abort:Boolean=False;
43 DataBase:TABSDatabase;
44 Query:TABSQuery;
45 MimeCoder: TStringFormat_MIME64;
46
47PROCEDURE TForm10.HandleFile;
48 VAR
49 i:Byte;
50 BEGIN
51 FOR i:=1 TO Length(ConvertHandlers) DO
52 IF UpperCase(ConvertHandlers[i].Ext)=UpperCase(ext) THEN
53 IF ConvertHandlers[i].needed THEN BEGIN
54 ConvertHandlers[i].Handler(fileid, dir_dat2db);
55 Break;
56 END ELSE
57 Break;
58 END;
59
60PROCEDURE TForm10.CreateLevel(source,target:String);
61 VAR
62 i:LongWord;
63 BEGIN
64 END;
65
66PROCEDURE TForm10.CreateDatabase(source,target:String);
67 VAR
68 i,j:LongWord;
69 temps,temps2:String;
70 data:Tdata;
71 absolutebegintime,begintime:Double;
72 step:Byte;
73 rawlist:TRawList;
74 extlist:TExtensionsMap;
75 fileinfo:TFileInfo;
76 CONST
77 steps:Byte=4;
78 PROCEDURE DoStep(stepname:String);
79 BEGIN
80 Inc(step);
81 IF stepname<>'FIN' THEN
82 group_progress.Caption:='Creating DB (Step '+IntToStr(step)+'/'+IntToStr(steps)+': '+stepname+')'
83 ELSE
84 group_progress.Caption:='Creating DB (FINISHED)';
85 END;
86 BEGIN
87 IF NOT CreateDataConnection(source,ODB_Dat) THEN BEGIN
88 ShowMessage('Could not connect to .dat-file');
89 Exit;
90 END ELSE BEGIN
91 TOniDataDat(OniDataConnection).UnloadWhenUnused:=False;
92 END;
93
94 Form10.Visible:=True;
95 Form1.Visible:=False;
96 step:=0;
97 converting:=True;
98 abort:=False;
99 btn_abortok.Caption:='&Abort...';
100 btn_abortok.Default:=False;
101 loaded_filename:=target;
102
103 absolutebegintime:=Time;
104
105 DataBase:=TABSDatabase.Create(Self);
106 DataBase.DatabaseName:='OLDB';
107 DataBase.DatabaseFileName:=target;
108 DataBase.CreateDatabase;
109
110 DoStep('Creating tables');
111 progress.Position:=0;
112 lbl_progress.Caption:='';
113 lbl_estimation.Caption:='Estimated finishing time: unknown';
114 Application.ProcessMessages;
115
116 Query:=TABSQuery.Create(Self);
117 Query.DatabaseName:='OLDB';
118 Query.SQL.Text:='CREATE TABLE globals ( id AUTOINC PRIMARY KEY, name STRING(128), value STRING(128) );';
119 Query.ExecSQL;
120 Query.SQL.Text:='CREATE TABLE linkmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, target_id INTEGER );';
121 Query.ExecSQL;
122 Query.SQL.Text:='CREATE TABLE rawmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, size INTEGER, data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib );';
123// Query.SQL.Text:='CREATE TABLE rawmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
124 Query.ExecSQL;
125 Query.SQL.Text:='CREATE TABLE datfiles ( id INTEGER PRIMARY KEY, extension CHAR(4), name STRING(128), contenttype INTEGER, size INTEGER, data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib );';
126// Query.SQL.Text:='CREATE TABLE datfiles ( id INTEGER PRIMARY KEY, extension CHAR(4), name STRING(128), contenttype INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
127 Query.ExecSQL;
128 Query.SQL.Text:='CREATE TABLE extlist ( id AUTOINC PRIMARY KEY, ext CHAR(4), ident CHAR(16) );';
129 Query.ExecSQL;
130
131 Query.SQL.Text:='INSERT INTO globals (name,value) VALUES ("dbversion","'+dbversion+'");';
132 Query.ExecSQL;
133 SetLength(data,Length(OniDataConnection.LevelInfo.Ident));
134 FOR i:=0 TO High(OniDataConnection.LevelInfo.Ident) DO data[i]:=OniDataConnection.LevelInfo.Ident[i];
135 temps:=CreateHexString(data,True);
136 Query.SQL.Text:='INSERT INTO globals (name,value) VALUES ("ident","'+temps+'");';
137 Query.ExecSQL;
138 Query.SQL.Text:='INSERT INTO globals (name,value) VALUES ("lvl","'+IntToStr(OniDataConnection.LevelInfo.LevelNumber)+'");';
139 Query.ExecSQL;
140 IF OniDataConnection.OSisMAC THEN
141 Query.SQL.Text:='INSERT INTO globals (name,value) VALUES ("os","MAC");'
142 ELSE
143 Query.SQL.Text:='INSERT INTO globals (name,value) VALUES ("os","PC");';
144 Query.ExecSQL;
145
146 DoStep('Writing extensionslist');
147 progress.Max:=Length(OniDataConnection.GetExtensionsList);
148 Application.ProcessMessages;
149
150 extlist:=OniDataConnection.GetExtendedExtensionsList;
151 FOR i:=0 TO High(extlist) DO BEGIN
152 SetLength(data,Length(extlist[i].Ident));
153 FOR j:=0 TO High(extlist[i].Ident) DO data[j]:=extlist[i].Ident[j];
154 temps:=CreateHexString(data,True);
155 temps2:=extlist[i].Extension[3]+extlist[i].Extension[2]+extlist[i].Extension[1]+extlist[i].Extension[0];
156 Query.SQL.Text:='INSERT INTO extlist (ext,ident) VALUES ("'+temps2+'","'+temps+'");';
157 Query.ExecSQL;
158 progress.Position:=i;
159 lbl_progress.Caption:='Extensions done: '+IntToStr(i)+'/'+IntToStr(Length(extlist));
160 Application.ProcessMessages;
161 IF abort THEN BEGIN
162 stop_convert;
163 Exit;
164 END;
165 END;
166 lbl_progress.Caption:='';
167
168 progress.Position:=0;
169 lbl_progress.Caption:='Files done: '+IntToStr(0)+'/'+IntToStr(OniDataConnection.GetFilesCount);
170 lbl_estimation.Caption:='Estimated finishing time: unknown';
171
172 DoStep('Loading .dat into memory');
173 Application.ProcessMessages;
174
175 progress.Max:=OniDataConnection.GetFilesCount;
176 begintime:=Time;
177 DoStep('Writing .dat-fileslist');
178 Application.ProcessMessages;
179
180 Database.StartTransaction;
181 FOR i:=0 TO OniDataConnection.GetFilesCount-1 DO BEGIN
182 fileinfo:=OniDataConnection.GetFileInfo(i);
183 IF (fileinfo.FileType AND $02)=0 THEN BEGIN
184 mimecoder:=TStringFormat_MIME64.Create;
185 data:=OniDataConnection.LoadDatFile(i);
186 Query.SQL.Text:='INSERT INTO datfiles (id,extension,name,contenttype,size,data) VALUES ('+IntToStr(i)+',"'+fileinfo.Extension+'","'+fileinfo.Name+'","'+IntToHex(fileinfo.FileType,8)+'",'+IntToStr(fileinfo.Size)+',MimeToBin("'+MimeCoder.StrTo(@data[0], Length(data))+'") );';
187 Query.ExecSQL;
188 mimecoder.Free;
189
190 rawlist:=OniDataConnection.GetRawList(i);
191 IF Length(rawlist)>0 THEN BEGIN
192 FOR j:=0 TO High(rawlist) DO BEGIN
193 IF rawlist[j].raw_size>0 THEN BEGIN
194 SetLength(data, rawlist[j].raw_size);
195 OniDataConnection.LoadRawFile(i,rawlist[j].src_offset,data);
196 mimecoder:=TStringFormat_MIME64.Create;
197 Query.SQL.Text:='INSERT INTO rawmap (src_id,src_link_offset,size,data) VALUES ('+IntToStr(i)+','+IntToStr(rawlist[j].src_offset)+','+IntToStr(rawlist[j].raw_size)+',MimeToBin("'+MimeCoder.StrTo(@data[0], rawlist[j].raw_size)+'") );';
198 Query.ExecSQL;
199 mimecoder.Free;
200 END ELSE BEGIN
201 Query.SQL.Text:='INSERT INTO rawmap (src_id,src_link_offset,size) VALUES ('+IntToStr(i)+','+IntToStr(rawlist[j].src_offset)+',0);';
202 Query.ExecSQL;
203 END;
204 END;
205 END;
206
207 HandleFile(fileinfo.Extension,i,True);
208 END ELSE BEGIN
209 Query.SQL.Text:='INSERT INTO datfiles (id,extension,name,contenttype,size) VALUES ('+IntToStr(i)+',"'+fileinfo.Extension+'","'+fileinfo.Name+'","'+IntToHex(fileinfo.FileType,8)+'",0);';
210 Query.ExecSQL;
211 END;
212 IF ( (i MOD 100)=0 ) AND (i>0) THEN BEGIN
213 Database.Commit(False);
214 Database.StartTransaction;
215 END;
216 IF ( (i MOD 25)=0 ) AND (i>=100) THEN
217 lbl_estimation.Caption:='Estimated finishing time: '+TimeToStr((Time-begintime)/i*progress.Max+begintime);
218 progress.Position:=i;
219 lbl_progress.Caption:='Files done: '+IntToStr(i)+'/'+IntToStr(progress.Max);
220 Application.ProcessMessages;
221 IF abort THEN BEGIN
222 stop_convert;
223 Exit;
224 END;
225 END;
226 Database.Commit(False);
227 progress.Position:=progress.Max;
228 lbl_progress.Caption:='Files done: '+IntToStr(progress.Max)+'/'+IntToStr(progress.Max);
229 lbl_estimation.Caption:='FINISHED (duration: '+TimeToStr(Time-absolutebegintime)+')';
230
231 DoStep('FIN');
232 btn_abortok.Caption:='&OK';
233 btn_abortok.Default:=True;
234
235 converting:=False;
236
237 database.Close;
238 database.Free;
239
240 CloseDataConnection;
241 END;
242
243PROCEDURE TForm10.stop_convert;
244 BEGIN
245 btn_abortok.Caption:='&Close';
246 btn_abortok.Default:=True;
247 converting:=False;
248 lbl_estimation.Caption:='ABORTED';
249 group_progress.Caption:='Creating DB (ABORTED)';
250 DataBase.Close;
251 IF MessageBox(Self.Handle, PChar('Delete the unfinished DB-file?'), PChar('Delete file?'), MB_YESNO)=IDYES THEN BEGIN
252 DeleteFile(loaded_filename);
253 END;
254 END;
255
256PROCEDURE TForm10.btn_abortokClick(Sender: TObject);
257 BEGIN
258 IF converting THEN BEGIN
259 IF MessageBox(Self.Handle, PChar('Do you really want to cancel the convert-progress?'), PChar('Warning: Converting'), MB_YESNO)=IDYES THEN
260 abort:=True;
261 END ELSE BEGIN
262 Form10.Visible:=False;
263 Form1.Visible:=True;
264 END;
265 END;
266
267PROCEDURE InsertDatLinkToDB(fileid:LongWord; offset:LongWord);
268 VAR
269 link:LongWord;
270 BEGIN
271 OniDataConnection.LoadDatFilePart(fileid,offset,4,@link);
272 IF link=0 THEN
273 link:=$FFFFFFFF
274 ELSE
275 link:=link DIV 256;
276 Query.SQL.Text:='INSERT INTO linkmap (src_id,src_link_offset,target_id) VALUES ('+IntToStr(fileid)+','+IntToStr(offset)+','+IntToStr(link)+');';
277 Query.ExecSQL;
278 END;
279(*
280PROCEDURE InsertRawFileToDB(fileid:LongWord; src_offset,raw_addr,size:LongWord);
281 VAR
282 localmem:TMemoryStream;
283// temps:String;
284 BEGIN
285 IF size>0 THEN BEGIN
286 localmem:=TMemoryStream.Create;
287 filestream:=TFileStream.Create(raw_filename,fmOpenRead);
288 filestream.Seek(raw_addr,soFromBeginning);
289 localmem.CopyFrom(filestream,size);
290 filestream.Free;
291 mimecoder:=TStringFormat_MIME64.Create;
292 Query.SQL.Text:='INSERT INTO rawmap (src_id,src_link_offset,size,data) VALUES ('+IntToStr(fileid)+','+IntToStr(src_offset)+','+IntToStr(size)+',MimeToBin("'+MimeCoder.StrTo(localmem.Memory, localmem.Size)+'") );';
293 Query.ExecSQL;
294 localmem.Free;
295 mimecoder.Free;
296 END ELSE BEGIN
297 Query.SQL.Text:='INSERT INTO rawmap (src_id,src_link_offset,size) VALUES ('+IntToStr(fileid)+','+IntToStr(src_offset)+',0);';
298 Query.ExecSQL;
299 END;
300{ IF (raw_addr MOD 32)>0 THEN BEGIN
301 temps:='FileID='+FormatNumber(fileid,5,'0')+' - dat-Offset=0x'+IntToHex(src_offset,8)+' - raw-address=0x'+IntToHex(raw_addr,8)+#13+#10;
302 filestream:=TFileStream.Create('D:\not32.txt',fmOpenReadWrite);
303 filestream.Seek(0,soFromEnd);
304 filestream.Write(temps[1],Length(temps));
305 filestream.Free;
306 END; }
307 END;
308*)
309
310
311PROCEDURE AKEV(fileid:LongWord; dir_dat2db:Boolean);
312 VAR
313 i:LongWord;
314 BEGIN
315 IF dir_dat2db THEN BEGIN
316 FOR i:=0 TO 16 DO InsertDatLinkToDB(fileid,$8+i*4);
317 END ELSE BEGIN
318 END;
319 END;
320PROCEDURE AKOT(fileid:LongWord; dir_dat2db:Boolean);
321 VAR
322 i:LongWord;
323 BEGIN
324 IF dir_dat2db THEN BEGIN
325 FOR i:=0 TO 4 DO InsertDatLinkToDB(fileid,$8+i*4);
326 END ELSE BEGIN
327 END;
328 END;
329PROCEDURE CBPI(fileid:LongWord; dir_dat2db:Boolean);
330 VAR
331 i:LongWord;
332 BEGIN
333 IF dir_dat2db THEN BEGIN
334 FOR i:=0 TO 56 DO InsertDatLinkToDB(fileid,$8+i*4);
335 END ELSE BEGIN
336 END;
337 END;
338PROCEDURE CBPM(fileid:LongWord; dir_dat2db:Boolean);
339 VAR
340 i:LongWord;
341 BEGIN
342 IF dir_dat2db THEN BEGIN
343 FOR i:=0 TO 18 DO InsertDatLinkToDB(fileid,$8+i*4);
344 END ELSE BEGIN
345 END;
346 END;
347PROCEDURE CONS(fileid:LongWord; dir_dat2db:Boolean);
348 VAR
349 i:LongWord;
350 BEGIN
351 IF dir_dat2db THEN BEGIN
352 FOR i:=0 TO 1 DO InsertDatLinkToDB(fileid,$24+i*4);
353 END ELSE BEGIN
354 END;
355 END;
356PROCEDURE CRSA(fileid:LongWord; dir_dat2db:Boolean);
357 VAR
358 packages:LongWord;
359 i:LongWord;
360 BEGIN
361 IF dir_dat2db THEN BEGIN
362 OniDataConnection.LoadDatFilePart(fileid,$14,4,@packages);
363 IF packages>0 THEN
364 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*1100+$A0);
365 END ELSE BEGIN
366 END;
367 END;
368PROCEDURE DOOR(fileid:LongWord; dir_dat2db:Boolean);
369 BEGIN
370 IF dir_dat2db THEN BEGIN
371 InsertDatLinkToDB(fileid,$08);
372 InsertDatLinkToDB(fileid,$10);
373 END ELSE BEGIN
374 END;
375 END;
376PROCEDURE DPGE(fileid:LongWord; dir_dat2db:Boolean);
377 BEGIN
378 IF dir_dat2db THEN BEGIN
379 InsertDatLinkToDB(fileid,$40);
380 END ELSE BEGIN
381 END;
382 END;
383PROCEDURE HPGE(fileid:LongWord; dir_dat2db:Boolean);
384 BEGIN
385 IF dir_dat2db THEN BEGIN
386 InsertDatLinkToDB(fileid,$0C);
387 END ELSE BEGIN
388 END;
389 END;
390PROCEDURE IGHH(fileid:LongWord; dir_dat2db:Boolean);
391 BEGIN
392 IF dir_dat2db THEN BEGIN
393 InsertDatLinkToDB(fileid,$24);
394 InsertDatLinkToDB(fileid,$28);
395 END ELSE BEGIN
396 END;
397 END;
398PROCEDURE IGPA(fileid:LongWord; dir_dat2db:Boolean);
399 VAR
400 links:LongWord;
401 i:LongWord;
402 BEGIN
403 IF dir_dat2db THEN BEGIN
404 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@links);
405 IF links>0 THEN
406 FOR i:=0 TO links-1 DO InsertDatLinkToDB(fileid,$20+i*4);
407 END ELSE BEGIN
408 END;
409 END;
410PROCEDURE IGPG(fileid:LongWord; dir_dat2db:Boolean);
411 VAR
412 i:LongWord;
413 BEGIN
414 IF dir_dat2db THEN BEGIN
415 FOR i:=0 TO 1 DO InsertDatLinkToDB(fileid,$1C+i*4);
416 END ELSE BEGIN
417 END;
418 END;
419PROCEDURE IGSA(fileid:LongWord; dir_dat2db:Boolean);
420 VAR
421 links:LongWord;
422 i:LongWord;
423 BEGIN
424 IF dir_dat2db THEN BEGIN
425 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@links);
426 IF links>0 THEN
427 FOR i:=0 TO links-1 DO InsertDatLinkToDB(fileid,$20+i*4);
428 END ELSE BEGIN
429 END;
430 END;
431PROCEDURE IMPT(fileid:LongWord; dir_dat2db:Boolean);
432 BEGIN
433 IF dir_dat2db THEN BEGIN
434 InsertDatLinkToDB(fileid,$10);
435 END ELSE BEGIN
436 END;
437 END;
438PROCEDURE IPGE(fileid:LongWord; dir_dat2db:Boolean);
439 BEGIN
440 IF dir_dat2db THEN BEGIN
441 InsertDatLinkToDB(fileid,$0C);
442 END ELSE BEGIN
443 END;
444 END;
445PROCEDURE KEYI(fileid:LongWord; dir_dat2db:Boolean);
446 VAR
447 i:LongWord;
448 BEGIN
449 IF dir_dat2db THEN BEGIN
450 FOR i:=0 TO 9 DO InsertDatLinkToDB(fileid,$08+i*4);
451 END ELSE BEGIN
452 END;
453 END;
454PROCEDURE M3GA(fileid:LongWord; dir_dat2db:Boolean);
455 VAR
456 links:LongWord;
457 i:LongWord;
458 BEGIN
459 IF dir_dat2db THEN BEGIN
460 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@links);
461 IF links>0 THEN
462 FOR i:=0 TO links-1 DO InsertDatLinkToDB(fileid,$20+i*4);
463 END ELSE BEGIN
464 END;
465 END;
466PROCEDURE M3GM(fileid:LongWord; dir_dat2db:Boolean);
467 VAR
468 i:LongWord;
469 BEGIN
470 IF dir_dat2db THEN BEGIN
471 FOR i:=0 TO 6 DO InsertDatLinkToDB(fileid,$0C+i*4);
472 END ELSE BEGIN
473 END;
474 END;
475PROCEDURE MTRL(fileid:LongWord; dir_dat2db:Boolean);
476 BEGIN
477 IF dir_dat2db THEN BEGIN
478 InsertDatLinkToDB(fileid,$10);
479 END ELSE BEGIN
480 END;
481 END;
482PROCEDURE OBOA(fileid:LongWord; dir_dat2db:Boolean);
483 VAR
484 packages:Word;
485 i:LongWord;
486 BEGIN
487 IF dir_dat2db THEN BEGIN
488 OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
489 IF packages>0 THEN
490 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*240);
491 END ELSE BEGIN
492 END;
493 END;
494PROCEDURE OFGA(fileid:LongWord; dir_dat2db:Boolean);
495 VAR
496 packages:LongWord;
497 i:LongWord;
498 BEGIN
499 IF dir_dat2db THEN BEGIN
500 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
501 IF packages>0 THEN
502 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*12+$04);
503 END ELSE BEGIN
504 END;
505 END;
506PROCEDURE ONCC(fileid:LongWord; dir_dat2db:Boolean);
507 VAR
508 i:LongWord;
509 BEGIN
510 IF dir_dat2db THEN BEGIN
511 END ELSE BEGIN
512 END;
513 END;
514PROCEDURE ONCV(fileid:LongWord; dir_dat2db:Boolean);
515 BEGIN
516 IF dir_dat2db THEN BEGIN
517 InsertDatLinkToDB(fileid,$08);
518 END ELSE BEGIN
519 END;
520 END;
521PROCEDURE ONLV(fileid:LongWord; dir_dat2db:Boolean);
522 VAR
523 i:LongWord;
524 BEGIN
525 IF dir_dat2db THEN BEGIN
526 FOR i:=0 TO 5 DO InsertDatLinkToDB(fileid,$48+i*4);
527 FOR i:=0 TO 5 DO InsertDatLinkToDB(fileid,$64+i*4);
528 InsertDatLinkToDB(fileid,$300);
529 END ELSE BEGIN
530 END;
531 END;
532PROCEDURE ONOA(fileid:LongWord; dir_dat2db:Boolean);
533 VAR
534 packages:LongWord;
535 i:LongWord;
536 BEGIN
537 IF dir_dat2db THEN BEGIN
538 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
539 IF packages>0 THEN
540 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*8+$04);
541 END ELSE BEGIN
542 END;
543 END;
544PROCEDURE ONSK(fileid:LongWord; dir_dat2db:Boolean);
545 BEGIN
546 IF dir_dat2db THEN BEGIN
547 InsertDatLinkToDB(fileid,$08);
548 InsertDatLinkToDB(fileid,$0C);
549 InsertDatLinkToDB(fileid,$10);
550 InsertDatLinkToDB(fileid,$14);
551 InsertDatLinkToDB(fileid,$18);
552 InsertDatLinkToDB(fileid,$20);
553 InsertDatLinkToDB(fileid,$44);
554 END ELSE BEGIN
555 END;
556 END;
557PROCEDURE ONVL(fileid:LongWord; dir_dat2db:Boolean);
558 VAR
559 packages:LongWord;
560 i:LongWord;
561 BEGIN
562 IF dir_dat2db THEN BEGIN
563 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
564 IF packages>0 THEN
565 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
566 END ELSE BEGIN
567 END;
568 END;
569PROCEDURE ONWC(fileid:LongWord; dir_dat2db:Boolean);
570 BEGIN
571 IF dir_dat2db THEN BEGIN
572 InsertDatLinkToDB(fileid,$28);
573 InsertDatLinkToDB(fileid,$34);
574 InsertDatLinkToDB(fileid,$54);
575 InsertDatLinkToDB(fileid,$58);
576 InsertDatLinkToDB(fileid,$5C);
577 InsertDatLinkToDB(fileid,$60);
578 InsertDatLinkToDB(fileid,$6FC);
579 InsertDatLinkToDB(fileid,$700);
580 END ELSE BEGIN
581 END;
582 END;
583PROCEDURE OPGE(fileid:LongWord; dir_dat2db:Boolean);
584 BEGIN
585 IF dir_dat2db THEN BEGIN
586 InsertDatLinkToDB(fileid,$1C);
587 END ELSE BEGIN
588 END;
589 END;
590PROCEDURE PSPC(fileid:LongWord; dir_dat2db:Boolean);
591 BEGIN
592 IF dir_dat2db THEN BEGIN
593 InsertDatLinkToDB(fileid,$50);
594 END ELSE BEGIN
595 END;
596 END;
597PROCEDURE PSPL(fileid:LongWord; dir_dat2db:Boolean);
598 VAR
599 packages:LongWord;
600 i:LongWord;
601 BEGIN
602 IF dir_dat2db THEN BEGIN
603 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
604 IF packages>0 THEN
605 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$24+i*8);
606 END ELSE BEGIN
607 END;
608 END;
609PROCEDURE PSUI(fileid:LongWord; dir_dat2db:Boolean);
610 VAR
611 i:LongWord;
612 BEGIN
613 IF dir_dat2db THEN BEGIN
614 FOR i:=0 TO 43 DO InsertDatLinkToDB(fileid,$08+i*4);
615 END ELSE BEGIN
616 END;
617 END;
618PROCEDURE STNA(fileid:LongWord; dir_dat2db:Boolean);
619 VAR
620 packages:Word;
621 i:LongWord;
622 BEGIN
623 IF dir_dat2db THEN BEGIN
624 OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
625 IF packages>0 THEN
626 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
627 END ELSE BEGIN
628 END;
629 END;
630PROCEDURE TRAC(fileid:LongWord; dir_dat2db:Boolean);
631 VAR
632 packages:Word;
633 i:LongWord;
634 BEGIN
635 IF dir_dat2db THEN BEGIN
636 InsertDatLinkToDB(fileid,$18);
637 OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
638 IF packages>0 THEN
639 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*12+8);
640 END ELSE BEGIN
641 END;
642 END;
643PROCEDURE TRAM(fileid:LongWord; dir_dat2db:Boolean);
644 BEGIN
645 IF dir_dat2db THEN BEGIN
646 InsertDatLinkToDB(fileid,$40);
647 InsertDatLinkToDB(fileid,$44);
648 END ELSE BEGIN
649 END;
650 END;
651PROCEDURE TRAS(fileid:LongWord; dir_dat2db:Boolean);
652 BEGIN
653 IF dir_dat2db THEN BEGIN
654 InsertDatLinkToDB(fileid,$08);
655 END ELSE BEGIN
656 END;
657 END;
658PROCEDURE TRBS(fileid:LongWord; dir_dat2db:Boolean);
659 VAR
660 i:LongWord;
661 BEGIN
662 IF dir_dat2db THEN BEGIN
663 FOR i:=0 TO 4 DO InsertDatLinkToDB(fileid,$08+i*4);
664 END ELSE BEGIN
665 END;
666 END;
667PROCEDURE TRCM(fileid:LongWord; dir_dat2db:Boolean);
668 VAR
669 i:LongWord;
670 BEGIN
671 IF dir_dat2db THEN BEGIN
672 FOR i:=0 TO 2 DO InsertDatLinkToDB(fileid,$5C+i*4);
673 END ELSE BEGIN
674 END;
675 END;
676PROCEDURE TRGA(fileid:LongWord; dir_dat2db:Boolean);
677 VAR
678 i:LongWord;
679 packages:Word;
680 BEGIN
681 IF dir_dat2db THEN BEGIN
682 OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
683 IF packages>0 THEN
684 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
685 END ELSE BEGIN
686 END;
687 END;
688PROCEDURE TRGE(fileid:LongWord; dir_dat2db:Boolean);
689 BEGIN
690 IF dir_dat2db THEN BEGIN
691 InsertDatLinkToDB(fileid,$20);
692 END ELSE BEGIN
693 END;
694 END;
695PROCEDURE TRIG(fileid:LongWord; dir_dat2db:Boolean);
696 BEGIN
697 IF dir_dat2db THEN BEGIN
698 InsertDatLinkToDB(fileid,$18);
699 InsertDatLinkToDB(fileid,$24);
700 InsertDatLinkToDB(fileid,$28);
701 END ELSE BEGIN
702 END;
703 END;
704PROCEDURE TRMA(fileid:LongWord; dir_dat2db:Boolean);
705 VAR
706 i:LongWord;
707 packages:Word;
708 BEGIN
709 IF dir_dat2db THEN BEGIN
710 OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
711 IF packages>0 THEN
712 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
713 END ELSE BEGIN
714 END;
715 END;
716PROCEDURE TRSC(fileid:LongWord; dir_dat2db:Boolean);
717 VAR
718 i:LongWord;
719 packages:Word;
720 BEGIN
721 IF dir_dat2db THEN BEGIN
722 OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
723 IF packages>0 THEN
724 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
725 END ELSE BEGIN
726 END;
727 END;
728PROCEDURE TSFF(fileid:LongWord; dir_dat2db:Boolean);
729 VAR
730 i:LongWord;
731 packages:LongWord;
732 BEGIN
733 IF dir_dat2db THEN BEGIN
734 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
735 IF packages>0 THEN
736 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
737 END ELSE BEGIN
738 END;
739 END;
740PROCEDURE TSFT(fileid:LongWord; dir_dat2db:Boolean);
741 BEGIN
742 IF dir_dat2db THEN BEGIN
743 InsertDatLinkToDB(fileid,$1C);
744 END ELSE BEGIN
745 END;
746 END;
747PROCEDURE TURR(fileid:LongWord; dir_dat2db:Boolean);
748 BEGIN
749 IF dir_dat2db THEN BEGIN
750 InsertDatLinkToDB(fileid,$60);
751 InsertDatLinkToDB(fileid,$6C);
752 InsertDatLinkToDB(fileid,$74);
753 END ELSE BEGIN
754 END;
755 END;
756PROCEDURE TXAN(fileid:LongWord; dir_dat2db:Boolean);
757 VAR
758 i:LongWord;
759 packages:LongWord;
760 BEGIN
761 IF dir_dat2db THEN BEGIN
762 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
763 IF packages>0 THEN
764 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
765 END ELSE BEGIN
766 END;
767 END;
768PROCEDURE TXMA(fileid:LongWord; dir_dat2db:Boolean);
769 VAR
770 i:LongWord;
771 packages:LongWord;
772 BEGIN
773 IF dir_dat2db THEN BEGIN
774 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
775 IF packages>0 THEN
776 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
777 END ELSE BEGIN
778 END;
779 END;
780PROCEDURE TXMB(fileid:LongWord; dir_dat2db:Boolean);
781 VAR
782 i:LongWord;
783 packages:LongWord;
784 BEGIN
785 IF dir_dat2db THEN BEGIN
786 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
787 IF packages>0 THEN
788 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
789 END ELSE BEGIN
790 END;
791 END;
792PROCEDURE TXMP(fileid:LongWord; dir_dat2db:Boolean);
793 BEGIN
794 IF dir_dat2db THEN BEGIN
795 InsertDatLinkToDB(fileid,$94);
796 InsertDatLinkToDB(fileid,$98);
797 END ELSE BEGIN
798 END;
799 END;
800PROCEDURE TXTC(fileid:LongWord; dir_dat2db:Boolean);
801 BEGIN
802 IF dir_dat2db THEN BEGIN
803 InsertDatLinkToDB(fileid,$08);
804 END ELSE BEGIN
805 END;
806 END;
807PROCEDURE WMCL(fileid:LongWord; dir_dat2db:Boolean);
808 BEGIN
809 IF dir_dat2db THEN BEGIN
810 InsertDatLinkToDB(fileid,$24);
811 END ELSE BEGIN
812 END;
813 END;
814PROCEDURE WMMB(fileid:LongWord; dir_dat2db:Boolean);
815 VAR
816 i:LongWord;
817 packages:LongWord;
818 BEGIN
819 IF dir_dat2db THEN BEGIN
820 OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
821 IF packages>0 THEN
822 FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
823 END ELSE BEGIN
824 END;
825 END;
826PROCEDURE WPGE(fileid:LongWord; dir_dat2db:Boolean);
827 BEGIN
828 IF dir_dat2db THEN BEGIN
829 InsertDatLinkToDB(fileid,$08);
830 InsertDatLinkToDB(fileid,$0C);
831 END ELSE BEGIN
832 END;
833 END;
834
835PROCEDURE InsertHandler(ext:String; needed:Boolean; handler:THandler);
836 BEGIN
837 SetLength(ConvertHandlers,Length(ConvertHandlers)+1);
838 ConvertHandlers[High(ConvertHandlers)].Ext:=ext;
839 ConvertHandlers[High(ConvertHandlers)].needed:=needed;
840 ConvertHandlers[High(ConvertHandlers)].handler:=handler;
841 END;
842
843BEGIN
844 InsertHandler('ABNA',False,NIL);
845// InsertHandler('AGDB',True,AGDB);
846 InsertHandler('AGDB',False,NIL);
847 InsertHandler('AGQC',False,NIL);
848 InsertHandler('AGQG',False,NIL);
849 InsertHandler('AGQR',False,NIL);
850 InsertHandler('AISA',False,NIL);
851 InsertHandler('AITR',False,NIL);
852 InsertHandler('AKAA',False,NIL);
853 InsertHandler('AKBA',False,NIL);
854 InsertHandler('AKBP',False,NIL);
855 InsertHandler('AKDA',False,NIL);
856 InsertHandler('AKEV',True,AKEV);
857 InsertHandler('AKOT',True,AKOT);
858 InsertHandler('AKVA',False,NIL);
859 InsertHandler('BINA',False,NIL);
860 InsertHandler('CBPI',True,CBPI);
861 InsertHandler('CBPM',True,CBPM);
862 InsertHandler('CONS',True,CONS);
863 InsertHandler('CRSA',True,CRSA);
864 InsertHandler('DOOR',True,DOOR);
865 InsertHandler('DPGE',True,DPGE);
866 InsertHandler('ENVP',False,NIL);
867 InsertHandler('FILM',False,NIL);
868 InsertHandler('HPGE',True,HPGE);
869 InsertHandler('IDXA',False,NIL);
870 InsertHandler('IGHH',True,IGHH);
871 InsertHandler('IGPA',True,IGPA);
872 InsertHandler('IGPG',True,IGPG);
873 InsertHandler('IGSA',True,IGSA);
874 InsertHandler('IMPT',True,IMPT);
875 InsertHandler('IPGE',True,IPGE);
876 InsertHandler('KEYI',True,KEYI);
877 InsertHandler('M3GA',True,M3GA);
878 InsertHandler('M3GM',True,M3GM);
879 InsertHandler('MTRL',True,MTRL);
880 InsertHandler('OBAN',False,NIL);
881 InsertHandler('OBDC',False,NIL);
882 InsertHandler('OBOA',True,OBOA);
883 InsertHandler('OFGA',True,OFGA);
884 InsertHandler('ONCC',True,ONCC);
885 InsertHandler('ONCP',False,NIL);
886 InsertHandler('ONCV',True,ONCV);
887 InsertHandler('ONFA',False,NIL);
888 InsertHandler('ONGS',False,NIL);
889 InsertHandler('ONIA',False,NIL);
890 InsertHandler('ONLD',False,NIL);
891 InsertHandler('ONLV',True,ONLV);
892 InsertHandler('ONMA',False,NIL);
893 InsertHandler('ONOA',True,ONOA);
894 InsertHandler('ONSA',False,NIL);
895 InsertHandler('ONSK',True,ONSK);
896 InsertHandler('ONTA',False,NIL);
897 InsertHandler('ONVL',True,ONVL);
898 InsertHandler('ONWC',True,ONWC);
899 InsertHandler('OPGE',True,OPGE);
900 InsertHandler('OSBD',False,NIL);
901 InsertHandler('OTIT',False,NIL);
902 InsertHandler('OTLF',False,NIL);
903 InsertHandler('PLEA',False,NIL);
904 InsertHandler('PNTA',False,NIL);
905 InsertHandler('PSPC',True,PSPC);
906 InsertHandler('PSPL',True,PSPL);
907 InsertHandler('PSUI',True,PSUI);
908 InsertHandler('QTNA',False,NIL);
909 InsertHandler('SNDD',False,NIL);
910 InsertHandler('STNA',True,STNA);
911 InsertHandler('SUBT',False,NIL);
912 InsertHandler('TRAC',True,TRAC);
913 InsertHandler('TRAM',True,TRAM);
914 InsertHandler('TRAS',True,TRAS);
915 InsertHandler('TRBS',True,TRBS);
916 InsertHandler('TRCM',True,TRCM);
917 InsertHandler('TRGA',True,TRGA);
918 InsertHandler('TRGE',True,TRGE);
919 InsertHandler('TRIA',False,NIL);
920 InsertHandler('TRIG',True,TRIG);
921 InsertHandler('TRMA',True,TRMA);
922 InsertHandler('TRSC',True,TRSC);
923 InsertHandler('TRTA',False,NIL);
924 InsertHandler('TSFF',True,TSFF);
925 InsertHandler('TSFL',False,NIL);
926 InsertHandler('TSFT',True,TSFT);
927 InsertHandler('TSGA',False,NIL);
928 InsertHandler('TSTR',False,NIL);
929 InsertHandler('TURR',True,TURR);
930 InsertHandler('TXAN',True,TXAN);
931 InsertHandler('TXCA',False,NIL);
932 InsertHandler('TXMA',True,TXMA);
933 InsertHandler('TXMB',True,TXMB);
934 InsertHandler('TXMP',True,TXMP);
935 InsertHandler('TXTC',True,TXTC);
936 InsertHandler('VCRA',False,NIL);
937 InsertHandler('WMCL',True,WMCL);
938 InsertHandler('WMDD',False,NIL);
939 InsertHandler('WMM_',False,NIL);
940 InsertHandler('WMMB',True,WMMB);
941 InsertHandler('WPGE',True,WPGE);
942END.
Note: See TracBrowser for help on using the repository browser.