74 |
|
RawLinks: TRawDataList; |
75 |
|
|
76 |
|
DatFileStream, RawFileStream: TMemoryStream; |
77 |
– |
|
78 |
– |
// ########################### |
79 |
– |
datsum, linksum, rawsum: Int64; |
80 |
– |
freq: Int64; |
81 |
– |
tempticks1, tempticks2: Int64; |
82 |
– |
// ########################### |
77 |
|
const |
78 |
|
Steps: Byte = 3; |
79 |
|
|
291 |
|
lbl_estimation.Caption := 'Estimated finishing time: unknown'; |
292 |
|
Application.ProcessMessages; |
293 |
|
|
300 |
– |
QueryPerformanceFrequency(freq); |
301 |
– |
datsum := 0; |
302 |
– |
linksum := 0; |
303 |
– |
rawsum := 0; |
304 |
– |
|
294 |
|
FileTime := Time; |
295 |
|
for FileID := 0 to DatHeader.Files - 1 do |
296 |
|
begin |
299 |
|
FilesHeader[FileID].Extension[j] := FileInfo.Extension[4 - j]; |
300 |
|
if FileInfo.Size > 0 then |
301 |
|
begin |
313 |
– |
QueryPerformanceCounter(tempticks1); |
314 |
– |
|
302 |
|
FilesHeader[FileID].DataAddr := Stream_Body.Size + 8; |
303 |
|
DatFileStream := TMemoryStream.Create; |
304 |
|
Connection.LoadDatFile(FileID, TStream(DatFileStream)); |
307 |
|
DatFileStream.Write(tempi, 4); |
308 |
|
DatFileStream.Write(LevelID, 4); |
309 |
|
|
323 |
– |
QueryPerformanceCounter(tempticks2); |
324 |
– |
datsum := datsum + (tempticks2 - tempticks1); |
325 |
– |
|
310 |
|
DatLinks := Connection.GetDatLinks(FileID); |
311 |
|
if Length(DatLinks) > 0 then |
312 |
|
begin |
321 |
|
end; |
322 |
|
end; |
323 |
|
|
340 |
– |
QueryPerformanceCounter(tempticks1); |
341 |
– |
linksum := linksum + (tempticks1 - tempticks2); |
342 |
– |
|
324 |
|
RawLinks := Connection.GetRawList(FileID); |
325 |
|
if Length(RawLinks) > 0 then |
326 |
|
begin |
347 |
|
end; |
348 |
|
DatFileStream.Seek(0, soFromBeginning); |
349 |
|
Stream_Body.CopyFrom(DatFileStream, DatFileStream.Size); |
369 |
– |
|
370 |
– |
QueryPerformanceCounter(tempticks2); |
371 |
– |
rawsum := rawsum + (tempticks2 - tempticks1); |
350 |
|
end |
351 |
|
else |
352 |
|
FilesHeader[FileID].DataAddr := 0; |
369 |
|
Application.ProcessMessages; |
370 |
|
end; |
371 |
|
|
394 |
– |
ShowMessage('AvgDats: ' + FloatToStr((datsum / progress.Max) / freq) + #13#10 + |
395 |
– |
'AvgLinks: ' + FloatToStr((linksum / progress.Max) / freq) + #13#10 + |
396 |
– |
'AvgRaws: ' + FloatToStr((rawsum / progress.Max) / freq) |
397 |
– |
); |
398 |
– |
|
372 |
|
Stream_Dat.Write(DatHeader, SizeOf(DatHeader)); |
373 |
|
for i := 0 to High(FilesHeader) do |
374 |
|
Stream_Dat.Write(FilesHeader[i], SizeOf(FilesHeader[i])); |
423 |
|
|
424 |
|
BeginTime, FileTime: Double; |
425 |
|
Step: Integer; |
453 |
– |
LevelID: Integer; |
426 |
|
TimeFormat: TFormatSettings; |
427 |
|
|
428 |
|
ConID: Integer; |
431 |
|
|
432 |
|
FileID: Integer; |
433 |
|
|
462 |
– |
Strings: TStrings; |
434 |
|
i: Integer; |
435 |
|
temps: String; |
465 |
– |
tempi: Integer; |
466 |
– |
tempb: Byte; |
436 |
|
tempdata: TByteData; |
437 |
|
FileInfo: TFileInfo; |
438 |
|
DatLinks: TDatLinkList; |
604 |
|
DoStep('Writing .dat-fileslist'); |
605 |
|
Application.ProcessMessages; |
606 |
|
|
607 |
+ |
FileTime := Time; |
608 |
|
Database.StartTransaction; |
609 |
|
for FileID := 0 to Connection.GetFileCount - 1 do |
610 |
|
begin |
679 |
|
end; |
680 |
|
if ((FileID mod 10) = 0) and (FileID >= 100) then |
681 |
|
lbl_estimation.Caption := 'Estimated time left: ' + TimeToStr( |
682 |
< |
(Time - BeginTime) / FileID * (progress.Max - FileID + 1) * 1.1, timeformat ); |
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; |