Subversion Repositories autosfx

Compare Revisions

Regard whitespace Rev HEAD → Rev 1

/MakeSFX.dpr
10,7 → 10,6
Windows,
Classes,
ZipMstr19,
Dialogs,
Functions in 'Functions.pas',
SFXBehavior in 'SFXBehavior.pas';
 
20,12 → 19,14
ZIP_EXE = 'Tools\zip.exe';
RemoveSignature_EXE = 'Tools\RemoveSignature.exe';
 
procedure DoMakeSFX(AFilename: string);
var
Dst: string;
Src, Dst: string;
i: integer;
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.';
37,20 → 38,46
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
if not FileExists(AFilename) then
WriteLn(Lng_Title);
WriteLn('');
WriteLn(Lng_Usage1);
WriteLn(Lng_Usage2);
WriteLn('');
 
if not FileExists(ExtractFilePath(ParamStr(0)) + Extractor_EXE) then
begin
WriteLn(Format(SourceFileNotFound, [AFilename]));
WriteLn(Format(ImportantFileNotFound, [Extractor_EXE]));
{$IFDEF DELAY_ON_ERROR}
Sleep(2000);
{$ENDIF}
ExitCode := 1;
ExitCode := 2;
Exit;
end;
 
Dst := ChangeFileExt(AFilename, '.exe');
for i := 1 to ParamCount do
begin
Src := ParamStr(i);
 
WriteLn(Format(Lng_In+#9+'%s', [AFilename]));
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_Out+#9+'%s', [Dst]));
WriteLn('');
 
61,7 → 88,7
Sleep(2000);
{$ENDIF}
ExitCode := 1;
Exit;
Continue;
end;
 
// Remove the signature of Extractor first (otherwise signing will fail later)
77,7 → 104,7
Sleep(2000);
{$ENDIF}
ExitCode := 1;
Exit;
Continue;
{$ENDIF}
end;
 
87,7 → 114,7
try
s1.Seek(0, soEnd);
 
s2 := TFileStream.Create(AFilename, fmOpenRead or fmShareDenyWrite);
s2 := TFileStream.Create(Src, fmOpenRead or fmShareDenyWrite);
try
s1.CopyFrom(s2, s2.Size);
finally
107,7 → 134,7
Sleep(2000);
{$ENDIF}
ExitCode := 1;
Exit;
Continue;
end;
 
WriteLn(#9 + Lng_ModifyZIPComment);
150,7 → 177,7
Sleep(2000);
{$ENDIF}
ExitCode := 1;
Exit;
Continue;
{$ENDIF}
end;
 
158,59 → 185,5
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.