Menu

#481 UnpackDFM TestStreamFormat

closed-accepted
nobody
Plugins (55)
5
2004-01-20
2004-01-07
No

I would suggest to test stream format and do conversion
only if necessary. With original 2.1.5.3 I couldn’t
compare different formats with each other.

function TWinMergeScript.UnpackFile(const fileSrc,
fileDst : WideString;
var pChanged : WordBool; var pSubcode : Integer) :
WordBool;
const
FilerSignature = integer(465054); // 'TPF0'
ResSignature = integer($9000AFF); // FF 04
00
var
src: TFileStream;
dst: TFileStream;
Signature: Integer;
begin
result := false;
pChanged := false;
try

src := TFileStream.Create(fileSrc, fmOpenRead);
try
//if (TestStreamFormat(src) = sofBinary) then begin
src.Read(Signature, SizeOf(Signature));
if (Signature = FilerSignature) or (Signature and
$9FFFFFF = ResSignature) then begin
src.Seek(0, soFromBeginning);
dst := TFileStream.Create(fileDst, fmCreate);
try
ObjectResourceToText(src, dst);
pChanged := true;
finally
dst.Free;
end;
end;
result := true;
finally
src.Free;
end;

except
end;
end;

Discussion

  • Kimmo Varis

    Kimmo Varis - 2004-01-08

    Logged In: YES
    user_id=631874

    Yes, looks good. Can you attach that whole file (pasting
    does not preserve indents) and compiled dll so we can update
    them to CVS.

    Thanks!

     
  • Kimmo Varis

    Kimmo Varis - 2004-01-18

    Logged In: YES
    user_id=631874

    Thanks for a patch. I applied it to CVS, with compiled DLL:

    Checking in UnpackDFM.dll;
    /cvsroot/winmerge/WinMerge/Plugins/dlls/UnpackDFM.dll,v <--
    UnpackDFM.dll
    new revision: 1.2; previous revision: 1.1
    done
    Checking in UnpackDFMLib_TLB.pas;
    /cvsroot/winmerge/WinMerge/Plugins/src_Delphi/UnpackDFM/UnpackDFMLib_TLB.pas,v
    <-- UnpackDFMLib_TLB.pas
    new revision: 1.2; previous revision: 1.1
    done
    Checking in WinMergeUnit.pas;
    /cvsroot/winmerge/WinMerge/Plugins/src_Delphi/UnpackDFM/WinMergeUnit.pas,v
    <-- WinMergeUnit.pas
    new revision: 1.2; previous revision: 1.1
    done

     
  • Kimmo Varis

    Kimmo Varis - 2004-01-18
    • status: open --> open-accepted
     
  • Kimmo Varis

    Kimmo Varis - 2004-01-20

    Logged In: YES
    user_id=631874

    Closing.

     
  • Kimmo Varis

    Kimmo Varis - 2004-01-20
    • status: open-accepted --> closed-accepted
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.