| 369 |  | begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 370 |  | if fileid < GetFileCount then | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 371 |  | begin | 
 
 
 
 
 
 
 
 
 
 
 | 372 | < | if not Assigned(Target) then | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 373 | < | Target := TMemoryStream.Create; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 374 | < | if not FDatOpened then | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 375 | < | Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 376 | < | Fdat_file.Seek(Fdat_files[fileid].DatAddr, soFromBeginning); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 377 | < | streampos := Target.Position; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 378 | < | Target.CopyFrom(Fdat_file, Fdat_files[fileid].Size); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 379 | < | Target.Seek(streampos, soFromBeginning); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 380 | < | if UnloadWhenUnused then | 
 
 
 
 
 
 
 
 
 | 372 | > | if GetFileInfo(FileID).Size > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 373 |  | begin | 
 
 
 
 
 
 
 
 
 
 
 | 374 | < | Fdat_file.Free; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 375 | < | FDatOpened := False; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 376 | < | end | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 377 | < | else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 378 | < | FDatOpened := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 374 | > | if not Assigned(Target) then | 
 
 
 
 
 | 375 | > | Target := TMemoryStream.Create; | 
 
 
 
 
 | 376 | > | if not FDatOpened then | 
 
 
 
 
 | 377 | > | Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite); | 
 
 
 
 
 | 378 | > | Fdat_file.Seek(Fdat_files[fileid].DatAddr, soFromBeginning); | 
 
 
 
 
 | 379 | > | streampos := Target.Position; | 
 
 
 
 
 | 380 | > | Target.CopyFrom(Fdat_file, Fdat_files[fileid].Size); | 
 
 
 
 
 | 381 | > | Target.Seek(streampos, soFromBeginning); | 
 
 
 
 
 | 382 | > | if UnloadWhenUnused then | 
 
 
 
 
 | 383 | > | begin | 
 
 
 
 
 | 384 | > | Fdat_file.Free; | 
 
 
 
 
 | 385 | > | FDatOpened := False; | 
 
 
 
 
 | 386 | > | end | 
 
 
 
 
 | 387 | > | else | 
 
 
 
 
 | 388 | > | FDatOpened := True; | 
 
 
 
 
 | 389 | > | end; | 
 
 
 
 
 
 
 
 
 
 
 | 390 |  | end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 391 |  | end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 392 |  |  |