ADD: Custom parameters support to pack operation via MultiArc

This commit is contained in:
Alexander Koblov 2011-03-07 16:04:56 +00:00
commit 3c4bc41f5d
4 changed files with 41 additions and 24 deletions

View file

@ -3,7 +3,7 @@
-------------------------------------------------------------------------
File packing window
Copyright (C) 2007-2010 Koblov Alexander (Alexx2000@mail.ru)
Copyright (C) 2007-2011 Koblov Alexander (Alexx2000@mail.ru)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -65,6 +65,7 @@ type
FArchiveTypeCount: Integer;
FExistsArchive : Boolean;
FSourceFileSource: IFileSource;
FCustomParams: UTF8String;
procedure AddArchiveType(const FileExt, ArcType: UTF8String);
public
{ public declarations }
@ -191,8 +192,9 @@ begin
if cbEncrypt.Checked then
Password:= InputBox(Caption, rsMsgPasswordEnter, EmptyStr);
if cbMultivolume.Checked then
VolumeSize:= StrToIntDef(InputBox(Caption, rsMsgVolumeSizeEnter, EmptyStr), 0);
VolumeSize:= InputBox(Caption, rsMsgVolumeSizeEnter, EmptyStr);
PackingFlags := aFlags;
CustomParams:= FCustomParams;
end;
end;
@ -265,12 +267,16 @@ var
WcxFileSource: IWcxArchiveFileSource;
begin
WcxFileSource := TWcxArchiveFileSource.CreateByArchiveName(FSourceFileSource, edtPackCmd.Text);
if Assigned(WcxFileSource) then
try
WcxFileSource.WcxModule.VFSConfigure(Handle);
finally
WcxFileSource := nil; // free interface
end;
if Assigned(WcxFileSource) then // WCX plugin
try
WcxFileSource.WcxModule.VFSConfigure(Handle);
finally
WcxFileSource := nil; // free interface
end
else // MultiArc addon
begin
FCustomParams:= InputBox(Caption, rsMsgArchiverCustomParams, FCustomParams);
end;
end;
procedure TfrmPackDlg.cbCreateSFXChange(Sender: TObject);
@ -294,6 +300,7 @@ begin
if rgPacker.ItemIndex = -1 then
rgPacker.ItemIndex := 0;
end;
FCustomParams:= EmptyStr;
cbPackerList.Enabled := cbOtherPlugins.Checked;
end;
@ -310,6 +317,7 @@ begin
edtPackCmd.Text := ChangeFileExt(edtPackCmd.Text, ExtensionSeparator + FArchiveType);
cbOtherPlugins.Checked := False;
end;
FCustomParams:= EmptyStr;
end;
procedure TfrmPackDlg.AddArchiveType(const FileExt, ArcType: UTF8String);

View file

@ -24,7 +24,8 @@ type
FFullFilesTree: TFiles;
FPackingFlags: Integer;
FPassword: UTF8String;
FVolumeSize: Int64;
FVolumeSize: UTF8String;
FCustomParams: UTF8String;
procedure ShowError(sMessage: String; logOptions: TLogOptions = []);
procedure LogMessage(sMessage: String; logOptions: TLogOptions; logMsgType: TLogMsgType);
@ -55,7 +56,8 @@ type
property PackingFlags: Integer read FPackingFlags write FPackingFlags;
property Password: UTF8String read FPassword write FPassword;
property VolumeSize: Int64 read FVolumeSize write FVolumeSize;
property VolumeSize: UTF8String read FVolumeSize write FVolumeSize;
property CustomParams: UTF8String read FCustomParams write FCustomParams;
end;
implementation
@ -73,7 +75,7 @@ begin
FFullFilesTree := nil;
FPackingFlags := 0;
FPassword := EmptyStr;
FVolumeSize := 0;
FVolumeSize := EmptyStr;
inherited Create(aSourceFileSource, aTargetFileSource, theSourceFiles, aTargetPath);
end;
@ -135,7 +137,7 @@ begin
ChangeFileListRoot(EmptyStr, FFullFilesTree);
with FMultiArchiveFileSource do
begin
if (VolumeSize <> 0) and (MultiArcItem.FAddMultiVolume <> EmptyStr) then
if (VolumeSize <> EmptyStr) and (MultiArcItem.FAddMultiVolume <> EmptyStr) then
sCommandLine:= MultiArcItem.FAddMultiVolume
else if (ExtractFileExt(ArchiveFileName) = GetSfxExt) and (MultiArcItem.FAddSelfExtract <> EmptyStr) then
sCommandLine:= MultiArcItem.FAddSelfExtract
@ -159,7 +161,8 @@ begin
sDestPath,
FTempFile,
Password,
VolumeSize
VolumeSize,
CustomParams
);
OnReadLn(sReadyCommand);
@ -185,7 +188,8 @@ begin
sDestPath,
FTempFile,
Password,
VolumeSize
VolumeSize,
CustomParams
);
OnReadLn(sReadyCommand);

View file

@ -65,7 +65,8 @@ function FormatArchiverCommand(const Archiver, sCmd, anArchiveName: UTF8String;
aDestPath: UTF8String = '';
sTempFile: UTF8String = '';
sPassword: UTF8String = '';
iVolumeSize: Int64 = 0): string;
sVolumeSize: UTF8String = '';
sCustomParams: UTF8String = ''): string;
implementation
@ -288,12 +289,13 @@ function FormatArchiverCommand(const Archiver, sCmd, anArchiveName: UTF8String;
aDestPath: UTF8String;
sTempFile: UTF8String;
sPassword: UTF8String;
iVolumeSize: Int64): string;
sVolumeSize: UTF8String;
sCustomParams: UTF8String): string;
type
TFunctType = (ftNone, ftArchiverLongName, ftArchiverShortName,
ftArchiveLongName, ftArchiveShortName,
ftFileListLongName, ftFileListShortName, ftFileName, ftTargetArchiveDir,
ftVolumeSize, ftPassword);
ftVolumeSize, ftPassword, ftCustomParams);
TStatePos = (spNone, spPercent, spFunction, spComplete);
TFuncModifiers = set of (fmOnlyFiles, fmQuoteWithSpaces, fmQuoteAny, fmNameOnly,
fmPathOnly, fmUTF8, fmAnsi);
@ -377,14 +379,11 @@ var
ftTargetArchiveDir:
Result := BuildName(aDestPath);
ftVolumeSize:
begin
if iVolumeSize > 0 then
Result:= IntToStr(iVolumeSize)
else
Result:= EmptyStr;
end;
Result:= sVolumeSize;
ftPassword:
Result:= sPassword;
ftCustomParams:
Result:= sCustomParams;
else
Exit('');
end;
@ -522,6 +521,11 @@ begin
state.funct := ftPassword;
state.pos := spFunction;
end;
'S':
begin
state.funct := ftCustomParams;
state.pos := spFunction;
end;
else
state.pos := spFunction;
end;
@ -593,4 +597,4 @@ begin
end;
end.

View file

@ -88,6 +88,7 @@ resourcestring
rsMsgManualEditHotDir = 'Manualy edit hot path';
rsMsgManualHotDirQuery = 'Enter name and path (format name=path):';
rsMsgVolumeSizeEnter = 'Please enter the volume size:';
rsMsgArchiverCustomParams = 'Additional parameters for archiver command-line:';
rsMsgMasterPassword = 'Master Password';
rsMsgMasterPasswordEnter = 'Please enter the master password:';
rsMsgPasswordEnter = 'Please enter the password:';