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 127 by alloc, Fri Mar 23 17:14:40 2007 UTC vs.
Revision 130 by alloc, Wed Mar 28 01:17:24 2007 UTC

# Line 155 | Line 155 | begin
155        begin
156          ShowMessage('Couldn''t delete file. Aborting');
157          Exit;
158 <      end else if not DeleteFile(AnsiReplaceStr(Target, '.dat', '.sep')) then
158 >      end else if Connection.DataOS in [DOS_WINDEMO, DOS_MAC, DOS_MACBETA] then
159        begin
160 <        ShowMessage('Couldn''t delete file. Aborting');
161 <        Exit;
160 >        if not DeleteFile(AnsiReplaceStr(Target, '.dat', '.sep')) then
161 >        begin
162 >          ShowMessage('Couldn''t delete file. Aborting');
163 >          Exit;
164 >        end;
165        end;
166      end else begin
167        ShowMessage('Aborting');
# Line 323 | Line 326 | begin
326              end;
327            end else
328              RawLinks[i].RawAddr := 0;
329 +          DatFileStream.Seek(RawLinks[i].SrcOffset, soFromBeginning);
330 +          DatFileStream.Write(RawLinks[i].RawAddr, 4);
331          end;
332        end;
333 <
334 < {
330 <            Data[rawlist[j].src_offset + 0] := (rawlist[j].raw_addr) and $FF;
331 <            Data[rawlist[j].src_offset + 1] := (rawlist[j].raw_addr shr 8) and $FF;
332 <            Data[rawlist[j].src_offset + 2] := (rawlist[j].raw_addr shr 16) and $FF;
333 <            Data[rawlist[j].src_offset + 3] := (rawlist[j].raw_addr shr 24) and $FF;
334 < }
335 <      Stream_Body.Write(Data[0], Length(Data));
336 <      //
333 >      DatFileStream.Seek(0, soFromBeginning);
334 >      Stream_Body.CopyFrom(DatFileStream, DatFileStream.Size);
335      end
336      else
337        FilesHeader[i].DataAddr := 0;
# Line 348 | Line 346 | begin
346      FilesHeader[i].FileSize := fileinfo.Size;
347      FilesHeader[i].FileType := fileinfo.FileType;
348  
349 <    if ((i mod 10) = 0) and (i >= 100) then
349 >    if ((FileID mod 10) = 0) and (FileID >= 100) then
350        lbl_estimation.Caption := 'Estimated time left: ' + TimeToStr(
351 <        (Time - FileTime) / i * (progress.Max - i + 1) * 1.1, TimeFormat );
352 <    progress.Position := i + 1;
353 <    lbl_progress.Caption := 'Files done: ' + IntToStr(i + 1) + '/' + IntToStr(progress.Max);
351 >        (Time - FileTime) / FileID * (progress.Max - FileID + 1) * 1.1, TimeFormat );
352 >    progress.Position := FileID + 1;
353 >    lbl_progress.Caption := 'Files done: ' + IntToStr(FileID + 1) + '/' + IntToStr(progress.Max);
354      Application.ProcessMessages;
355    end;
356  
# Line 380 | Line 378 | begin
378    Stream_Body.Free;
379    Stream_Names.Free;
380    Stream_Raw.Free;
381 <  if OniDataConnection.OSisMac then
381 >
382 >  if Connection.DataOS in [DOS_WINDEMO, DOS_MAC, DOS_MACBETA] then
383      Stream_Sep.Free;
384  
385    progress.Position      := progress.Max;
# Line 396 | Line 395 | begin
395  
396    converting := False;
397  
398 <  CloseDataConnection(DataConnections[conIndex]);
398 > //  CloseDataConnection(DataConnections[conIndex]);
399   end;
400  
401  
# Line 406 | Line 405 | procedure TForm_LevelDB.HandleFile;
405   var
406    i: Byte;
407   begin
408 <  for i := 1 to Length(ConvertHandlers) do
408 > {  for i := 1 to Length(ConvertHandlers) do
409      if UpperCase(ConvertHandlers[i].Ext) = UpperCase(ext) then
410        if ConvertHandlers[i].needed then
411        begin
# Line 415 | Line 414 | begin
414        end
415        else
416          Break;
417 < end;
417 > }end;
418  
419  
420  
421  
422   procedure TForm_LevelDB.CreateDatabase(Source, target: String);
423 + {
424   var
425    DataBase:    TABSDatabase;
426    Query:       TABSQuery;
# Line 452 | Line 452 | const
452      else
453        group_progress.Caption := 'Creating DB (FINISHED)';
454    end;
455 + }
456  
457   begin
458 <  if CreateDataConnection(Source, ODB_Dat) = nil then
458 > {  if CreateDataConnection(Source, ODB_Dat) = nil then
459    begin
460      ShowMessage('Could not connect to .dat-file');
461      Exit;
# Line 657 | Line 658 | begin
658    database.Free;
659  
660    CloseDataConnection(DataConnections[conIndex]);
661 + }
662   end;
663  
664  
665  
666  
667 < procedure TForm_LevelDB.stop_convert;
667 > procedure TForm_LevelDB.StopConvert;
668   begin
669 <  btn_abortok.Caption := '&Close';
669 > {  btn_abortok.Caption := '&Close';
670    btn_abortok.Default := True;
671    converting := False;
672    lbl_estimation.Caption := 'ABORTED';
# Line 675 | Line 677 | begin
677    begin
678      DeleteFile(loaded_filename);
679    end;
680 < end;
680 > }end;
681  
682  
683  
# Line 698 | Line 700 | end;
700  
701  
702  
703 <
703 > {
704   procedure InsertDatLinkToDB(fileid: LongWord; offset: LongWord);
705   var
706    link: LongWord;
# Line 1730 | Line 1732 | begin
1732    begin
1733    end;
1734   end;
1735 + }
1736  
1737  
1738 <
1736 <
1738 > {
1739   procedure InsertHandler(ext: String; needed: Boolean; handler: THandler);
1740   begin
1741    SetLength(ConvertHandlers, Length(ConvertHandlers) + 1);
# Line 1741 | Line 1743 | begin
1743    ConvertHandlers[High(ConvertHandlers)].needed  := needed;
1744    ConvertHandlers[High(ConvertHandlers)].handler := handler;
1745   end;
1746 <
1746 > }
1747   begin
1748 <  InsertHandler('ABNA', False, nil);
1748 > {  InsertHandler('ABNA', False, nil);
1749    //  InsertHandler('AGDB',True,AGDB);
1750    InsertHandler('AGDB', False, nil);
1751    InsertHandler('AGQC', False, nil);
# Line 1841 | Line 1843 | begin
1843    InsertHandler('WMM_', False, nil);
1844    InsertHandler('WMMB', True, WMMB);
1845    InsertHandler('WPGE', True, WPGE);
1846 < end.
1846 > }end.

Diff Legend

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