2005-10-07 17:42:18 +02:00
|
|
|
program Attach;
|
|
|
|
|
|
|
|
{$APPTYPE CONSOLE}
|
|
|
|
|
|
|
|
uses
|
|
|
|
SysUtils, Classes, UnitPackSystem;
|
|
|
|
|
|
|
|
var eStream: TMemoryStream;
|
|
|
|
eFiles: TStringList;
|
2006-11-30 23:53:20 +01:00
|
|
|
Version: String;
|
2005-10-07 17:42:18 +02:00
|
|
|
begin
|
|
|
|
WriteLn('// File attacher for the MM:S installer');
|
|
|
|
WriteLn('// by Basic-Master');
|
|
|
|
WriteLn('');
|
|
|
|
WriteLn('// Looking up files...');
|
|
|
|
{ Check files }
|
2005-12-28 01:09:55 +01:00
|
|
|
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\hl2launch.exe') then
|
|
|
|
WriteLn('// Found files\hl2launch.exe')
|
|
|
|
else begin
|
|
|
|
WriteLn('// Error: Couldn''t find files\hl2launch.exe!');
|
|
|
|
ReadLn;
|
|
|
|
exit;
|
|
|
|
end;
|
2007-10-10 10:56:00 +02:00
|
|
|
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server.dll.source') then
|
|
|
|
WriteLn('// Found files\server.dll.source')
|
2005-10-07 17:42:18 +02:00
|
|
|
else begin
|
2007-10-10 10:56:00 +02:00
|
|
|
WriteLn('// Error: Couldn''t find files\server.dll.source!');
|
2005-10-07 17:42:18 +02:00
|
|
|
ReadLn;
|
|
|
|
exit;
|
|
|
|
end;
|
2007-10-10 10:56:00 +02:00
|
|
|
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.source') then
|
|
|
|
WriteLn('// Found files\server_i486.so.source')
|
2005-10-07 17:42:18 +02:00
|
|
|
else begin
|
2007-10-10 10:56:00 +02:00
|
|
|
WriteLn('// Error: Couldn''t find files\server_i486.so.source!');
|
|
|
|
ReadLn;
|
|
|
|
exit;
|
|
|
|
end;
|
|
|
|
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server.dll.orangebox') then
|
|
|
|
WriteLn('// Found files\server.dll.orangebox')
|
|
|
|
else begin
|
|
|
|
WriteLn('// Error: Couldn''t find files\server.dll.orangebox!');
|
|
|
|
ReadLn;
|
|
|
|
exit;
|
|
|
|
end;
|
|
|
|
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.orangebox') then
|
|
|
|
WriteLn('// Found files\server_i486.so.orangebox')
|
|
|
|
else begin
|
|
|
|
WriteLn('// Error: Couldn''t find files\server_i486.so.orangebox!');
|
2005-10-07 17:42:18 +02:00
|
|
|
ReadLn;
|
|
|
|
exit;
|
|
|
|
end;
|
|
|
|
if FileExists(ExtractFilePath(ParamStr(0)) + 'MMS_Installer.exe') then
|
|
|
|
WriteLn('// Found MMS_Installer.exe')
|
|
|
|
else begin
|
|
|
|
WriteLn('// Error: Couldn''t find MMS_Installer.exe!');
|
|
|
|
ReadLn;
|
|
|
|
exit;
|
|
|
|
end;
|
2006-11-30 23:53:20 +01:00
|
|
|
{ Get version number }
|
|
|
|
WriteLn('// Please enter the version number:');
|
|
|
|
ReadLn(Version);
|
|
|
|
if (Trim(Version) = '') then begin
|
|
|
|
WriteLn('// Error: Invalid version number!');
|
|
|
|
ReadLn;
|
|
|
|
exit;
|
|
|
|
end;
|
2005-10-07 17:42:18 +02:00
|
|
|
{ Compress files }
|
|
|
|
WriteLn('// Compressing files...');
|
|
|
|
eFiles := TStringList.Create;
|
2005-12-28 01:09:55 +01:00
|
|
|
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\hl2launch.exe');
|
2007-10-10 10:56:00 +02:00
|
|
|
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server.dll.source');
|
|
|
|
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.source');
|
|
|
|
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server.dll.orangebox');
|
|
|
|
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.orangebox');
|
2005-10-07 17:42:18 +02:00
|
|
|
eStream := TMemoryStream.Create;
|
|
|
|
CompressFiles(eFiles, ExtractFilePath(ParamStr(0)) + 'temp.zip');
|
|
|
|
eStream.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'temp.zip');
|
|
|
|
WriteLn('// Attaching output to MMS_Installer.exe...');
|
2006-11-30 23:53:20 +01:00
|
|
|
AttachToFile(ExtractFilePath(ParamStr(0)) + 'MMS_Installer.exe', eStream, Version);
|
2005-10-07 17:42:18 +02:00
|
|
|
DeleteFile(ExtractFilePath(ParamStr(0)) + 'temp.zip');
|
|
|
|
eStream.Free;
|
2007-10-10 10:56:00 +02:00
|
|
|
eFiles.Free;
|
2005-10-07 17:42:18 +02:00
|
|
|
WriteLn('// Done.');
|
|
|
|
ReadLn;
|
|
|
|
end.
|