ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Helper/LevelDB.pas
(Generate patch)

Comparing oup/current/Helper/LevelDB.pas (file contents):
Revision 131 by alloc, Wed Mar 28 01:20:26 2007 UTC vs.
Revision 142 by alloc, Fri Mar 30 02:08:49 2007 UTC

# Line 12 | Line 12 | type
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;
15    public
16      procedure CreateDatabase(Source, Target: String);
17      procedure CreateLevel(Source, Target: String);
# Line 27 | Line 24 | var
24   implementation
25   {$R *.dfm}
26   uses ABSMain, ABSDecUtil, Main,
27 <    ConnectionManager, TypeDefs, DataAccess, OniImgClass, Data;
31 <
32 < type
33 <  THandler = procedure(FileID: Integer);
34 <  TConvertHandler = record
35 <    Ext:     String[4];
36 <    Handler: THandler;
37 <  end;
27 >    ConnectionManager, TypeDefs, DataAccess, OniImgClass, Data, RawList;
28  
29   var
40  ConvertHandlers: array of TConvertHandler;
41 //  loaded_filename: String;
30    Converting:  Boolean = False;
31    Abort:       Boolean = False;
32  
# Line 65 | Line 53 | var
53    Stream_Body, Stream_Names:          TMemoryStream;
54    Stream_Dat, Stream_Raw, Stream_Sep: TFileStream;
55  
68 //  Data, rawdata: Tdata;
56    BeginTime, FileTime: Double;
57    Step:     Integer;
71 //  rawlist:  TRawDataList;
72 //  datlinks: TDatLinks;
73  OniImage:   TOniImage;
58    LevelID:    Integer;
59    TimeFormat: TFormatSettings;
60  
# Line 104 | Line 88 | const
88        group_progress.Caption := 'Creating Dat (FINISHED)';
89    end;
90  
91 +  procedure StopConvert;
92 +  begin
93 +    btn_abortok.Caption := '&Close';
94 +    btn_abortok.Default := True;
95 +    converting := False;
96 +    lbl_estimation.Caption := 'ABORTED';
97 +    group_progress.Caption := 'Creating Level (ABORTED)';
98 +
99 +    Stream_Body.Free;
100 +    Stream_Names.Free;
101 +    DatFileStream.Free;
102 +    RawFileStream.Free;
103 +    
104 +    Stream_Dat.Free;
105 +    Stream_Raw.Free;
106 +    if Connection.DataOS in [DOS_WINDEMO, DOS_MAC, DOS_MACBETA] then
107 +      Stream_Sep.Free;
108 +    
109 +    if MessageBox(Self.Handle, PChar('Delete the unfinished level-files?'),
110 +      PChar('Delete files?'), MB_YESNO) = idYes then
111 +    begin
112 +      DeleteFile(target);
113 +      DeleteFile(AnsiReplaceStr(Target, '.dat', '.raw'));
114 +      if Connection.DataOS in [DOS_WINDEMO, DOS_MAC, DOS_MACBETA] then
115 +        DeleteFile(AnsiReplaceStr(Target, '.dat', '.sep'));
116 +    end;
117 +  end;
118 +
119   begin
120  
121    //
# Line 173 | Line 185 | begin
185  
186    LevelID  := Connection.LevelNumber;
187    LevelID  := (LevelID * 2) * 256 * 256 * 256 + $01;
176  OniImage := TOniImage.Create;
188  
189    Self.Visible := True;
190    Form_Main.Visible := False;
# Line 291 | Line 302 | begin
302        FilesHeader[FileID].DataAddr := Stream_Body.Size + 8;
303        DatFileStream := TMemoryStream.Create;
304        Connection.LoadDatFile(FileID, TStream(DatFileStream));
305 <      DatFileStream.Seek(4, soFromBeginning);
305 >      DatFileStream.Seek(0, soFromBeginning);
306 >      tempi := FileID * 256 + 1;
307 >      DatFileStream.Write(tempi, 4);
308        DatFileStream.Write(LevelID, 4);
309  
310        DatLinks := Connection.GetDatLinks(FileID);
# Line 336 | Line 349 | begin
349        Stream_Body.CopyFrom(DatFileStream, DatFileStream.Size);
350      end
351      else
352 <      FilesHeader[i].DataAddr := 0;
352 >      FilesHeader[FileID].DataAddr := 0;
353      if Length(fileinfo.Name) > 0 then
354      begin
355 <      FilesHeader[i].NameAddr := Stream_Names.Size;
355 >      FilesHeader[FileID].NameAddr := Stream_Names.Size;
356        temps := fileinfo.Extension + fileinfo.Name + Chr(0);
357        Stream_Names.Write(temps[1], Length(temps));
358      end
359      else
360 <      FilesHeader[i].NameAddr := 0;
361 <    FilesHeader[i].FileSize := fileinfo.Size;
362 <    FilesHeader[i].FileType := fileinfo.FileType;
360 >      FilesHeader[FileID].NameAddr := 0;
361 >    FilesHeader[FileID].FileSize := fileinfo.Size;
362 >    FilesHeader[FileID].FileType := fileinfo.FileType;
363  
364      if ((FileID mod 10) = 0) and (FileID >= 100) then
365        lbl_estimation.Caption := 'Estimated time left: ' + TimeToStr(
# Line 367 | Line 380 | begin
380    DatHeader.DataSize  := Stream_Body.Size;
381    DatHeader.NamesSize := Stream_Names.Size;
382    DatHeader.DataAddr  := Stream_Dat.Size;
383 +
384    Stream_Body.Seek(0, soFromBeginning);
385    Stream_Dat.CopyFrom(Stream_Body, Stream_Body.Size);
386    DatHeader.NamesAddr := Stream_Dat.Size;
# Line 393 | Line 407 | begin
407    btn_abortok.Caption := '&OK';
408    btn_abortok.Default := True;
409  
396  OniImage.Free;
397
410    converting := False;
411  
412   //  CloseDataConnection(DataConnections[conIndex]);
# Line 403 | Line 415 | end;
415  
416  
417  
406 procedure TForm_LevelDB.HandleFile;
407 var
408  i: Byte;
409 begin
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
418   procedure TForm_LevelDB.CreateDatabase(Source, target: String);
425 {
419   var
420 <  DataBase:    TABSDatabase;
421 <  Query:       TABSQuery;
422 <  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;
420 >  DataBase:  TABSDatabase;
421 >  Query:     TABSQuery;
422 >  MimeCoder: TStringFormat_MIME64;
423  
424 <  conIndex: Integer;
425 < const
426 <  steps: Byte = 4;
424 >  BeginTime, FileTime: Double;
425 >  Step:       Integer;
426 >  TimeFormat: TFormatSettings;
427  
428 +  ConID:      Integer;
429 +  Connection: TDataAccess;
430 +  ConRepMsg:  TStatusMessages;
431  
432 +  FileID:     Integer;
433  
434 +  i:          Integer;
435 +  temps:      String;
436 +  tempdata:   TByteData;
437 +  FileInfo:   TFileInfo;
438 +  DatLinks:   TDatLinkList;
439 +  RawLinks:   TRawDataList;
440 + const
441 +  steps: Byte = 2;
442  
443    procedure DoStep(stepname: String);
444    begin
# Line 454 | Line 449 | const
449      else
450        group_progress.Caption := 'Creating DB (FINISHED)';
451    end;
452 < }
452 >
453 >  procedure StopConvert;
454 >  begin
455 >    btn_abortok.Caption := '&Close';
456 >    btn_abortok.Default := True;
457 >    converting := False;
458 >    lbl_estimation.Caption := 'ABORTED';
459 >    group_progress.Caption := 'Creating DB (ABORTED)';
460 >    DataBase.Close;
461 >    if MessageBox(Self.Handle, PChar('Delete the unfinished DB-file?'),
462 >      PChar('Delete file?'), MB_YESNO) = idYes then
463 >    begin
464 >      DeleteFile(target);
465 >    end;
466 > end;
467 >
468 >
469  
470   begin
471 < {  if CreateDataConnection(Source, ODB_Dat) = nil then
471 >
472 >  //
473 >  // FILE EXISTS CHECK FÜR DAT/RAW/SEP!!!
474 >  //
475 >
476 >  TimeFormat.ShortTimeFormat := 'hh:nn:ss';
477 >  TimeFormat.LongTimeFormat  := 'hh:nn:ss';
478 >  TimeFormat.TimeSeparator   := ':';
479 >
480 >  ConID := ConManager.OpenConnection(Source, ConRepMsg);
481 >  if not (ConRepMsg in [SM_OK, SM_AlreadyOpened]) then
482    begin
483 <    ShowMessage('Could not connect to .dat-file');
483 >    ShowMessage('Source-file couldn''t be opened! Aborting' + CrLf + GetOpenMsg(ConRepMsg));
484      Exit;
485 <  end
486 <  else
485 >  end else
486 >    Connection := ConManager.Connection[ConID];
487 >
488 >  ConID := ConManager.FileOpened(Target);
489 >  if ConID >= 0 then
490    begin
491 <    TOniDataDat(OniDataConnection).UnloadWhenUnused := False;
491 >    if MessageBox(Self.Handle, PChar('Destination-file is opened, close it in ' +
492 >          'order to proceed conversion?'), PChar('Destination-file opened'),
493 >          MB_YESNO + MB_ICONQUESTION) = ID_YES then
494 >    begin
495 >      if Form_Main.CheckConnectionCloseable(ConID) then
496 >        if not ConManager.CloseConnection(ConID, ConRepMsg) then
497 >        begin
498 >          ShowMessage('Couldn''t close destination-file. Aborting');
499 >          Exit;
500 >        end;
501 >    end else begin
502 >      ShowMessage('Aborting');
503 >      Exit;
504 >    end;
505    end;
506  
507 <  timeformat.LongTimeFormat := 'hh:nn:ss';
508 <  timeformat.ShortTimeFormat := 'hh:nn:ss';
509 <  timeformat.TimeSeparator := ':';
507 >  if FileExists(Target) then
508 >  begin
509 >    if MessageBox(Self.Handle, PChar('Destination-file exists. ' +
510 >          'Overwrite it?'), PChar('Destination-file exists'),
511 >          MB_YESNO + MB_ICONWARNING) = ID_YES then
512 >    begin
513 >      if not DeleteFile(Target) then
514 >      begin
515 >        ShowMessage('Couldn''t delete file. Aborting');
516 >        Exit;
517 >      end;
518 >    end else begin
519 >      ShowMessage('Aborting');
520 >      Exit;
521 >    end;
522 >  end;
523  
524    Self.Visible := True;
525    Form_Main.Visible := False;
# Line 478 | Line 528 | begin
528    abort := False;
529    btn_abortok.Caption := '&Abort...';
530    btn_abortok.Default := False;
481  loaded_filename := target;
531  
532 <  absolutebegintime := Time;
532 >  BeginTime := Time;
533  
534    DataBase := TABSDatabase.Create(Self);
535 +  DataBase.MaxConnections := 1;
536 +  DataBase.PageSize := 8112;
537 +  DataBase.PageCountInExtent := 8;
538 +
539    DataBase.DatabaseName := 'OLDB';
540    DataBase.DatabaseFileName := target;
541    DataBase.CreateDatabase;
# Line 496 | Line 549 | begin
549    Query := TABSQuery.Create(Self);
550    Query.DatabaseName := 'OLDB';
551    Query.SQL.Text :=
552 <    'CREATE TABLE globals  ( id AUTOINC PRIMARY KEY, name STRING(128), value STRING(128) );';
552 >    'CREATE TABLE globals  ( id AUTOINC PRIMARY KEY, name STRING(128), ' +
553 >    'value STRING(128) );';
554    Query.ExecSQL;
555    Query.SQL.Text :=
556 <    'CREATE TABLE linkmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, target_id INTEGER );';
556 >    'CREATE TABLE linkmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, ' +
557 >    'src_link_offset INTEGER, target_id INTEGER);';
558 >  Query.ExecSQL;
559 >  Query.SQL.Text := 'CREATE INDEX idsrcid ON linkmap (src_id);';
560 >  Query.ExecSQL;
561 >  Query.SQL.Text := 'CREATE INDEX idtargetid ON linkmap (target_id);';
562    Query.ExecSQL;
563    Query.SQL.Text :=
564 <    '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 );';
564 >    'CREATE TABLE rawmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, ' +
565 >    'src_link_offset INTEGER, sep BOOLEAN, size INTEGER, ' +
566 >    'data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib);';
567    //    Query.SQL.Text:='CREATE TABLE rawmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
568    Query.ExecSQL;
569 <  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 );';
569 >  Query.SQL.Text := 'CREATE INDEX idsrcid ON rawmap (src_id);';
570    Query.ExecSQL;
571    Query.SQL.Text :=
572 <    'CREATE TABLE extlist  ( id AUTOINC PRIMARY KEY, ext CHAR(4), ident CHAR(16) );';
572 >    'CREATE TABLE datfiles  ( id INTEGER PRIMARY KEY, extension CHAR(4), ' +
573 >    'name STRING(128), contenttype INTEGER, size INTEGER, ' +
574 >    'data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib );';
575 >  //    Query.SQL.Text:='CREATE TABLE datfiles  ( id INTEGER PRIMARY KEY, extension CHAR(4), name STRING(128), contenttype INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
576    Query.ExecSQL;
577 + //  Query.SQL.Text :=
578 + //    'CREATE TABLE extlist  ( id AUTOINC PRIMARY KEY, ext CHAR(4), ident CHAR(16) );';
579 + //  Query.ExecSQL;
580  
581    Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("dbversion","' +
582      dbversion + '");';
583    Query.ExecSQL;
584 <  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;
584 >
585    Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("lvl","' +
586 <    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");';
586 >    IntToStr(Connection.LevelNumber) + '");';
587    Query.ExecSQL;
588 <
589 <  DoStep('Writing extensionslist');
590 <  progress.Max := Length(OniDataConnection.GetExtensionsList);
591 <  Application.ProcessMessages;
592 <
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;
588 >  case Connection.DataOS of
589 >    DOS_WIN: temps := 'WIN';
590 >    DOS_WINDEMO: temps := 'WINDEMO';
591 >    DOS_MAC: temps := 'MAC';
592 >    DOS_MACBETA: temps := 'MACBETA';
593    end;
594 <  lbl_progress.Caption := '';
594 >  Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("os","' + temps + '");';
595 >  Query.ExecSQL;
596  
597    progress.Position      := 0;
598    lbl_progress.Caption   := 'Files done: ' + IntToStr(0) + '/' + IntToStr(
599 <    OniDataConnection.GetFilesCount);
599 >    Connection.GetFileCount);
600    lbl_estimation.Caption := 'Estimated finishing time: unknown';
601  
602 <  DoStep('Loading .dat into memory');
568 <  Application.ProcessMessages;
569 <
570 <  progress.Max := OniDataConnection.GetFilesCount;
602 >  progress.Max := Connection.GetFileCount;
603    begintime    := Time;
604    DoStep('Writing .dat-fileslist');
605    Application.ProcessMessages;
606  
607 +  FileTime := Time;
608    Database.StartTransaction;
609 <  for i := 0 to OniDataConnection.GetFilesCount - 1 do
609 >  for FileID := 0 to Connection.GetFileCount - 1 do
610    begin
611 <    fileinfo := OniDataConnection.GetFileInfo(i);
611 >    fileinfo := Connection.GetFileInfo(FileID);
612      if (fileinfo.FileType and $02) = 0 then
613      begin
614        mimecoder := TStringFormat_MIME64.Create;
615 <      Data      := OniDataConnection.LoadDatFile(i);
615 >      Connection.LoadDatFile(FileID, tempdata);
616        Query.SQL.Text :=
617          'INSERT INTO datfiles (id,extension,name,contenttype,size,data) VALUES (' +
618 <        IntToStr(i) + ',"' + fileinfo.Extension + '","' + fileinfo.Name + '","' + IntToHex(
618 >        IntToStr(FileID) + ',"' + fileinfo.Extension + '","' + fileinfo.Name + '","' + IntToHex(
619          fileinfo.FileType, 8) + '",' + IntToStr(fileinfo.Size) + ',MimeToBin("' +
620 <        MimeCoder.StrTo(@Data[0], Length(Data)) + '") );';
620 >        MimeCoder.StrTo(@tempdata[0], Length(tempdata)) + '") );';
621        Query.ExecSQL;
622        mimecoder.Free;
623  
624 <      rawlist := OniDataConnection.GetRawList(i);
625 <      if Length(rawlist) > 0 then
624 >      RawLinks := Connection.GetRawList(FileID);
625 >      if Length(RawLinks) > 0 then
626        begin
627 <        for j := 0 to High(rawlist) do
627 >        for i := 0 to High(RawLinks) do
628          begin
629 <          if rawlist[j].raw_size > 0 then
629 >          if RawLinks[i].RawSize > 0 then
630            begin
631 <            SetLength(Data, rawlist[j].raw_size);
632 <            OniDataConnection.LoadRawFile(i, rawlist[j].src_offset, Data);
631 >            SetLength(tempdata, RawLinks[i].RawSize);
632 >            Connection.LoadRawFile(FileID, RawLinks[i].SrcOffset, tempdata);
633              mimecoder      := TStringFormat_MIME64.Create;
634              Query.SQL.Text :=
635                'INSERT INTO rawmap (src_id,src_link_offset,sep,size,data) VALUES (' +
636 <              IntToStr(i) + ',' + IntToStr(rawlist[j].src_offset) + ',' + BoolToStr(
637 <              rawlist[j].loc_sep) + ',' + IntToStr(rawlist[j].raw_size) + ',MimeToBin("' +
638 <              MimeCoder.StrTo(@Data[0], rawlist[j].raw_size) + '") );';
636 >              IntToStr(FileID) + ', ' + IntToStr(RawLinks[i].SrcOffset) + ',' +
637 >              BoolToStr(RawLinks[i].LocSep) + ', ' +
638 >              IntToStr(RawLinks[i].RawSize) + ', ' +
639 >              'MimeToBin("' + MimeCoder.StrTo(@tempdata[0], RawLinks[i].RawSize) + '") );';
640              Query.ExecSQL;
641              mimecoder.Free;
642            end
# Line 610 | Line 644 | begin
644            begin
645              Query.SQL.Text :=
646                'INSERT INTO rawmap (src_id,src_link_offset,sep,size) VALUES (' +
647 <              IntToStr(i) + ',' + IntToStr(rawlist[j].src_offset) + ',' + BoolToStr(rawlist[j].loc_sep) + ',0);';
647 >              IntToStr(FileID) + ', ' + IntToStr(RawLinks[i].SrcOffset) + ', ' +
648 >              BoolToStr(RawLinks[i].LocSep) + ', 0);';
649              Query.ExecSQL;
650            end;
651          end;
652        end;
653  
654 <      HandleFile(fileinfo.Extension, i, True);
654 >      DatLinks := Connection.GetDatLinks(FileID);
655 >      if Length(DatLinks) > 0 then
656 >      begin
657 >        for i := 0 to High(DatLinks) do
658 >        begin
659 >          Query.SQL.Text :=
660 >            'INSERT INTO linkmap (src_id, src_link_offset, target_id) VALUES (' +
661 >            IntToStr(FileID) + ', ' + IntToStr(DatLinks[i].SrcOffset) + ', ' +
662 >            IntToStr(DatLinks[i].DestID) + ');';
663 >          Query.ExecSQL;
664 >        end;
665 >      end;
666      end
667      else
668      begin
669        Query.SQL.Text :=
670          'INSERT INTO datfiles (id,extension,name,contenttype,size) VALUES (' +
671 <        IntToStr(i) + ',"' + fileinfo.Extension + '","' + fileinfo.Name + '","' + IntToHex(
672 <        fileinfo.FileType, 8) + '",0);';
671 >        IntToStr(FileID) + ', "' + fileinfo.Extension + '", ' +
672 >        '"' + fileinfo.Name + '", "' + IntToHex(fileinfo.FileType, 8) + '", 0);';
673        Query.ExecSQL;
674      end;
675 <    if ((i mod 100) = 0) and (i > 0) then
675 >    if ((FileID mod 100) = 0) and (FileID > 0) then
676      begin
677        Database.Commit(False);
678        Database.StartTransaction;
679      end;
680 <    if ((i mod 10) = 0) and (i >= 100) then
680 >    if ((FileID mod 10) = 0) and (FileID >= 100) then
681        lbl_estimation.Caption := 'Estimated time left: ' + TimeToStr(
682 <        (Time - begintime) / i * (progress.Max - i + 1) * 1.1, timeformat );
683 <    progress.Position := i;
684 <    lbl_progress.Caption := 'Files done: ' + IntToStr(i) + '/' + IntToStr(progress.Max);
682 >        (Time - FileTime) / FileID * (progress.Max - FileID + 1) * 1.1, timeformat );
683 >    progress.Position := FileID;
684 >    lbl_progress.Caption := 'Files done: ' + IntToStr(FileID) + '/' + IntToStr(progress.Max);
685      Application.ProcessMessages;
686      if abort then
687      begin
688 <      stop_convert;
688 >      StopConvert;
689        Exit;
690      end;
691    end;
# Line 648 | Line 694 | begin
694    lbl_progress.Caption   := 'Files done: ' + IntToStr(progress.Max) + '/' +
695      IntToStr(progress.Max);
696  
697 <  lbl_estimation.Caption := 'FINISHED (duration: ' + TimeToStr(Time - absolutebegintime, timeformat) + ')';
697 >  lbl_estimation.Caption := 'FINISHED (duration: ' + TimeToStr(Time - BeginTime, timeformat) + ')';
698  
699    DoStep('FIN');
700    btn_abortok.Caption := '&OK';
# Line 656 | Line 702 | begin
702  
703    converting := False;
704  
705 <  database.Close;
706 <  database.Free;
661 <
662 <  CloseDataConnection(DataConnections[conIndex]);
663 < }
664 < end;
665 <
666 <
667 <
668 <
669 < procedure TForm_LevelDB.StopConvert;
670 < begin
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)';
705 >  Query.Close;
706 >  Query.Free;
707    DataBase.Close;
708 <  if MessageBox(Self.Handle, PChar('Delete the unfinished DB-file?'),
709 <    PChar('Delete file?'), MB_YESNO) = idYes then
679 <  begin
680 <    DeleteFile(loaded_filename);
681 <  end;
682 < }end;
708 >  DataBase.Free;
709 > end;
710  
711  
712  
# Line 701 | Line 728 | begin
728   end;
729  
730  
731 <
705 < {
706 < procedure InsertDatLinkToDB(fileid: LongWord; offset: LongWord);
707 < var
708 <  link: LongWord;
709 < begin
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;
718 < end;
719 <
720 <
721 <
722 <
723 < procedure AISA(fileid: LongWord; dir_dat2db: Boolean);
724 < var
725 <  packages: Word;
726 <  i: LongWord;
727 < begin
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;
742 < end;
743 <
744 <
745 <
746 <
747 < procedure AKEV(fileid: LongWord; dir_dat2db: Boolean);
748 < var
749 <  i: LongWord;
750 < begin
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;
759 < end;
760 <
761 <
762 <
763 <
764 < procedure AKOT(fileid: LongWord; dir_dat2db: Boolean);
765 < var
766 <  i: LongWord;
767 < begin
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;
776 < end;
777 <
778 <
779 <
780 <
781 < procedure CBPI(fileid: LongWord; dir_dat2db: Boolean);
782 < var
783 <  i: LongWord;
784 < begin
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;
793 < end;
794 <
795 <
796 <
797 <
798 < procedure CBPM(fileid: LongWord; dir_dat2db: Boolean);
799 < var
800 <  i: LongWord;
801 < begin
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;
810 < end;
811 <
812 <
813 <
814 <
815 < procedure CONS(fileid: LongWord; dir_dat2db: Boolean);
816 < var
817 <  i: LongWord;
818 < begin
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;
827 < end;
828 <
829 <
830 <
831 <
832 < procedure CRSA(fileid: LongWord; dir_dat2db: Boolean);
833 < var
834 <  packages: LongWord;
835 <  i: LongWord;
836 < begin
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;
847 < end;
848 <
849 <
850 <
851 <
852 < procedure DOOR(fileid: LongWord; dir_dat2db: Boolean);
853 < begin
854 <  if dir_dat2db then
855 <  begin
856 <    InsertDatLinkToDB(fileid, $08);
857 <    InsertDatLinkToDB(fileid, $10);
858 <  end
859 <  else
860 <  begin
861 <  end;
862 < end;
863 <
864 <
865 <
866 <
867 < procedure DPGE(fileid: LongWord; dir_dat2db: Boolean);
868 < begin
869 <  if dir_dat2db then
870 <  begin
871 <    InsertDatLinkToDB(fileid, $40);
872 <  end
873 <  else
874 <  begin
875 <  end;
876 < end;
877 <
878 <
879 <
880 <
881 < procedure HPGE(fileid: LongWord; dir_dat2db: Boolean);
882 < begin
883 <  if dir_dat2db then
884 <  begin
885 <    InsertDatLinkToDB(fileid, $0C);
886 <  end
887 <  else
888 <  begin
889 <  end;
890 < end;
891 <
892 <
893 <
894 <
895 < procedure IGHH(fileid: LongWord; dir_dat2db: Boolean);
896 < begin
897 <  if dir_dat2db then
898 <  begin
899 <    InsertDatLinkToDB(fileid, $24);
900 <    InsertDatLinkToDB(fileid, $28);
901 <  end
902 <  else
903 <  begin
904 <  end;
905 < end;
906 <
907 <
908 <
909 <
910 < procedure IGPA(fileid: LongWord; dir_dat2db: Boolean);
911 < var
912 <  links: LongWord;
913 <  i:     LongWord;
914 < begin
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;
925 < end;
926 <
927 <
928 <
929 <
930 < procedure IGPG(fileid: LongWord; dir_dat2db: Boolean);
931 < var
932 <  i: LongWord;
933 < begin
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;
942 < end;
943 <
944 <
945 <
946 <
947 < procedure IGSA(fileid: LongWord; dir_dat2db: Boolean);
948 < var
949 <  links: LongWord;
950 <  i:     LongWord;
951 < begin
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;
962 < end;
963 <
964 <
965 <
966 <
967 < procedure IMPT(fileid: LongWord; dir_dat2db: Boolean);
968 < begin
969 <  if dir_dat2db then
970 <  begin
971 <    InsertDatLinkToDB(fileid, $10);
972 <  end
973 <  else
974 <  begin
975 <  end;
976 < end;
977 <
978 <
979 <
980 <
981 < procedure IPGE(fileid: LongWord; dir_dat2db: Boolean);
982 < begin
983 <  if dir_dat2db then
984 <  begin
985 <    InsertDatLinkToDB(fileid, $0C);
986 <  end
987 <  else
988 <  begin
989 <  end;
990 < end;
991 <
992 <
993 <
994 <
995 < procedure KEYI(fileid: LongWord; dir_dat2db: Boolean);
996 < var
997 <  i: LongWord;
998 < begin
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;
1007 < end;
1008 <
1009 <
1010 <
1011 <
1012 < procedure M3GA(fileid: LongWord; dir_dat2db: Boolean);
1013 < var
1014 <  links: LongWord;
1015 <  i:     LongWord;
1016 < begin
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;
1027 < end;
1028 <
1029 <
1030 <
1031 <
1032 < procedure M3GM(fileid: LongWord; dir_dat2db: Boolean);
1033 < var
1034 <  i: LongWord;
1035 < begin
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;
1044 < end;
1045 <
1046 <
1047 <
1048 <
1049 < procedure MTRL(fileid: LongWord; dir_dat2db: Boolean);
1050 < begin
1051 <  if dir_dat2db then
1052 <  begin
1053 <    InsertDatLinkToDB(fileid, $10);
1054 <  end
1055 <  else
1056 <  begin
1057 <  end;
1058 < end;
1059 <
1060 <
1061 <
1062 <
1063 < procedure OBDC(fileid: LongWord; dir_dat2db: Boolean);
1064 < var
1065 <  packages: Word;
1066 <  i: LongWord;
1067 < begin
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;
1078 < end;
1079 <
1080 <
1081 <
1082 <
1083 < procedure OBOA(fileid: LongWord; dir_dat2db: Boolean);
1084 < var
1085 <  packages: Word;
1086 <  i: LongWord;
1087 < begin
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;
1102 < end;
1103 <
1104 <
1105 <
1106 <
1107 < procedure OFGA(fileid: LongWord; dir_dat2db: Boolean);
1108 < var
1109 <  packages: LongWord;
1110 <  i: LongWord;
1111 < begin
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;
1122 < end;
1123 <
1124 <
1125 <
1126 <
1127 < procedure ONCC(fileid: LongWord; dir_dat2db: Boolean);
1128 < var
1129 <  i: LongWord;
1130 < begin
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;
1147 < end;
1148 <
1149 <
1150 <
1151 <
1152 < procedure ONCV(fileid: LongWord; dir_dat2db: Boolean);
1153 < begin
1154 <  if dir_dat2db then
1155 <  begin
1156 <    InsertDatLinkToDB(fileid, $08);
1157 <  end
1158 <  else
1159 <  begin
1160 <  end;
1161 < end;
1162 <
1163 <
1164 <
1165 <
1166 < procedure ONLV(fileid: LongWord; dir_dat2db: Boolean);
1167 < var
1168 <  i: LongWord;
1169 < begin
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;
1181 < end;
1182 <
1183 <
1184 <
1185 <
1186 < procedure ONOA(fileid: LongWord; dir_dat2db: Boolean);
1187 < var
1188 <  packages: LongWord;
1189 <  i: LongWord;
1190 < begin
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;
1201 < end;
1202 <
1203 <
1204 <
1205 <
1206 < procedure ONSK(fileid: LongWord; dir_dat2db: Boolean);
1207 < begin
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;
1221 < end;
1222 <
1223 <
1224 <
1225 <
1226 < procedure ONVL(fileid: LongWord; dir_dat2db: Boolean);
1227 < var
1228 <  packages: LongWord;
1229 <  i: LongWord;
1230 < begin
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;
1241 < end;
1242 <
1243 <
1244 <
1245 <
1246 < procedure ONWC(fileid: LongWord; dir_dat2db: Boolean);
1247 < begin
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;
1263 < end;
1264 <
1265 <
1266 <
1267 <
1268 < procedure OPGE(fileid: LongWord; dir_dat2db: Boolean);
1269 < begin
1270 <  if dir_dat2db then
1271 <  begin
1272 <    InsertDatLinkToDB(fileid, $0C);
1273 <  end
1274 <  else
1275 <  begin
1276 <  end;
1277 < end;
1278 <
1279 <
1280 <
1281 <
1282 < procedure PSPC(fileid: LongWord; dir_dat2db: Boolean);
1283 < begin
1284 <  if dir_dat2db then
1285 <  begin
1286 <    InsertDatLinkToDB(fileid, $50);
1287 <  end
1288 <  else
1289 <  begin
1290 <  end;
1291 < end;
1292 <
1293 <
1294 <
1295 <
1296 < procedure PSPL(fileid: LongWord; dir_dat2db: Boolean);
1297 < var
1298 <  packages: LongWord;
1299 <  i: LongWord;
1300 < begin
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;
1311 < end;
1312 <
1313 <
1314 <
1315 <
1316 < procedure PSUI(fileid: LongWord; dir_dat2db: Boolean);
1317 < var
1318 <  i: LongWord;
1319 < begin
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;
1328 < end;
1329 <
1330 <
1331 <
1332 <
1333 < procedure STNA(fileid: LongWord; dir_dat2db: Boolean);
1334 < var
1335 <  packages: Word;
1336 <  i: LongWord;
1337 < begin
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;
1348 < end;
1349 <
1350 <
1351 <
1352 <
1353 < procedure TRAC(fileid: LongWord; dir_dat2db: Boolean);
1354 < var
1355 <  packages: Word;
1356 <  i: LongWord;
1357 < begin
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;
1369 < end;
1370 <
1371 <
1372 <
1373 <
1374 < procedure TRAM(fileid: LongWord; dir_dat2db: Boolean);
1375 < begin
1376 <  if dir_dat2db then
1377 <  begin
1378 <    InsertDatLinkToDB(fileid, $40);
1379 <    InsertDatLinkToDB(fileid, $44);
1380 <  end
1381 <  else
1382 <  begin
1383 <  end;
1384 < end;
1385 <
1386 <
1387 <
1388 <
1389 < procedure TRAS(fileid: LongWord; dir_dat2db: Boolean);
1390 < begin
1391 <  if dir_dat2db then
1392 <  begin
1393 <    InsertDatLinkToDB(fileid, $08);
1394 <  end
1395 <  else
1396 <  begin
1397 <  end;
1398 < end;
1399 <
1400 <
1401 <
1402 <
1403 < procedure TRBS(fileid: LongWord; dir_dat2db: Boolean);
1404 < var
1405 <  i: LongWord;
1406 < begin
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;
1415 < end;
1416 <
1417 <
1418 <
1419 <
1420 < procedure TRCM(fileid: LongWord; dir_dat2db: Boolean);
1421 < var
1422 <  i: LongWord;
1423 < begin
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;
1432 < end;
1433 <
1434 <
1435 <
1436 <
1437 < procedure TRGA(fileid: LongWord; dir_dat2db: Boolean);
1438 < var
1439 <  i: LongWord;
1440 <  packages: Word;
1441 < begin
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;
1452 < end;
1453 <
1454 <
1455 <
1456 <
1457 < procedure TRGE(fileid: LongWord; dir_dat2db: Boolean);
1458 < begin
1459 <  if dir_dat2db then
1460 <  begin
1461 <    InsertDatLinkToDB(fileid, $20);
1462 <  end
1463 <  else
1464 <  begin
1465 <  end;
1466 < end;
1467 <
1468 <
1469 <
1470 <
1471 < procedure TRIG(fileid: LongWord; dir_dat2db: Boolean);
1472 < begin
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;
1482 < end;
1483 <
1484 <
1485 <
1486 <
1487 < procedure TRMA(fileid: LongWord; dir_dat2db: Boolean);
1488 < var
1489 <  i: LongWord;
1490 <  packages: Word;
1491 < begin
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;
1502 < end;
1503 <
1504 <
1505 <
1506 <
1507 < procedure TRSC(fileid: LongWord; dir_dat2db: Boolean);
1508 < var
1509 <  i: LongWord;
1510 <  packages: Word;
1511 < begin
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;
1522 < end;
1523 <
1524 <
1525 <
1526 <
1527 < procedure TSFF(fileid: LongWord; dir_dat2db: Boolean);
1528 < var
1529 <  i: LongWord;
1530 <  packages: LongWord;
1531 < begin
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;
1542 < end;
1543 <
1544 <
1545 <
1546 <
1547 < procedure TSFT(fileid: LongWord; dir_dat2db: Boolean);
1548 < begin
1549 <  if dir_dat2db then
1550 <  begin
1551 <    InsertDatLinkToDB(fileid, $1C);
1552 <  end
1553 <  else
1554 <  begin
1555 <  end;
1556 < end;
1557 <
1558 <
1559 <
1560 <
1561 < procedure TURR(fileid: LongWord; dir_dat2db: Boolean);
1562 < begin
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;
1572 < end;
1573 <
1574 <
1575 <
1576 <
1577 < procedure TXAN(fileid: LongWord; dir_dat2db: Boolean);
1578 < var
1579 <  i: LongWord;
1580 <  packages: LongWord;
1581 < begin
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;
1592 < end;
1593 <
1594 <
1595 <
1596 <
1597 < procedure TXMA(fileid: LongWord; dir_dat2db: Boolean);
1598 < var
1599 <  i: LongWord;
1600 <  packages: LongWord;
1601 < begin
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;
1612 < end;
1613 <
1614 <
1615 <
1616 <
1617 < procedure TXMB(fileid: LongWord; dir_dat2db: Boolean);
1618 < var
1619 <  i: LongWord;
1620 <  packages: LongWord;
1621 < begin
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;
1632 < end;
1633 <
1634 <
1635 <
1636 <
1637 < procedure TXMP(fileid: LongWord; dir_dat2db: Boolean);
1638 < begin
1639 <  if dir_dat2db then
1640 <  begin
1641 <    InsertDatLinkToDB(fileid, $94);
1642 <    InsertDatLinkToDB(fileid, $98);
1643 <  end
1644 <  else
1645 <  begin
1646 <  end;
1647 < end;
1648 <
1649 <
1650 <
1651 <
1652 < procedure TXTC(fileid: LongWord; dir_dat2db: Boolean);
1653 < begin
1654 <  if dir_dat2db then
1655 <  begin
1656 <    InsertDatLinkToDB(fileid, $08);
1657 <  end
1658 <  else
1659 <  begin
1660 <  end;
1661 < end;
1662 <
1663 <
1664 <
1665 <
1666 < procedure WMCL(fileid: LongWord; dir_dat2db: Boolean);
1667 < var
1668 <  i: LongWord;
1669 <  packages: LongWord;
1670 < begin
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;
1681 < end;
1682 <
1683 <
1684 <
1685 <
1686 < procedure WMDD(fileid: LongWord; dir_dat2db: Boolean);
1687 < var
1688 <  i: LongWord;
1689 <  packages: LongWord;
1690 < begin
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;
1701 < end;
1702 <
1703 <
1704 <
1705 <
1706 < procedure WMMB(fileid: LongWord; dir_dat2db: Boolean);
1707 < var
1708 <  i: LongWord;
1709 <  packages: LongWord;
1710 < begin
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;
1721 < end;
1722 <
1723 <
1724 <
1725 <
1726 < procedure WPGE(fileid: LongWord; dir_dat2db: Boolean);
1727 < begin
1728 <  if dir_dat2db then
1729 <  begin
1730 <    InsertDatLinkToDB(fileid, $08);
1731 <    InsertDatLinkToDB(fileid, $0C);
1732 <  end
1733 <  else
1734 <  begin
1735 <  end;
1736 < end;
1737 < }
1738 <
1739 <
1740 < {
1741 < procedure InsertHandler(ext: String; needed: Boolean; handler: THandler);
1742 < begin
1743 <  SetLength(ConvertHandlers, Length(ConvertHandlers) + 1);
1744 <  ConvertHandlers[High(ConvertHandlers)].Ext     := ext;
1745 <  ConvertHandlers[High(ConvertHandlers)].needed  := needed;
1746 <  ConvertHandlers[High(ConvertHandlers)].handler := handler;
1747 < end;
1748 < }
1749 < begin
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.
731 > end.

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)