FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   what is the best and right way to patch a file in inno setup using xdelta (https://fileforums.com/showthread.php?t=104654)

maybeknow 17-09-2021 03:09

what is the best and right way to patch a file in inno setup using xdelta
 
I want to patch one big file (~1GB) inside of my installer that I created with inno setup
for creating the binary different patch file I think the best way is using xdelta (if there is any better ways I will be happy to hear it), but I'm not sure what is the best way to apply the created xdelta patch to a file in install time.
I know there is a function name ISXDeltaExtract in IsDone that I think created for same reason, but I'm not sure how can I use it properly
Code:

function ISxDeltaExtract(CurComponent: Cardinal; PctOfTotal: Double; MinRAM, MaxRAM: Integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile, DeleteDiffFile: Boolean): Boolean;
and I also know I can just create a batch file and extract and run it at the end of my installer, but I don't think its a good idea at all, because the file is kind of big, its going to take some time and I want to somehow show the progress of it in installer (if its possible to show it at the installation progress bar its much better, just like how fitgirl do it); that I don't think I can do it with batch file method

Cesar82 17-09-2021 03:37

It is necessary to include XDelta3.dll in your installer.
You can create the code by copying parts of the code included in the DiskSpan GUI 2.0.0.2 example script.
ISxDeltaExtract only works if you create the patch using XDelta with the parameters:
Code:

MakePatch.bat

@echo off
set "OldFile=File_Old.txt"
set "NewFile=File_New.txt"
echo.
xdelta3.exe -e -9 -S djw -vfs "%OldFile%" "%NewFile%" "%OldFile%.diff"
echo.
echo.Press any key to exit.
pause >nul


maybeknow 17-09-2021 04:12

Quote:

Originally Posted by Cesar82 (Post 494019)
It is necessary to include XDelta3.dll in your installer.
You can create the code by copying parts of the code included in the DiskSpan GUI 2.0.0.2 example script.
ISxDeltaExtract only works if you create the patch using XDelta with the parameters:
Code:

MakePatch.bat

@echo off
set "OldFile=File_Old.txt"
set "NewFile=File_New.txt"
echo.
xdelta3.exe -e -9 -S djw -vfs "%OldFile%" "%NewFile%" "%OldFile%.diff"
echo.
echo.Press any key to exit.
pause >nul


thank you, the DiskSpan GUI 2.0.0.2 is a great example, but I think maybe its better for me to follow the original example of ISDone, because i want to use it on a simple inno setup script (nothing fancy)
but something that I still not sure about is how can I show the progress of it in installation page of my installer...

maybeknow 17-09-2021 06:18

I Keep getting this error...
and I dont know why
https://i.ibb.co/cYJ6pYn/Screenshot-...-17-151642.png

here is the line of code
Code:

ExtractTemporaryFile('XDelta3.dll');
ISxDeltaExtract(0, 0, 0, 256000, ExpandConstant('{app}\test1.txt'), ExpandConstant('{tmp}\test1.txt.diff'), ExpandConstant('{app}\out3.dat'), false, false);

oh I think I made a big mistake...
what is the type of first argument of function? should I pass a compressed file to it??

Cesar82 17-09-2021 07:45

Quote:

Originally Posted by maybeknow (Post 494020)
thank you, the DiskSpan GUI 2.0.0.2 is a great example, but I think maybe its better for me to follow the original example of ISDone, because i want to use it on a simple inno setup script (nothing fancy)
but something that I still not sure about is how can I show the progress of it in installation page of my installer...

To display the progress I think it will be necessary to use the parameter "PctOfTotal" of the functions used.

Example patch 10% of progressbar.
Code:

if not ISArcExtract ( 0, 0.9, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

if not ISxDeltaExtract ( 0, 0, 0.1, 640, ExpandConstant('{app}\origfile.txt'), ExpandConstant('{app}\patch.diff'),  ExpandConstant('{app}\newfile.txt'), false, false) then break;


Cesar82 17-09-2021 07:56

Quote:

Originally Posted by maybeknow (Post 494021)
I Keep getting this error...
and I dont know why
https://i.ibb.co/cYJ6pYn/Screenshot-...-17-151642.png

here is the line of code
Code:

ExtractTemporaryFile('XDelta3.dll');
ISxDeltaExtract(0, 0, 0, 256000, ExpandConstant('{app}\test1.txt'), ExpandConstant('{tmp}\test1.txt.diff'), ExpandConstant('{app}\out3.dat'), false, false);

oh I think I made a big mistake...
what is the type of first argument of function? should I pass a compressed file to it??

Code:

ExtractTemporaryFile('XDelta3.dll');
ISxDeltaExtract(0, 0, 0, 640, ExpandConstant('{app}\test1.txt'), ExpandConstant('{tmp}\test1.txt.diff'), ExpandConstant('{app}\test_dest.txt'), false, false);


maybeknow 17-09-2021 08:21

Quote:

Originally Posted by Cesar82 (Post 494025)
Code:

ExtractTemporaryFile('XDelta3.dll');
ISxDeltaExtract(0, 0, 0, 640, ExpandConstant('{app}\test1.txt'), ExpandConstant('{tmp}\test1.txt.diff'), ExpandConstant('{app}\test_dest.txt'), false, false);


thank you again, but I still getting the same result...
I just using the ISDone.dll for the xdelta function, and im not using any other function

Cesar82 17-09-2021 11:32

1 Attachment(s)
Quote:

Originally Posted by maybeknow (Post 494028)
thank you again, but I still getting the same result...
I just using the ISDone.dll for the xdelta function, and im not using any other function

Make patch with parametters
xdelta3.exe -e -9 -S djw -vfs "%OldFile%" "%NewFile%" "%OldFile%.diff"

Tested with XDelta 3.0.11
Use the attachment to create the .diff file

maybeknow 17-09-2021 11:59

Quote:

Originally Posted by Cesar82 (Post 494029)
Make patch with parametters
xdelta3.exe -e -9 -S djw -vfs "%OldFile%" "%NewFile%" "%OldFile%.diff"

Tested with XDelta 3.0.11
Use the attachment to create the .diff file

thank you, I defiantly doing something wrong, here is my code
Code:

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
AppId={{D304513B-BAFC-4211-96A0-0FFA39EAB24E}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
OutputDir="C:\Users\saman\Desktop\12Min"
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "ISDone.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "XDelta3.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "xdelta\test\File_Old.txt.diff"; DestDir: "{tmp}"; Flags: dontcopy;

[-code]
function ISxDeltaExtract(CurComponent: Cardinal; PctOfTotal: Double; MinRAM, MaxRAM: Integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile, DeleteDiffFile: Boolean): Boolean; external 'ISxDeltaExtract@{tmp}\ISDone.dll stdcall delayload';

procedure CurStepChanged(CurInstallStep: TSetupStep );
begin
  if (CurInstallStep = ssInstall) then
  begin
    ExtractTemporaryFile('XDelta3.dll');
    ExtractTemporaryFile('ISDone.dll');
    if ISxDeltaExtract(0, 0, 0, 640, ExpandConstant('{app}\File_New.txt'), ExpandConstant('{app}\*.diff'), ExpandConstant('{app}\test_dest.txt'), false, false) then Log('nice.');
  end;
end;

sorry for bother you so much and thank you


All times are GMT -7. The time now is 03:52.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com