VPatch 2.0 final
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2798 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
2449fbc6bd
commit
6dd280b24f
22 changed files with 3566 additions and 14 deletions
53
Contrib/VPatch/Source/GUI/DLLWrapper.pas
Normal file
53
Contrib/VPatch/Source/GUI/DLLWrapper.pas
Normal file
|
@ -0,0 +1,53 @@
|
|||
unit DLLWrapper;
|
||||
|
||||
interface
|
||||
|
||||
uses Classes, SysUtils;
|
||||
|
||||
function DoGenerate(const Source, Target: String; Stream: TStream; Config: String): Integer; forward;
|
||||
|
||||
implementation
|
||||
|
||||
uses PatchGenerator;
|
||||
|
||||
function DoGenerate(const Source, Target: String; Stream: TStream; Config: String): Integer;
|
||||
var
|
||||
PG: TPatchGenerator;
|
||||
a: Integer;
|
||||
begin
|
||||
WriteLn('Generating '+ExtractFileName(Source)+' to '+ExtractFileName(Target)+'...');
|
||||
|
||||
PG:=TPatchGenerator.Create;
|
||||
PG.StartBlockSize:=512;
|
||||
PG.MinimumBlockSize:=512;
|
||||
PG.BlockDivider:=2;
|
||||
PG.StepSize:=256;
|
||||
try
|
||||
a:=Pos(',',Config);
|
||||
if(a=0) then a:=Length(Config)+1;
|
||||
PG.StartBlockSize:=StrToInt(Copy(Config,1,a-1));
|
||||
Config:=Copy(Config,a+1,Length(Config));
|
||||
|
||||
a:=Pos(',',Config);
|
||||
if(a=0) then a:=Length(Config)+1;
|
||||
PG.MinimumBlockSize:=StrToInt(Copy(Config,1,a-1));
|
||||
Config:=Copy(Config,a+1,Length(Config));
|
||||
|
||||
a:=Pos(',',Config);
|
||||
if(a=0) then a:=Length(Config)+1;
|
||||
PG.BlockDivider:=StrToInt(Copy(Config,1,a-1));
|
||||
Config:=Copy(Config,a+1,Length(Config));
|
||||
|
||||
a:=Pos(',',Config);
|
||||
if(a=0) then a:=Length(Config)+1;
|
||||
PG.StepSize:=StrToInt(Copy(Config,1,a-1));
|
||||
finally
|
||||
end;
|
||||
|
||||
Result:=PG.CreatePatch(Source,Target);
|
||||
PG.WriteToStream(Stream);
|
||||
PG.Free;
|
||||
WriteLn(ExtractFileName(Source)+' -> '+ExtractFileName(Target)+': '+IntToStr(Result)+' bytes');
|
||||
end;
|
||||
|
||||
end.
|
Loading…
Add table
Add a link
Reference in a new issue