I would suggest to test stream format and do conversion
only if necessary. With original 2.1.5.3 I couldnt
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;
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!
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
Logged In: YES
user_id=631874
Closing.