Changeset 231 for oup/current/DataAccess


Ignore:
Timestamp:
Jun 21, 2007, 12:24:04 AM (18 years ago)
Author:
alloc
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • oup/current/DataAccess/Access_OniArchive.pas

    r229 r231  
    370370  if fileid < GetFileCount then
    371371  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
    381     begin
    382       Fdat_file.Free;
    383       FDatOpened := False;
    384     end
    385     else
    386       FDatOpened := True;
     372    if GetFileInfo(FileID).Size > 0 then
     373    begin
     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;
    387390  end;
    388391end;
Note: See TracChangeset for help on using the changeset viewer.