| author | Scott Ehlert <ds@alliedmods.net> |
| Mon Nov 10 16:57:53 2008 -0600 (2008-11-10) | |
| changeset 537 | 2ebaf6a4f86f |
| parent 410 | fba5a97f575b |
| permissions | -rw-r--r-- |
| bmasterc@126 | 1 |
program Attach; |
| bmasterc@126 | 2 |
|
| bmasterc@126 | 3 |
{$APPTYPE CONSOLE} |
| bmasterc@126 | 4 |
|
| bmasterc@126 | 5 |
uses |
| bmasterc@126 | 6 |
SysUtils, Classes, UnitPackSystem; |
| bmasterc@126 | 7 |
|
| bmasterc@126 | 8 |
var eStream: TMemoryStream; |
| bmasterc@126 | 9 |
eFiles: TStringList; |
| bmasterc@268 | 10 |
Version: String; |
| bmasterc@126 | 11 |
begin |
| bmasterc@126 | 12 |
WriteLn('// File attacher for the MM:S installer'); |
| bmasterc@126 | 13 |
WriteLn('// by Basic-Master'); |
| bmasterc@126 | 14 |
WriteLn(''); |
| bmasterc@126 | 15 |
WriteLn('// Looking up files...'); |
| bmasterc@126 | 16 |
{ Check files } |
| bmasterc@169 | 17 |
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\hl2launch.exe') then |
| bmasterc@169 | 18 |
WriteLn('// Found files\hl2launch.exe') |
| bmasterc@169 | 19 |
else begin |
| bmasterc@169 | 20 |
WriteLn('// Error: Couldn''t find files\hl2launch.exe!'); |
| bmasterc@169 | 21 |
ReadLn; |
| bmasterc@169 | 22 |
exit; |
| bmasterc@169 | 23 |
end; |
| bmasterc@410 | 24 |
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server.dll.source') then |
| bmasterc@410 | 25 |
WriteLn('// Found files\server.dll.source') |
| bmasterc@126 | 26 |
else begin |
| bmasterc@410 | 27 |
WriteLn('// Error: Couldn''t find files\server.dll.source!'); |
| bmasterc@126 | 28 |
ReadLn; |
| bmasterc@126 | 29 |
exit; |
| bmasterc@126 | 30 |
end; |
| bmasterc@410 | 31 |
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.source') then |
| bmasterc@410 | 32 |
WriteLn('// Found files\server_i486.so.source') |
| bmasterc@126 | 33 |
else begin |
| bmasterc@410 | 34 |
WriteLn('// Error: Couldn''t find files\server_i486.so.source!'); |
| bmasterc@410 | 35 |
ReadLn; |
| bmasterc@410 | 36 |
exit; |
| bmasterc@410 | 37 |
end; |
| bmasterc@410 | 38 |
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server.dll.orangebox') then |
| bmasterc@410 | 39 |
WriteLn('// Found files\server.dll.orangebox') |
| bmasterc@410 | 40 |
else begin |
| bmasterc@410 | 41 |
WriteLn('// Error: Couldn''t find files\server.dll.orangebox!'); |
| bmasterc@410 | 42 |
ReadLn; |
| bmasterc@410 | 43 |
exit; |
| bmasterc@410 | 44 |
end; |
| bmasterc@410 | 45 |
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.orangebox') then |
| bmasterc@410 | 46 |
WriteLn('// Found files\server_i486.so.orangebox') |
| bmasterc@410 | 47 |
else begin |
| bmasterc@410 | 48 |
WriteLn('// Error: Couldn''t find files\server_i486.so.orangebox!'); |
| bmasterc@126 | 49 |
ReadLn; |
| bmasterc@126 | 50 |
exit; |
| bmasterc@126 | 51 |
end; |
| bmasterc@126 | 52 |
if FileExists(ExtractFilePath(ParamStr(0)) + 'MMS_Installer.exe') then |
| bmasterc@126 | 53 |
WriteLn('// Found MMS_Installer.exe') |
| bmasterc@126 | 54 |
else begin |
| bmasterc@126 | 55 |
WriteLn('// Error: Couldn''t find MMS_Installer.exe!'); |
| bmasterc@126 | 56 |
ReadLn; |
| bmasterc@126 | 57 |
exit; |
| bmasterc@126 | 58 |
end; |
| bmasterc@268 | 59 |
{ Get version number } |
| bmasterc@268 | 60 |
WriteLn('// Please enter the version number:'); |
| bmasterc@268 | 61 |
ReadLn(Version); |
| bmasterc@268 | 62 |
if (Trim(Version) = '') then begin |
| bmasterc@268 | 63 |
WriteLn('// Error: Invalid version number!'); |
| bmasterc@268 | 64 |
ReadLn; |
| bmasterc@268 | 65 |
exit; |
| bmasterc@268 | 66 |
end; |
| bmasterc@126 | 67 |
{ Compress files } |
| bmasterc@126 | 68 |
WriteLn('// Compressing files...'); |
| bmasterc@126 | 69 |
eFiles := TStringList.Create; |
| bmasterc@169 | 70 |
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\hl2launch.exe'); |
| bmasterc@410 | 71 |
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server.dll.source'); |
| bmasterc@410 | 72 |
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.source'); |
| bmasterc@410 | 73 |
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server.dll.orangebox'); |
| bmasterc@410 | 74 |
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.orangebox'); |
| bmasterc@126 | 75 |
eStream := TMemoryStream.Create; |
| bmasterc@126 | 76 |
CompressFiles(eFiles, ExtractFilePath(ParamStr(0)) + 'temp.zip'); |
| bmasterc@126 | 77 |
eStream.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'temp.zip'); |
| bmasterc@126 | 78 |
WriteLn('// Attaching output to MMS_Installer.exe...'); |
| bmasterc@268 | 79 |
AttachToFile(ExtractFilePath(ParamStr(0)) + 'MMS_Installer.exe', eStream, Version); |
| bmasterc@126 | 80 |
DeleteFile(ExtractFilePath(ParamStr(0)) + 'temp.zip'); |
| bmasterc@126 | 81 |
eStream.Free; |
| bmasterc@410 | 82 |
eFiles.Free; |
| bmasterc@126 | 83 |
WriteLn('// Done.'); |
| bmasterc@126 | 84 |
ReadLn; |
| bmasterc@126 | 85 |
end. |