10,6 → 10,7 |
Windows, |
Classes, |
ZipMstr19, |
Dialogs, |
Functions in 'Functions.pas', |
SFXBehavior in 'SFXBehavior.pas'; |
|
19,14 → 20,12 |
ZIP_EXE = 'Tools\zip.exe'; |
RemoveSignature_EXE = 'Tools\RemoveSignature.exe'; |
|
procedure DoMakeSFX(AFilename: string); |
var |
Src, Dst: string; |
i: integer; |
Dst: string; |
s1, s2: TFileStream; |
x: TZipMaster19; |
|
resourcestring |
ImportantFileNotFound = 'Error: Important file "%s" not found!'; |
LngErrorWhileCopy = 'Error: Could not copy "%s" to "%s".'; |
LngErrorWhileExecuting = 'Error while executing "%s".'; |
SourceFileNotFound = 'Source file "%s" not found.'; |
38,46 → 37,20 |
Lng_ModifyZIPComment = 'Modify ZIP Comment...'; |
Lng_SignSfx = 'Sign the SFX...'; |
Lng_Finished = 'Finished! :-)'; |
Lng_Title = 'ViaThinkSoft AutoSFX'; |
Lng_Usage1 = 'Usage:'; |
Lng_Usage2 = 'MakeSFX [File1.zip [File2.zip...]]'; |
|
{$R *.res} |
|
begin |
WriteLn(Lng_Title); |
WriteLn(''); |
WriteLn(Lng_Usage1); |
WriteLn(Lng_Usage2); |
WriteLn(''); |
|
if not FileExists(ExtractFilePath(ParamStr(0)) + Extractor_EXE) then |
if not FileExists(AFilename) then |
begin |
WriteLn(Format(ImportantFileNotFound, [Extractor_EXE])); |
WriteLn(Format(SourceFileNotFound, [AFilename])); |
{$IFDEF DELAY_ON_ERROR} |
Sleep(2000); |
{$ENDIF} |
ExitCode := 2; |
ExitCode := 1; |
Exit; |
end; |
|
for i := 1 to ParamCount do |
begin |
Src := ParamStr(i); |
Dst := ChangeFileExt(AFilename, '.exe'); |
|
if not FileExists(Src) then |
begin |
WriteLn(Format(SourceFileNotFound, [Src])); |
{$IFDEF DELAY_ON_ERROR} |
Sleep(2000); |
{$ENDIF} |
ExitCode := 1; |
Continue; |
end; |
|
Dst := ChangeFileExt(Src, '.exe'); |
|
WriteLn(Format(Lng_In+#9+'%s', [Src])); |
WriteLn(Format(Lng_In+#9+'%s', [AFilename])); |
WriteLn(Format(Lng_Out+#9+'%s', [Dst])); |
WriteLn(''); |
|
88,7 → 61,7 |
Sleep(2000); |
{$ENDIF} |
ExitCode := 1; |
Continue; |
Exit; |
end; |
|
// Remove the signature of Extractor first (otherwise signing will fail later) |
104,7 → 77,7 |
Sleep(2000); |
{$ENDIF} |
ExitCode := 1; |
Continue; |
Exit; |
{$ENDIF} |
end; |
|
114,7 → 87,7 |
try |
s1.Seek(0, soEnd); |
|
s2 := TFileStream.Create(Src, fmOpenRead or fmShareDenyWrite); |
s2 := TFileStream.Create(AFilename, fmOpenRead or fmShareDenyWrite); |
try |
s1.CopyFrom(s2, s2.Size); |
finally |
134,7 → 107,7 |
Sleep(2000); |
{$ENDIF} |
ExitCode := 1; |
Continue; |
Exit; |
end; |
|
WriteLn(#9 + Lng_ModifyZIPComment); |
177,7 → 150,7 |
Sleep(2000); |
{$ENDIF} |
ExitCode := 1; |
Continue; |
Exit; |
{$ENDIF} |
end; |
|
185,5 → 158,59 |
WriteLn(''); |
end; |
|
{$R *.res} |
|
var |
i: integer; |
od: TOpenDialog; |
resourcestring |
Lng_Title = 'ViaThinkSoft AutoSFX'; |
Lng_Usage1 = 'Usage:'; |
Lng_Usage2 = 'MakeSFX [File1.zip [File2.zip...]]'; |
ImportantFileNotFound = 'Error: Important file "%s" not found!'; |
begin |
WriteLn(Lng_Title); |
WriteLn(''); |
WriteLn(Lng_Usage1); |
WriteLn(Lng_Usage2); |
WriteLn(''); |
|
if not FileExists(ExtractFilePath(ParamStr(0)) + Extractor_EXE) then |
begin |
WriteLn(Format(ImportantFileNotFound, [Extractor_EXE])); |
{$IFDEF DELAY_ON_ERROR} |
Sleep(2000); |
{$ENDIF} |
ExitCode := 2; |
Exit; |
end; |
|
if ParamCount = 0 then |
begin |
od := TOpenDialog.Create(nil); |
try |
od.DefaultExt := '.zip'; |
od.Filter := 'ZIP-Archiv (*.zip)|*.zip|Alle Dateien (*.*)|*.*'; |
od.Options := [ofAllowMultiSelect, ofFileMustExist, ofHideReadOnly, |
ofPathMustExist, ofEnableSizing]; |
if od.Execute then |
begin |
for i := 0 to od.Files.Count - 1 do |
begin |
DoMakeSFX(od.Files.Strings[i]); |
end; |
end; |
finally |
od.Free; |
end; |
end |
else |
begin |
for i := 1 to ParamCount do |
begin |
DoMakeSFX(ParamStr(i)); |
end; |
end; |
|
// TODO: Es gibt bei Win2000 außerhalb des debuggers eine AV... |
end. |