source: oup/current/Helper/LevelDB.pas@ 131

Last change on this file since 131 was 131, checked in by alloc, 18 years ago
File size: 43.0 KB
Line 
1unit LevelDB;
2interface
3uses
4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
5 Dialogs, ComCtrls, StdCtrls, StrUtils;
6
7type
8 TForm_LevelDB = 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: Integer);
17 procedure StopConvert;
18 public
19 procedure CreateDatabase(Source, Target: String);
20 procedure CreateLevel(Source, Target: String);
21 end;
22
23
24var
25 Form_LevelDB: TForm_LevelDB;
26
27implementation
28{$R *.dfm}
29uses ABSMain, ABSDecUtil, Main,
30 ConnectionManager, TypeDefs, DataAccess, OniImgClass, Data;
31
32type
33 THandler = procedure(FileID: Integer);
34 TConvertHandler = record
35 Ext: String[4];
36 Handler: THandler;
37 end;
38
39var
40 ConvertHandlers: array of TConvertHandler;
41// loaded_filename: String;
42 Converting: Boolean = False;
43 Abort: Boolean = False;
44
45
46function GetOpenMsg(msg: TStatusMessages): String;
47begin
48 case msg of
49 SM_AlreadyOpened: Result := 'File already opened.';
50 SM_FileNotFound: Result := 'File not found.';
51 SM_UnknownExtension: Result := 'Unknown extension.';
52 SM_IncompatibleFile: Result := 'Incompatible file format.';
53 SM_UnknownError: Result := 'Unknown error.';
54 end;
55end;
56
57
58procedure TForm_LevelDB.CreateLevel(Source, Target: String);
59var
60 DatHeader: THeader;
61 FilesHeader: TFilesMap;
62 NamedFilesHeader: TNamedFilesMap;
63 ExtensionsHeader: TExtensionsMap;
64
65 Stream_Body, Stream_Names: TMemoryStream;
66 Stream_Dat, Stream_Raw, Stream_Sep: TFileStream;
67
68// Data, rawdata: Tdata;
69 BeginTime, FileTime: Double;
70 Step: Integer;
71// rawlist: TRawDataList;
72// datlinks: TDatLinks;
73 OniImage: TOniImage;
74 LevelID: Integer;
75 TimeFormat: TFormatSettings;
76
77 ConID: Integer;
78 Connection: TDataAccess;
79 ConRepMsg: TStatusMessages;
80
81 FileID: Integer;
82
83 Strings: TStrings;
84 i, j: Integer;
85 temps: String;
86 tempi: Integer;
87 tempb: Byte;
88 FileInfo: TFileInfo;
89 DatLinks: TDatLinkList;
90 RawLinks: TRawDataList;
91
92 DatFileStream, RawFileStream: TMemoryStream;
93const
94 Steps: Byte = 3;
95
96
97 procedure DoStep(StepName: String);
98 begin
99 Inc(Step);
100 if StepName <> 'FIN' then
101 group_progress.Caption :=
102 'Creating Dat (Step ' + IntToStr(Step) + '/' + IntToStr(Steps) + ': ' + StepName + ')'
103 else
104 group_progress.Caption := 'Creating Dat (FINISHED)';
105 end;
106
107begin
108
109 //
110 // FILE EXISTS CHECK FÜR DAT/RAW/SEP!!!
111 //
112
113 TimeFormat.ShortTimeFormat := 'hh:nn:ss';
114 TimeFormat.LongTimeFormat := 'hh:nn:ss';
115 TimeFormat.TimeSeparator := ':';
116
117 ConID := ConManager.OpenConnection(Source, ConRepMsg);
118 if not (ConRepMsg in [SM_OK, SM_AlreadyOpened]) then
119 begin
120 ShowMessage('Source-file couldn''t be opened! Aborting' + CrLf + GetOpenMsg(ConRepMsg));
121 Exit;
122 end else
123 Connection := ConManager.Connection[ConID];
124
125 ConID := ConManager.FileOpened(Target);
126 if ConID >= 0 then
127 begin
128 if MessageBox(Self.Handle, PChar('Destination-file is opened, close it in ' +
129 'order to proceed conversion?'), PChar('Destination-file opened'),
130 MB_YESNO + MB_ICONQUESTION) = ID_YES then
131 begin
132 if Form_Main.CheckConnectionCloseable(ConID) then
133 if not ConManager.CloseConnection(ConID, ConRepMsg) then
134 begin
135 ShowMessage('Couldn''t close destination-file. Aborting');
136 Exit;
137 end;
138 end else begin
139 ShowMessage('Aborting');
140 Exit;
141 end;
142 end;
143
144 if FileExists(Target) then
145 begin
146 if MessageBox(Self.Handle, PChar('Destination-file exists. ' +
147 'Overwrite it?'), PChar('Destination-file exists'),
148 MB_YESNO + MB_ICONWARNING) = ID_YES then
149 begin
150 if not DeleteFile(Target) then
151 begin
152 ShowMessage('Couldn''t delete file. Aborting');
153 Exit;
154 end;
155 if FileExists(AnsiReplaceStr(Target, '.dat', '.raw')) then
156 if not DeleteFile(AnsiReplaceStr(Target, '.dat', '.raw')) then
157 begin
158 ShowMessage('Couldn''t delete file. Aborting');
159 Exit;
160 end;
161 if FileExists(AnsiReplaceStr(Target, '.dat', '.sep')) then
162 if Connection.DataOS in [DOS_WINDEMO, DOS_MAC, DOS_MACBETA] then
163 if not DeleteFile(AnsiReplaceStr(Target, '.dat', '.sep')) then
164 begin
165 ShowMessage('Couldn''t delete file. Aborting');
166 Exit;
167 end;
168 end else begin
169 ShowMessage('Aborting');
170 Exit;
171 end;
172 end;
173
174 LevelID := Connection.LevelNumber;
175 LevelID := (LevelID * 2) * 256 * 256 * 256 + $01;
176 OniImage := TOniImage.Create;
177
178 Self.Visible := True;
179 Form_Main.Visible := False;
180 Step := 0;
181 Converting := True;
182 Abort := False;
183 btn_abortok.Caption := '&Abort...';
184 btn_abortok.Default := False;
185 BeginTime := Time;
186
187 Stream_Body := TMemoryStream.Create;
188 Stream_Names := TMemoryStream.Create;
189 Stream_Dat := TFileStream.Create(Target, fmCreate);
190 Stream_Raw := TFileStream.Create(AnsiReplaceStr(Target, '.dat', '.raw'), fmCreate);
191 if Connection.DataOS in [DOS_WINDEMO, DOS_MAC, DOS_MACBETA] then
192 Stream_Sep := TFileStream.Create(AnsiReplaceStr(Target, '.dat', '.sep'), fmCreate);
193
194 DoStep('Creating header');
195 progress.Position := 0;
196 lbl_progress.Caption := '';
197 lbl_estimation.Caption := 'Estimated finishing time: unknown';
198 Application.ProcessMessages;
199
200 SetLength(NamedFilesHeader, 0);
201 Strings := TStringList.Create;
202 Strings := Connection.GetFilesList('', '', False, ST_ExtNameAsc);
203 for i := 0 to Strings.Count - 1 do
204 begin
205 if MidStr(Strings.Strings[i],
206 Pos('-', Strings.Strings[i]) + 1,
207 Length(Strings.Strings[i]) -
208 Pos('.', ReverseString(Strings.Strings[i])) -
209 Pos('-', Strings.Strings[i])
210 ) <> '' then
211 begin
212 SetLength(NamedFilesHeader, Length(NamedFilesHeader) + 1);
213 NamedFilesHeader[High(NamedFilesHeader)].FileNumber := StrToInt(MidStr(Strings.Strings[i], 1, 5));
214 NamedFilesHeader[High(NamedFilesHeader)].blubb := 0;
215 end;
216 end;
217
218 for i := 0 to High(DatHeader.OSIdent) do
219 case Connection.DataOS of
220 DOS_WIN: DatHeader.OSIdent[i] := HeaderOSIdentWin[i];
221 DOS_MAC: DatHeader.OSIdent[i] := HeaderOSIdentMac[i];
222 DOS_MACBETA: DatHeader.OSIdent[i] := HeaderOSIdentMacBeta[i];
223 end;
224 for i := 0 to High(DatHeader.GlobalIdent) do
225 DatHeader.GlobalIdent[i] := HeaderGlobalIdent[i];
226 DatHeader.Files := Connection.GetFileCount;
227 DatHeader.NamedFiles := Length(NamedFilesHeader);
228
229 Strings := Connection.GetExtensionsList(EF_ExtCount);
230
231 DatHeader.Extensions := Strings.Count;
232 DatHeader.DataAddr := 0;
233 DatHeader.DataSize := 0;
234 DatHeader.NamesAddr := 0;
235 DatHeader.NamesSize := 0;
236 for i := 0 to High(DatHeader.Ident2) do
237 DatHeader.Ident2[i] := 0;
238 SetLength(FilesHeader, DatHeader.Files);
239 SetLength(ExtensionsHeader, DatHeader.Extensions);
240
241
242 DoStep('Writing extensions-header');
243 progress.Max := Strings.Count;
244 Application.ProcessMessages;
245 for i := 0 to Strings.Count - 1 do
246 begin
247 temps := Strings.Strings[i];
248 ExtensionsHeader[i].ExtCount := StrToInt( MidStr(
249 temps,
250 Pos('(', temps) + 1,
251 Pos(')', temps) - Pos('(', temps) - 1 ) );
252 temps := MidStr(temps, 1, 4);
253 for j := 0 to 3 do
254 ExtensionsHeader[i].Extension[j] := temps[4-j];
255 for j := 0 to High(FileTypes) do
256 if FileTypes[j].Extension = temps then
257 Break;
258 if j < Length(FileTypes) then
259 begin
260 case Connection.DataOS of
261 DOS_WIN: ExtensionsHeader[i].Ident := FileTypes[j].IdentWin;
262 DOS_WINDEMO: ExtensionsHeader[i].Ident := FileTypes[j].IdentMac;
263 DOS_MAC: ExtensionsHeader[i].Ident := FileTypes[j].IdentMac;
264 DOS_MACBETA: ExtensionsHeader[i].Ident := FileTypes[j].IdentMac;
265 end;
266 end else begin
267 ShowMessage('Unknown Extension: ' + Strings.Strings[i]);
268 Exit;
269 end;
270 progress.Position := i + 1;
271 lbl_progress.Caption := 'Extensions done: ' + IntToStr(i + 1) + '/' +
272 IntToStr(Strings.Count);
273 Application.ProcessMessages;
274 end;
275
276 DoStep('Storing files-data');
277 progress.Position := 0;
278 progress.Max := DatHeader.Files;
279 lbl_progress.Caption := '';
280 lbl_estimation.Caption := 'Estimated finishing time: unknown';
281 Application.ProcessMessages;
282
283 FileTime := Time;
284 for FileID := 0 to DatHeader.Files - 1 do
285 begin
286 FileInfo := Connection.GetFileInfo(FileID);
287 for j := 0 to 3 do
288 FilesHeader[FileID].Extension[j] := FileInfo.Extension[4 - j];
289 if FileInfo.Size > 0 then
290 begin
291 FilesHeader[FileID].DataAddr := Stream_Body.Size + 8;
292 DatFileStream := TMemoryStream.Create;
293 Connection.LoadDatFile(FileID, TStream(DatFileStream));
294 DatFileStream.Seek(4, soFromBeginning);
295 DatFileStream.Write(LevelID, 4);
296
297 DatLinks := Connection.GetDatLinks(FileID);
298 if Length(DatLinks) > 0 then
299 begin
300 for i := 0 to High(DatLinks) do
301 begin
302 DatFileStream.Seek(DatLinks[i].SrcOffset, soFromBeginning);
303 if DatLinks[i].DestID < 0 then
304 tempi := 0
305 else
306 tempi := DatLinks[i].DestID * 256 + 1;
307 DatFileStream.Write(tempi, 4);
308 end;
309 end;
310
311 RawLinks := Connection.GetRawList(FileID);
312 if Length(RawLinks) > 0 then
313 begin
314 for i := 0 to High(RawLinks) do
315 begin
316 if RawLinks[i].RawSize > 0 then
317 begin
318 RawFileStream := TMemoryStream.Create;
319 Connection.LoadRawFile(FileID, RawLinks[i].SrcOffset, TStream(RawFileStream));
320 RawFileStream.Seek(0, soFromBeginning);
321 if RawLinks[i].LocSep then
322 begin
323 RawLinks[i].RawAddr := Stream_Sep.Size;
324 Stream_sep.CopyFrom(RawFileStream, RawFileStream.Size);
325 end else begin
326 RawLinks[i].RawAddr := Stream_Raw.Size;
327 Stream_Raw.CopyFrom(RawFileStream, RawFileStream.Size);
328 end;
329 end else
330 RawLinks[i].RawAddr := 0;
331 DatFileStream.Seek(RawLinks[i].SrcOffset, soFromBeginning);
332 DatFileStream.Write(RawLinks[i].RawAddr, 4);
333 end;
334 end;
335 DatFileStream.Seek(0, soFromBeginning);
336 Stream_Body.CopyFrom(DatFileStream, DatFileStream.Size);
337 end
338 else
339 FilesHeader[i].DataAddr := 0;
340 if Length(fileinfo.Name) > 0 then
341 begin
342 FilesHeader[i].NameAddr := Stream_Names.Size;
343 temps := fileinfo.Extension + fileinfo.Name + Chr(0);
344 Stream_Names.Write(temps[1], Length(temps));
345 end
346 else
347 FilesHeader[i].NameAddr := 0;
348 FilesHeader[i].FileSize := fileinfo.Size;
349 FilesHeader[i].FileType := fileinfo.FileType;
350
351 if ((FileID mod 10) = 0) and (FileID >= 100) then
352 lbl_estimation.Caption := 'Estimated time left: ' + TimeToStr(
353 (Time - FileTime) / FileID * (progress.Max - FileID + 1) * 1.1, TimeFormat );
354 progress.Position := FileID + 1;
355 lbl_progress.Caption := 'Files done: ' + IntToStr(FileID + 1) + '/' + IntToStr(progress.Max);
356 Application.ProcessMessages;
357 end;
358
359 Stream_Dat.Write(DatHeader, SizeOf(DatHeader));
360 for i := 0 to High(FilesHeader) do
361 Stream_Dat.Write(FilesHeader[i], SizeOf(FilesHeader[i]));
362 for i := 0 to High(NamedFilesHeader) do
363 Stream_Dat.Write(NamedFilesHeader[i], SizeOf(NamedFilesHeader[i]));
364 for i := 0 to High(ExtensionsHeader) do
365 Stream_Dat.Write(ExtensionsHeader[i], SizeOf(ExtensionsHeader[i]));
366
367 DatHeader.DataSize := Stream_Body.Size;
368 DatHeader.NamesSize := Stream_Names.Size;
369 DatHeader.DataAddr := Stream_Dat.Size;
370 Stream_Body.Seek(0, soFromBeginning);
371 Stream_Dat.CopyFrom(Stream_Body, Stream_Body.Size);
372 DatHeader.NamesAddr := Stream_Dat.Size;
373 Stream_Names.Seek(0, soFromBeginning);
374 Stream_Dat.CopyFrom(Stream_Names, Stream_Names.Size);
375
376 Stream_Dat.Seek(0, soFromBeginning);
377 Stream_Dat.Write(DatHeader, SizeOf(DatHeader));
378
379 Stream_Dat.Free;
380 Stream_Body.Free;
381 Stream_Names.Free;
382 Stream_Raw.Free;
383
384 if Connection.DataOS in [DOS_WINDEMO, DOS_MAC, DOS_MACBETA] then
385 Stream_Sep.Free;
386
387 progress.Position := progress.Max;
388 lbl_progress.Caption := 'Files done: ' + IntToStr(progress.Max) + '/' +
389 IntToStr(progress.Max);
390 lbl_estimation.Caption := 'FINISHED (duration: ' + TimeToStr(Time - Begintime, TimeFormat) + ')';
391
392 DoStep('FIN');
393 btn_abortok.Caption := '&OK';
394 btn_abortok.Default := True;
395
396 OniImage.Free;
397
398 converting := False;
399
400// CloseDataConnection(DataConnections[conIndex]);
401end;
402
403
404
405
406procedure TForm_LevelDB.HandleFile;
407var
408 i: Byte;
409begin
410{ for i := 1 to Length(ConvertHandlers) do
411 if UpperCase(ConvertHandlers[i].Ext) = UpperCase(ext) then
412 if ConvertHandlers[i].needed then
413 begin
414 ConvertHandlers[i].Handler(fileid, dir_dat2db);
415 Break;
416 end
417 else
418 Break;
419}end;
420
421
422
423
424procedure TForm_LevelDB.CreateDatabase(Source, target: String);
425{
426var
427 DataBase: TABSDatabase;
428 Query: TABSQuery;
429 MimeCoder: TStringFormat_MIME64;
430
431 i, j: LongWord;
432 temps, temps2: String;
433 Data: Tdata;
434 absolutebegintime, begintime: Double;
435 step: Byte;
436 rawlist: TRawList;
437 extlist: TExtensionsMap;
438 fileinfo: TFileInfo;
439 timeformat: TFormatSettings;
440
441 conIndex: Integer;
442const
443 steps: Byte = 4;
444
445
446
447
448 procedure DoStep(stepname: String);
449 begin
450 Inc(step);
451 if stepname <> 'FIN' then
452 group_progress.Caption :=
453 'Creating DB (Step ' + IntToStr(step) + '/' + IntToStr(steps) + ': ' + stepname + ')'
454 else
455 group_progress.Caption := 'Creating DB (FINISHED)';
456 end;
457}
458
459begin
460{ if CreateDataConnection(Source, ODB_Dat) = nil then
461 begin
462 ShowMessage('Could not connect to .dat-file');
463 Exit;
464 end
465 else
466 begin
467 TOniDataDat(OniDataConnection).UnloadWhenUnused := False;
468 end;
469
470 timeformat.LongTimeFormat := 'hh:nn:ss';
471 timeformat.ShortTimeFormat := 'hh:nn:ss';
472 timeformat.TimeSeparator := ':';
473
474 Self.Visible := True;
475 Form_Main.Visible := False;
476 step := 0;
477 converting := True;
478 abort := False;
479 btn_abortok.Caption := '&Abort...';
480 btn_abortok.Default := False;
481 loaded_filename := target;
482
483 absolutebegintime := Time;
484
485 DataBase := TABSDatabase.Create(Self);
486 DataBase.DatabaseName := 'OLDB';
487 DataBase.DatabaseFileName := target;
488 DataBase.CreateDatabase;
489
490 DoStep('Creating tables');
491 progress.Position := 0;
492 lbl_progress.Caption := '';
493 lbl_estimation.Caption := 'Estimated finishing time: unknown';
494 Application.ProcessMessages;
495
496 Query := TABSQuery.Create(Self);
497 Query.DatabaseName := 'OLDB';
498 Query.SQL.Text :=
499 'CREATE TABLE globals ( id AUTOINC PRIMARY KEY, name STRING(128), value STRING(128) );';
500 Query.ExecSQL;
501 Query.SQL.Text :=
502 'CREATE TABLE linkmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, target_id INTEGER );';
503 Query.ExecSQL;
504 Query.SQL.Text :=
505 'CREATE TABLE rawmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, sep BOOLEAN, size INTEGER, data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib );';
506 // Query.SQL.Text:='CREATE TABLE rawmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
507 Query.ExecSQL;
508 Query.SQL.Text :=
509 '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 );';
510 // Query.SQL.Text:='CREATE TABLE datfiles ( id INTEGER PRIMARY KEY, extension CHAR(4), name STRING(128), contenttype INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
511 Query.ExecSQL;
512 Query.SQL.Text :=
513 'CREATE TABLE extlist ( id AUTOINC PRIMARY KEY, ext CHAR(4), ident CHAR(16) );';
514 Query.ExecSQL;
515
516 Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("dbversion","' +
517 dbversion + '");';
518 Query.ExecSQL;
519 SetLength(Data, Length(OniDataConnection.LevelInfo.Ident));
520 for i := 0 to High(OniDataConnection.LevelInfo.Ident) do
521 Data[i] := OniDataConnection.LevelInfo.Ident[i];
522 temps := CreateHexString(Data, True);
523 Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("ident","' + temps + '");';
524 Query.ExecSQL;
525 Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("lvl","' +
526 IntToStr(OniDataConnection.LevelInfo.LevelNumber) + '");';
527 Query.ExecSQL;
528 if OniDataConnection.OSisMAC then
529 Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("os","MAC");'
530 else
531 Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("os","PC");';
532 Query.ExecSQL;
533
534 DoStep('Writing extensionslist');
535 progress.Max := Length(OniDataConnection.GetExtensionsList);
536 Application.ProcessMessages;
537
538 extlist := OniDataConnection.GetExtendedExtensionsList;
539 for i := 0 to High(extlist) do
540 begin
541 SetLength(Data, Length(extlist[i].Ident));
542 for j := 0 to High(extlist[i].Ident) do
543 Data[j] := extlist[i].Ident[j];
544 temps := CreateHexString(Data, True);
545 temps2 := extlist[i].Extension[3] + extlist[i].Extension[2] +
546 extlist[i].Extension[1] + extlist[i].Extension[0];
547 Query.SQL.Text := 'INSERT INTO extlist (ext,ident) VALUES ("' +
548 temps2 + '","' + temps + '");';
549 Query.ExecSQL;
550 progress.Position := i;
551 lbl_progress.Caption := 'Extensions done: ' + IntToStr(i) + '/' +
552 IntToStr(Length(extlist));
553 Application.ProcessMessages;
554 if abort then
555 begin
556 stop_convert;
557 Exit;
558 end;
559 end;
560 lbl_progress.Caption := '';
561
562 progress.Position := 0;
563 lbl_progress.Caption := 'Files done: ' + IntToStr(0) + '/' + IntToStr(
564 OniDataConnection.GetFilesCount);
565 lbl_estimation.Caption := 'Estimated finishing time: unknown';
566
567 DoStep('Loading .dat into memory');
568 Application.ProcessMessages;
569
570 progress.Max := OniDataConnection.GetFilesCount;
571 begintime := Time;
572 DoStep('Writing .dat-fileslist');
573 Application.ProcessMessages;
574
575 Database.StartTransaction;
576 for i := 0 to OniDataConnection.GetFilesCount - 1 do
577 begin
578 fileinfo := OniDataConnection.GetFileInfo(i);
579 if (fileinfo.FileType and $02) = 0 then
580 begin
581 mimecoder := TStringFormat_MIME64.Create;
582 Data := OniDataConnection.LoadDatFile(i);
583 Query.SQL.Text :=
584 'INSERT INTO datfiles (id,extension,name,contenttype,size,data) VALUES (' +
585 IntToStr(i) + ',"' + fileinfo.Extension + '","' + fileinfo.Name + '","' + IntToHex(
586 fileinfo.FileType, 8) + '",' + IntToStr(fileinfo.Size) + ',MimeToBin("' +
587 MimeCoder.StrTo(@Data[0], Length(Data)) + '") );';
588 Query.ExecSQL;
589 mimecoder.Free;
590
591 rawlist := OniDataConnection.GetRawList(i);
592 if Length(rawlist) > 0 then
593 begin
594 for j := 0 to High(rawlist) do
595 begin
596 if rawlist[j].raw_size > 0 then
597 begin
598 SetLength(Data, rawlist[j].raw_size);
599 OniDataConnection.LoadRawFile(i, rawlist[j].src_offset, Data);
600 mimecoder := TStringFormat_MIME64.Create;
601 Query.SQL.Text :=
602 'INSERT INTO rawmap (src_id,src_link_offset,sep,size,data) VALUES (' +
603 IntToStr(i) + ',' + IntToStr(rawlist[j].src_offset) + ',' + BoolToStr(
604 rawlist[j].loc_sep) + ',' + IntToStr(rawlist[j].raw_size) + ',MimeToBin("' +
605 MimeCoder.StrTo(@Data[0], rawlist[j].raw_size) + '") );';
606 Query.ExecSQL;
607 mimecoder.Free;
608 end
609 else
610 begin
611 Query.SQL.Text :=
612 'INSERT INTO rawmap (src_id,src_link_offset,sep,size) VALUES (' +
613 IntToStr(i) + ',' + IntToStr(rawlist[j].src_offset) + ',' + BoolToStr(rawlist[j].loc_sep) + ',0);';
614 Query.ExecSQL;
615 end;
616 end;
617 end;
618
619 HandleFile(fileinfo.Extension, i, True);
620 end
621 else
622 begin
623 Query.SQL.Text :=
624 'INSERT INTO datfiles (id,extension,name,contenttype,size) VALUES (' +
625 IntToStr(i) + ',"' + fileinfo.Extension + '","' + fileinfo.Name + '","' + IntToHex(
626 fileinfo.FileType, 8) + '",0);';
627 Query.ExecSQL;
628 end;
629 if ((i mod 100) = 0) and (i > 0) then
630 begin
631 Database.Commit(False);
632 Database.StartTransaction;
633 end;
634 if ((i mod 10) = 0) and (i >= 100) then
635 lbl_estimation.Caption := 'Estimated time left: ' + TimeToStr(
636 (Time - begintime) / i * (progress.Max - i + 1) * 1.1, timeformat );
637 progress.Position := i;
638 lbl_progress.Caption := 'Files done: ' + IntToStr(i) + '/' + IntToStr(progress.Max);
639 Application.ProcessMessages;
640 if abort then
641 begin
642 stop_convert;
643 Exit;
644 end;
645 end;
646 Database.Commit(False);
647 progress.Position := progress.Max;
648 lbl_progress.Caption := 'Files done: ' + IntToStr(progress.Max) + '/' +
649 IntToStr(progress.Max);
650
651 lbl_estimation.Caption := 'FINISHED (duration: ' + TimeToStr(Time - absolutebegintime, timeformat) + ')';
652
653 DoStep('FIN');
654 btn_abortok.Caption := '&OK';
655 btn_abortok.Default := True;
656
657 converting := False;
658
659 database.Close;
660 database.Free;
661
662 CloseDataConnection(DataConnections[conIndex]);
663}
664end;
665
666
667
668
669procedure TForm_LevelDB.StopConvert;
670begin
671{ btn_abortok.Caption := '&Close';
672 btn_abortok.Default := True;
673 converting := False;
674 lbl_estimation.Caption := 'ABORTED';
675 group_progress.Caption := 'Creating DB (ABORTED)';
676 DataBase.Close;
677 if MessageBox(Self.Handle, PChar('Delete the unfinished DB-file?'),
678 PChar('Delete file?'), MB_YESNO) = idYes then
679 begin
680 DeleteFile(loaded_filename);
681 end;
682}end;
683
684
685
686
687procedure TForm_LevelDB.btn_abortokClick(Sender: TObject);
688begin
689 if converting then
690 begin
691 if MessageBox(Self.Handle,
692 PChar('Do you really want to cancel the convert-progress?'),
693 PChar('Warning: Converting'), MB_YESNO) = idYes then
694 abort := True;
695 end
696 else
697 begin
698 Self.Visible := False;
699 Form_Main.Visible := True;
700 end;
701end;
702
703
704
705{
706procedure InsertDatLinkToDB(fileid: LongWord; offset: LongWord);
707var
708 link: LongWord;
709begin
710 OniDataConnection.LoadDatFilePart(fileid, offset, 4, @link);
711 if link = 0 then
712 link := $FFFFFFFF
713 else
714 link := link div 256;
715 Query.SQL.Text := 'INSERT INTO linkmap (src_id,src_link_offset,target_id) VALUES (' +
716 IntToStr(fileid) + ',' + IntToStr(offset) + ',' + IntToStr(link) + ');';
717 Query.ExecSQL;
718end;
719
720
721
722
723procedure AISA(fileid: LongWord; dir_dat2db: Boolean);
724var
725 packages: Word;
726 i: LongWord;
727begin
728 if dir_dat2db then
729 begin
730 OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
731 if packages > 0 then
732 begin
733 for i := 0 to packages - 1 do
734 InsertDatLinkToDB(fileid, $20 + i * $160 + $28);
735 for i := 0 to packages - 1 do
736 InsertDatLinkToDB(fileid, $20 + i * $160 + $150);
737 end;
738 end
739 else
740 begin
741 end;
742end;
743
744
745
746
747procedure AKEV(fileid: LongWord; dir_dat2db: Boolean);
748var
749 i: LongWord;
750begin
751 if dir_dat2db then
752 begin
753 for i := 0 to 16 do
754 InsertDatLinkToDB(fileid, $8 + i * 4);
755 end
756 else
757 begin
758 end;
759end;
760
761
762
763
764procedure AKOT(fileid: LongWord; dir_dat2db: Boolean);
765var
766 i: LongWord;
767begin
768 if dir_dat2db then
769 begin
770 for i := 0 to 4 do
771 InsertDatLinkToDB(fileid, $8 + i * 4);
772 end
773 else
774 begin
775 end;
776end;
777
778
779
780
781procedure CBPI(fileid: LongWord; dir_dat2db: Boolean);
782var
783 i: LongWord;
784begin
785 if dir_dat2db then
786 begin
787 for i := 0 to 56 do
788 InsertDatLinkToDB(fileid, $8 + i * 4);
789 end
790 else
791 begin
792 end;
793end;
794
795
796
797
798procedure CBPM(fileid: LongWord; dir_dat2db: Boolean);
799var
800 i: LongWord;
801begin
802 if dir_dat2db then
803 begin
804 for i := 0 to 18 do
805 InsertDatLinkToDB(fileid, $8 + i * 4);
806 end
807 else
808 begin
809 end;
810end;
811
812
813
814
815procedure CONS(fileid: LongWord; dir_dat2db: Boolean);
816var
817 i: LongWord;
818begin
819 if dir_dat2db then
820 begin
821 for i := 0 to 1 do
822 InsertDatLinkToDB(fileid, $24 + i * 4);
823 end
824 else
825 begin
826 end;
827end;
828
829
830
831
832procedure CRSA(fileid: LongWord; dir_dat2db: Boolean);
833var
834 packages: LongWord;
835 i: LongWord;
836begin
837 if dir_dat2db then
838 begin
839 OniDataConnection.LoadDatFilePart(fileid, $14, 4, @packages);
840 if packages > 0 then
841 for i := 0 to packages - 1 do
842 InsertDatLinkToDB(fileid, $20 + i * 1100 + $A0);
843 end
844 else
845 begin
846 end;
847end;
848
849
850
851
852procedure DOOR(fileid: LongWord; dir_dat2db: Boolean);
853begin
854 if dir_dat2db then
855 begin
856 InsertDatLinkToDB(fileid, $08);
857 InsertDatLinkToDB(fileid, $10);
858 end
859 else
860 begin
861 end;
862end;
863
864
865
866
867procedure DPGE(fileid: LongWord; dir_dat2db: Boolean);
868begin
869 if dir_dat2db then
870 begin
871 InsertDatLinkToDB(fileid, $40);
872 end
873 else
874 begin
875 end;
876end;
877
878
879
880
881procedure HPGE(fileid: LongWord; dir_dat2db: Boolean);
882begin
883 if dir_dat2db then
884 begin
885 InsertDatLinkToDB(fileid, $0C);
886 end
887 else
888 begin
889 end;
890end;
891
892
893
894
895procedure IGHH(fileid: LongWord; dir_dat2db: Boolean);
896begin
897 if dir_dat2db then
898 begin
899 InsertDatLinkToDB(fileid, $24);
900 InsertDatLinkToDB(fileid, $28);
901 end
902 else
903 begin
904 end;
905end;
906
907
908
909
910procedure IGPA(fileid: LongWord; dir_dat2db: Boolean);
911var
912 links: LongWord;
913 i: LongWord;
914begin
915 if dir_dat2db then
916 begin
917 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);
918 if links > 0 then
919 for i := 0 to links - 1 do
920 InsertDatLinkToDB(fileid, $20 + i * 4);
921 end
922 else
923 begin
924 end;
925end;
926
927
928
929
930procedure IGPG(fileid: LongWord; dir_dat2db: Boolean);
931var
932 i: LongWord;
933begin
934 if dir_dat2db then
935 begin
936 for i := 0 to 1 do
937 InsertDatLinkToDB(fileid, $1C + i * 4);
938 end
939 else
940 begin
941 end;
942end;
943
944
945
946
947procedure IGSA(fileid: LongWord; dir_dat2db: Boolean);
948var
949 links: LongWord;
950 i: LongWord;
951begin
952 if dir_dat2db then
953 begin
954 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);
955 if links > 0 then
956 for i := 0 to links - 1 do
957 InsertDatLinkToDB(fileid, $20 + i * 4);
958 end
959 else
960 begin
961 end;
962end;
963
964
965
966
967procedure IMPT(fileid: LongWord; dir_dat2db: Boolean);
968begin
969 if dir_dat2db then
970 begin
971 InsertDatLinkToDB(fileid, $10);
972 end
973 else
974 begin
975 end;
976end;
977
978
979
980
981procedure IPGE(fileid: LongWord; dir_dat2db: Boolean);
982begin
983 if dir_dat2db then
984 begin
985 InsertDatLinkToDB(fileid, $0C);
986 end
987 else
988 begin
989 end;
990end;
991
992
993
994
995procedure KEYI(fileid: LongWord; dir_dat2db: Boolean);
996var
997 i: LongWord;
998begin
999 if dir_dat2db then
1000 begin
1001 for i := 0 to 9 do
1002 InsertDatLinkToDB(fileid, $08 + i * 4);
1003 end
1004 else
1005 begin
1006 end;
1007end;
1008
1009
1010
1011
1012procedure M3GA(fileid: LongWord; dir_dat2db: Boolean);
1013var
1014 links: LongWord;
1015 i: LongWord;
1016begin
1017 if dir_dat2db then
1018 begin
1019 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);
1020 if links > 0 then
1021 for i := 0 to links - 1 do
1022 InsertDatLinkToDB(fileid, $20 + i * 4);
1023 end
1024 else
1025 begin
1026 end;
1027end;
1028
1029
1030
1031
1032procedure M3GM(fileid: LongWord; dir_dat2db: Boolean);
1033var
1034 i: LongWord;
1035begin
1036 if dir_dat2db then
1037 begin
1038 for i := 0 to 6 do
1039 InsertDatLinkToDB(fileid, $0C + i * 4);
1040 end
1041 else
1042 begin
1043 end;
1044end;
1045
1046
1047
1048
1049procedure MTRL(fileid: LongWord; dir_dat2db: Boolean);
1050begin
1051 if dir_dat2db then
1052 begin
1053 InsertDatLinkToDB(fileid, $10);
1054 end
1055 else
1056 begin
1057 end;
1058end;
1059
1060
1061
1062
1063procedure OBDC(fileid: LongWord; dir_dat2db: Boolean);
1064var
1065 packages: Word;
1066 i: LongWord;
1067begin
1068 if dir_dat2db then
1069 begin
1070 OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
1071 if packages > 0 then
1072 for i := 0 to packages - 1 do
1073 InsertDatLinkToDB(fileid, $20 + i * $18 + $4);
1074 end
1075 else
1076 begin
1077 end;
1078end;
1079
1080
1081
1082
1083procedure OBOA(fileid: LongWord; dir_dat2db: Boolean);
1084var
1085 packages: Word;
1086 i: LongWord;
1087begin
1088 if dir_dat2db then
1089 begin
1090 OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
1091 if packages > 0 then
1092 for i := 0 to packages - 1 do
1093 begin
1094 InsertDatLinkToDB(fileid, $20 + i * 240 + $0);
1095 InsertDatLinkToDB(fileid, $20 + i * 240 + $4);
1096 InsertDatLinkToDB(fileid, $20 + i * 240 + $8);
1097 end;
1098 end
1099 else
1100 begin
1101 end;
1102end;
1103
1104
1105
1106
1107procedure OFGA(fileid: LongWord; dir_dat2db: Boolean);
1108var
1109 packages: LongWord;
1110 i: LongWord;
1111begin
1112 if dir_dat2db then
1113 begin
1114 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
1115 if packages > 0 then
1116 for i := 0 to packages - 1 do
1117 InsertDatLinkToDB(fileid, $20 + i * 12 + $04);
1118 end
1119 else
1120 begin
1121 end;
1122end;
1123
1124
1125
1126
1127procedure ONCC(fileid: LongWord; dir_dat2db: Boolean);
1128var
1129 i: LongWord;
1130begin
1131 if dir_dat2db then
1132 begin
1133 InsertDatLinkToDB(fileid, $28);
1134 InsertDatLinkToDB(fileid, $434);
1135 InsertDatLinkToDB(fileid, $438);
1136 InsertDatLinkToDB(fileid, $43C);
1137 InsertDatLinkToDB(fileid, $C3C);
1138 InsertDatLinkToDB(fileid, $C40);
1139 InsertDatLinkToDB(fileid, $C44);
1140 InsertDatLinkToDB(fileid, $C48);
1141 InsertDatLinkToDB(fileid, $C88);
1142 InsertDatLinkToDB(fileid, $C8C);
1143 end
1144 else
1145 begin
1146 end;
1147end;
1148
1149
1150
1151
1152procedure ONCV(fileid: LongWord; dir_dat2db: Boolean);
1153begin
1154 if dir_dat2db then
1155 begin
1156 InsertDatLinkToDB(fileid, $08);
1157 end
1158 else
1159 begin
1160 end;
1161end;
1162
1163
1164
1165
1166procedure ONLV(fileid: LongWord; dir_dat2db: Boolean);
1167var
1168 i: LongWord;
1169begin
1170 if dir_dat2db then
1171 begin
1172 for i := 0 to 5 do
1173 InsertDatLinkToDB(fileid, $48 + i * 4);
1174 for i := 0 to 5 do
1175 InsertDatLinkToDB(fileid, $64 + i * 4);
1176 InsertDatLinkToDB(fileid, $300);
1177 end
1178 else
1179 begin
1180 end;
1181end;
1182
1183
1184
1185
1186procedure ONOA(fileid: LongWord; dir_dat2db: Boolean);
1187var
1188 packages: LongWord;
1189 i: LongWord;
1190begin
1191 if dir_dat2db then
1192 begin
1193 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
1194 if packages > 0 then
1195 for i := 0 to packages - 1 do
1196 InsertDatLinkToDB(fileid, $20 + i * 8 + $04);
1197 end
1198 else
1199 begin
1200 end;
1201end;
1202
1203
1204
1205
1206procedure ONSK(fileid: LongWord; dir_dat2db: Boolean);
1207begin
1208 if dir_dat2db then
1209 begin
1210 InsertDatLinkToDB(fileid, $08);
1211 InsertDatLinkToDB(fileid, $0C);
1212 InsertDatLinkToDB(fileid, $10);
1213 InsertDatLinkToDB(fileid, $14);
1214 InsertDatLinkToDB(fileid, $18);
1215 InsertDatLinkToDB(fileid, $20);
1216 InsertDatLinkToDB(fileid, $44);
1217 end
1218 else
1219 begin
1220 end;
1221end;
1222
1223
1224
1225
1226procedure ONVL(fileid: LongWord; dir_dat2db: Boolean);
1227var
1228 packages: LongWord;
1229 i: LongWord;
1230begin
1231 if dir_dat2db then
1232 begin
1233 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
1234 if packages > 0 then
1235 for i := 0 to packages - 1 do
1236 InsertDatLinkToDB(fileid, $20 + i * 4);
1237 end
1238 else
1239 begin
1240 end;
1241end;
1242
1243
1244
1245
1246procedure ONWC(fileid: LongWord; dir_dat2db: Boolean);
1247begin
1248 if dir_dat2db then
1249 begin
1250 InsertDatLinkToDB(fileid, $28);
1251 InsertDatLinkToDB(fileid, $34);
1252 InsertDatLinkToDB(fileid, $40);
1253 InsertDatLinkToDB(fileid, $54);
1254 InsertDatLinkToDB(fileid, $58);
1255 InsertDatLinkToDB(fileid, $5C);
1256 InsertDatLinkToDB(fileid, $60);
1257 InsertDatLinkToDB(fileid, $6FC);
1258 InsertDatLinkToDB(fileid, $700);
1259 end
1260 else
1261 begin
1262 end;
1263end;
1264
1265
1266
1267
1268procedure OPGE(fileid: LongWord; dir_dat2db: Boolean);
1269begin
1270 if dir_dat2db then
1271 begin
1272 InsertDatLinkToDB(fileid, $0C);
1273 end
1274 else
1275 begin
1276 end;
1277end;
1278
1279
1280
1281
1282procedure PSPC(fileid: LongWord; dir_dat2db: Boolean);
1283begin
1284 if dir_dat2db then
1285 begin
1286 InsertDatLinkToDB(fileid, $50);
1287 end
1288 else
1289 begin
1290 end;
1291end;
1292
1293
1294
1295
1296procedure PSPL(fileid: LongWord; dir_dat2db: Boolean);
1297var
1298 packages: LongWord;
1299 i: LongWord;
1300begin
1301 if dir_dat2db then
1302 begin
1303 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
1304 if packages > 0 then
1305 for i := 0 to packages - 1 do
1306 InsertDatLinkToDB(fileid, $20 + i * 8 + $4);
1307 end
1308 else
1309 begin
1310 end;
1311end;
1312
1313
1314
1315
1316procedure PSUI(fileid: LongWord; dir_dat2db: Boolean);
1317var
1318 i: LongWord;
1319begin
1320 if dir_dat2db then
1321 begin
1322 for i := 0 to 43 do
1323 InsertDatLinkToDB(fileid, $08 + i * 4);
1324 end
1325 else
1326 begin
1327 end;
1328end;
1329
1330
1331
1332
1333procedure STNA(fileid: LongWord; dir_dat2db: Boolean);
1334var
1335 packages: Word;
1336 i: LongWord;
1337begin
1338 if dir_dat2db then
1339 begin
1340 OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
1341 if packages > 0 then
1342 for i := 0 to packages - 1 do
1343 InsertDatLinkToDB(fileid, $20 + i * 4);
1344 end
1345 else
1346 begin
1347 end;
1348end;
1349
1350
1351
1352
1353procedure TRAC(fileid: LongWord; dir_dat2db: Boolean);
1354var
1355 packages: Word;
1356 i: LongWord;
1357begin
1358 if dir_dat2db then
1359 begin
1360 InsertDatLinkToDB(fileid, $18);
1361 OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
1362 if packages > 0 then
1363 for i := 0 to packages - 1 do
1364 InsertDatLinkToDB(fileid, $20 + i * 12 + 8);
1365 end
1366 else
1367 begin
1368 end;
1369end;
1370
1371
1372
1373
1374procedure TRAM(fileid: LongWord; dir_dat2db: Boolean);
1375begin
1376 if dir_dat2db then
1377 begin
1378 InsertDatLinkToDB(fileid, $40);
1379 InsertDatLinkToDB(fileid, $44);
1380 end
1381 else
1382 begin
1383 end;
1384end;
1385
1386
1387
1388
1389procedure TRAS(fileid: LongWord; dir_dat2db: Boolean);
1390begin
1391 if dir_dat2db then
1392 begin
1393 InsertDatLinkToDB(fileid, $08);
1394 end
1395 else
1396 begin
1397 end;
1398end;
1399
1400
1401
1402
1403procedure TRBS(fileid: LongWord; dir_dat2db: Boolean);
1404var
1405 i: LongWord;
1406begin
1407 if dir_dat2db then
1408 begin
1409 for i := 0 to 4 do
1410 InsertDatLinkToDB(fileid, $08 + i * 4);
1411 end
1412 else
1413 begin
1414 end;
1415end;
1416
1417
1418
1419
1420procedure TRCM(fileid: LongWord; dir_dat2db: Boolean);
1421var
1422 i: LongWord;
1423begin
1424 if dir_dat2db then
1425 begin
1426 for i := 0 to 2 do
1427 InsertDatLinkToDB(fileid, $5C + i * 4);
1428 end
1429 else
1430 begin
1431 end;
1432end;
1433
1434
1435
1436
1437procedure TRGA(fileid: LongWord; dir_dat2db: Boolean);
1438var
1439 i: LongWord;
1440 packages: Word;
1441begin
1442 if dir_dat2db then
1443 begin
1444 OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
1445 if packages > 0 then
1446 for i := 0 to packages - 1 do
1447 InsertDatLinkToDB(fileid, $20 + i * 4);
1448 end
1449 else
1450 begin
1451 end;
1452end;
1453
1454
1455
1456
1457procedure TRGE(fileid: LongWord; dir_dat2db: Boolean);
1458begin
1459 if dir_dat2db then
1460 begin
1461 InsertDatLinkToDB(fileid, $20);
1462 end
1463 else
1464 begin
1465 end;
1466end;
1467
1468
1469
1470
1471procedure TRIG(fileid: LongWord; dir_dat2db: Boolean);
1472begin
1473 if dir_dat2db then
1474 begin
1475 InsertDatLinkToDB(fileid, $18);
1476 InsertDatLinkToDB(fileid, $24);
1477 InsertDatLinkToDB(fileid, $28);
1478 end
1479 else
1480 begin
1481 end;
1482end;
1483
1484
1485
1486
1487procedure TRMA(fileid: LongWord; dir_dat2db: Boolean);
1488var
1489 i: LongWord;
1490 packages: Word;
1491begin
1492 if dir_dat2db then
1493 begin
1494 OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
1495 if packages > 0 then
1496 for i := 0 to packages - 1 do
1497 InsertDatLinkToDB(fileid, $20 + i * 4);
1498 end
1499 else
1500 begin
1501 end;
1502end;
1503
1504
1505
1506
1507procedure TRSC(fileid: LongWord; dir_dat2db: Boolean);
1508var
1509 i: LongWord;
1510 packages: Word;
1511begin
1512 if dir_dat2db then
1513 begin
1514 OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
1515 if packages > 0 then
1516 for i := 0 to packages - 1 do
1517 InsertDatLinkToDB(fileid, $20 + i * 4);
1518 end
1519 else
1520 begin
1521 end;
1522end;
1523
1524
1525
1526
1527procedure TSFF(fileid: LongWord; dir_dat2db: Boolean);
1528var
1529 i: LongWord;
1530 packages: LongWord;
1531begin
1532 if dir_dat2db then
1533 begin
1534 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
1535 if packages > 0 then
1536 for i := 0 to packages - 1 do
1537 InsertDatLinkToDB(fileid, $20 + i * 4);
1538 end
1539 else
1540 begin
1541 end;
1542end;
1543
1544
1545
1546
1547procedure TSFT(fileid: LongWord; dir_dat2db: Boolean);
1548begin
1549 if dir_dat2db then
1550 begin
1551 InsertDatLinkToDB(fileid, $1C);
1552 end
1553 else
1554 begin
1555 end;
1556end;
1557
1558
1559
1560
1561procedure TURR(fileid: LongWord; dir_dat2db: Boolean);
1562begin
1563 if dir_dat2db then
1564 begin
1565 InsertDatLinkToDB(fileid, $60);
1566 InsertDatLinkToDB(fileid, $6C);
1567 InsertDatLinkToDB(fileid, $74);
1568 end
1569 else
1570 begin
1571 end;
1572end;
1573
1574
1575
1576
1577procedure TXAN(fileid: LongWord; dir_dat2db: Boolean);
1578var
1579 i: LongWord;
1580 packages: LongWord;
1581begin
1582 if dir_dat2db then
1583 begin
1584 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
1585 if packages > 0 then
1586 for i := 0 to packages - 1 do
1587 InsertDatLinkToDB(fileid, $20 + i * 4);
1588 end
1589 else
1590 begin
1591 end;
1592end;
1593
1594
1595
1596
1597procedure TXMA(fileid: LongWord; dir_dat2db: Boolean);
1598var
1599 i: LongWord;
1600 packages: LongWord;
1601begin
1602 if dir_dat2db then
1603 begin
1604 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
1605 if packages > 0 then
1606 for i := 0 to packages - 1 do
1607 InsertDatLinkToDB(fileid, $20 + i * 4);
1608 end
1609 else
1610 begin
1611 end;
1612end;
1613
1614
1615
1616
1617procedure TXMB(fileid: LongWord; dir_dat2db: Boolean);
1618var
1619 i: LongWord;
1620 packages: LongWord;
1621begin
1622 if dir_dat2db then
1623 begin
1624 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
1625 if packages > 0 then
1626 for i := 0 to packages - 1 do
1627 InsertDatLinkToDB(fileid, $20 + i * 4);
1628 end
1629 else
1630 begin
1631 end;
1632end;
1633
1634
1635
1636
1637procedure TXMP(fileid: LongWord; dir_dat2db: Boolean);
1638begin
1639 if dir_dat2db then
1640 begin
1641 InsertDatLinkToDB(fileid, $94);
1642 InsertDatLinkToDB(fileid, $98);
1643 end
1644 else
1645 begin
1646 end;
1647end;
1648
1649
1650
1651
1652procedure TXTC(fileid: LongWord; dir_dat2db: Boolean);
1653begin
1654 if dir_dat2db then
1655 begin
1656 InsertDatLinkToDB(fileid, $08);
1657 end
1658 else
1659 begin
1660 end;
1661end;
1662
1663
1664
1665
1666procedure WMCL(fileid: LongWord; dir_dat2db: Boolean);
1667var
1668 i: LongWord;
1669 packages: LongWord;
1670begin
1671 if dir_dat2db then
1672 begin
1673 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
1674 if packages > 0 then
1675 for i := 0 to packages - 1 do
1676 InsertDatLinkToDB(fileid, $20 + i * 8 + $4);
1677 end
1678 else
1679 begin
1680 end;
1681end;
1682
1683
1684
1685
1686procedure WMDD(fileid: LongWord; dir_dat2db: Boolean);
1687var
1688 i: LongWord;
1689 packages: LongWord;
1690begin
1691 if dir_dat2db then
1692 begin
1693 OniDataConnection.LoadDatFilePart(fileid, $11C, 4, @packages);
1694 if packages > 0 then
1695 for i := 0 to packages - 1 do
1696 InsertDatLinkToDB(fileid, $120 + i * $124 + $114);
1697 end
1698 else
1699 begin
1700 end;
1701end;
1702
1703
1704
1705
1706procedure WMMB(fileid: LongWord; dir_dat2db: Boolean);
1707var
1708 i: LongWord;
1709 packages: LongWord;
1710begin
1711 if dir_dat2db then
1712 begin
1713 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
1714 if packages > 0 then
1715 for i := 0 to packages - 1 do
1716 InsertDatLinkToDB(fileid, $20 + i * 4);
1717 end
1718 else
1719 begin
1720 end;
1721end;
1722
1723
1724
1725
1726procedure WPGE(fileid: LongWord; dir_dat2db: Boolean);
1727begin
1728 if dir_dat2db then
1729 begin
1730 InsertDatLinkToDB(fileid, $08);
1731 InsertDatLinkToDB(fileid, $0C);
1732 end
1733 else
1734 begin
1735 end;
1736end;
1737}
1738
1739
1740{
1741procedure InsertHandler(ext: String; needed: Boolean; handler: THandler);
1742begin
1743 SetLength(ConvertHandlers, Length(ConvertHandlers) + 1);
1744 ConvertHandlers[High(ConvertHandlers)].Ext := ext;
1745 ConvertHandlers[High(ConvertHandlers)].needed := needed;
1746 ConvertHandlers[High(ConvertHandlers)].handler := handler;
1747end;
1748}
1749begin
1750{ InsertHandler('ABNA', False, nil);
1751 // InsertHandler('AGDB',True,AGDB);
1752 InsertHandler('AGDB', False, nil);
1753 InsertHandler('AGQC', False, nil);
1754 InsertHandler('AGQG', False, nil);
1755 InsertHandler('AGQR', False, nil);
1756 InsertHandler('AISA', True, AISA);
1757 InsertHandler('AITR', False, nil);
1758 InsertHandler('AKAA', False, nil);
1759 InsertHandler('AKBA', False, nil);
1760 InsertHandler('AKBP', False, nil);
1761 InsertHandler('AKDA', False, nil);
1762 InsertHandler('AKEV', True, AKEV);
1763 InsertHandler('AKOT', True, AKOT);
1764 InsertHandler('AKVA', False, nil);
1765 InsertHandler('BINA', False, nil);
1766 InsertHandler('CBPI', True, CBPI);
1767 InsertHandler('CBPM', True, CBPM);
1768 InsertHandler('CONS', True, CONS);
1769 InsertHandler('CRSA', True, CRSA);
1770 InsertHandler('DOOR', True, DOOR);
1771 InsertHandler('DPGE', True, DPGE);
1772 InsertHandler('ENVP', False, nil);
1773 InsertHandler('FILM', False, nil);
1774 InsertHandler('HPGE', True, HPGE);
1775 InsertHandler('IDXA', False, nil);
1776 InsertHandler('IGHH', True, IGHH);
1777 InsertHandler('IGPA', True, IGPA);
1778 InsertHandler('IGPG', True, IGPG);
1779 InsertHandler('IGSA', True, IGSA);
1780 InsertHandler('IMPT', True, IMPT);
1781 InsertHandler('IPGE', True, IPGE);
1782 InsertHandler('KEYI', True, KEYI);
1783 InsertHandler('M3GA', True, M3GA);
1784 InsertHandler('M3GM', True, M3GM);
1785 InsertHandler('MTRL', True, MTRL);
1786 InsertHandler('OBAN', False, nil);
1787 InsertHandler('OBDC', True, OBDC);
1788 InsertHandler('OBOA', True, OBOA);
1789 InsertHandler('OFGA', True, OFGA);
1790 InsertHandler('ONCC', True, ONCC);
1791 InsertHandler('ONCP', False, nil);
1792 InsertHandler('ONCV', True, ONCV);
1793 InsertHandler('ONFA', False, nil);
1794 InsertHandler('ONGS', False, nil);
1795 InsertHandler('ONIA', False, nil);
1796 InsertHandler('ONLD', False, nil);
1797 InsertHandler('ONLV', True, ONLV);
1798 InsertHandler('ONMA', False, nil);
1799 InsertHandler('ONOA', True, ONOA);
1800 InsertHandler('ONSA', False, nil);
1801 InsertHandler('ONSK', True, ONSK);
1802 InsertHandler('ONTA', False, nil);
1803 InsertHandler('ONVL', True, ONVL);
1804 InsertHandler('ONWC', True, ONWC);
1805 InsertHandler('OPGE', True, OPGE);
1806 InsertHandler('OSBD', False, nil);
1807 InsertHandler('OTIT', False, nil);
1808 InsertHandler('OTLF', False, nil);
1809 InsertHandler('PLEA', False, nil);
1810 InsertHandler('PNTA', False, nil);
1811 InsertHandler('PSPC', True, PSPC);
1812 InsertHandler('PSPL', True, PSPL);
1813 InsertHandler('PSUI', True, PSUI);
1814 InsertHandler('QTNA', False, nil);
1815 InsertHandler('SNDD', False, nil);
1816 InsertHandler('STNA', True, STNA);
1817 InsertHandler('SUBT', False, nil);
1818 InsertHandler('TRAC', True, TRAC);
1819 InsertHandler('TRAM', True, TRAM);
1820 InsertHandler('TRAS', True, TRAS);
1821 InsertHandler('TRBS', True, TRBS);
1822 InsertHandler('TRCM', True, TRCM);
1823 InsertHandler('TRGA', True, TRGA);
1824 InsertHandler('TRGE', True, TRGE);
1825 InsertHandler('TRIA', False, nil);
1826 InsertHandler('TRIG', True, TRIG);
1827 InsertHandler('TRMA', True, TRMA);
1828 InsertHandler('TRSC', True, TRSC);
1829 InsertHandler('TRTA', False, nil);
1830 InsertHandler('TSFF', True, TSFF);
1831 InsertHandler('TSFL', False, nil);
1832 InsertHandler('TSFT', True, TSFT);
1833 InsertHandler('TSGA', False, nil);
1834 InsertHandler('TSTR', False, nil);
1835 InsertHandler('TURR', True, TURR);
1836 InsertHandler('TXAN', True, TXAN);
1837 InsertHandler('TXCA', False, nil);
1838 InsertHandler('TXMA', True, TXMA);
1839 InsertHandler('TXMB', True, TXMB);
1840 InsertHandler('TXMP', True, TXMP);
1841 InsertHandler('TXTC', True, TXTC);
1842 InsertHandler('VCRA', False, nil);
1843 InsertHandler('WMCL', True, WMCL);
1844 InsertHandler('WMDD', True, WMDD);
1845 InsertHandler('WMM_', False, nil);
1846 InsertHandler('WMMB', True, WMMB);
1847 InsertHandler('WPGE', True, WPGE);
1848}end.
Note: See TracBrowser for help on using the repository browser.