added multi-account support

bumped version number to 1.2.4 (whoa, magic)

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40215
This commit is contained in:
Christian Hammacher 2006-06-27 22:39:42 +00:00
parent e36f74bc0f
commit 9d750ae4e6
6 changed files with 690 additions and 2421 deletions

Binary file not shown.

Binary file not shown.

View File

@ -253,7 +253,11 @@ begin
{ Unpack } { Unpack }
frmMain.ggeItem.Progress := 0; frmMain.ggeItem.Progress := 0;
AddStatus('Unpacking files...', clBlack); AddStatus('Unpacking files...', clBlack);
Unpack; if not Unpack() then begin
AddStatus('No files attached!', clRed);
Screen.Cursor := crDefault;
exit;
end;
AddDone; AddDone;
frmMain.ggeAll.Progress := 2; frmMain.ggeAll.Progress := 2;
frmMain.ggeItem.Progress := 1; frmMain.ggeItem.Progress := 1;
@ -428,7 +432,11 @@ begin
{ Unpack } { Unpack }
frmMain.ggeItem.Progress := 0; frmMain.ggeItem.Progress := 0;
AddStatus('Unpacking files...', clBlack); AddStatus('Unpacking files...', clBlack);
Unpack; if not Unpack() then begin
AddStatus('No files attached!', clRed);
Screen.Cursor := crDefault;
exit;
end;
AddDone; AddDone;
frmMain.ggeAll.Progress := 2; frmMain.ggeAll.Progress := 2;
frmMain.ggeItem.Progress := 1; frmMain.ggeItem.Progress := 1;

View File

@ -8,7 +8,7 @@ procedure CompressFiles(Files : TStrings; const Filename : String);
function DecompressStream(Stream : TMemoryStream; DestDirectory : String): Boolean; function DecompressStream(Stream : TMemoryStream; DestDirectory : String): Boolean;
function AttachToFile(const AFileName: string; MemoryStream: TMemoryStream): Boolean; function AttachToFile(const AFileName: string; MemoryStream: TMemoryStream): Boolean;
function LoadFromFile(const AFileName: string; MemoryStream: TMemoryStream): Boolean; function LoadFromFile(const AFileName: string; MemoryStream: TMemoryStream): Boolean;
procedure Unpack; function Unpack: Boolean;
implementation implementation
@ -164,15 +164,17 @@ end;
{ Unpack function } { Unpack function }
procedure Unpack; function Unpack: Boolean;
var eStream: TMemoryStream; var eStream: TMemoryStream;
begin begin
eStream := TMemoryStream.Create; eStream := TMemoryStream.Create;
try try
LoadFromFile(ParamStr(0), eStream); // Get ZIP LoadFromFile(ParamStr(0), eStream); // Get ZIP
DecompressStream(eStream, ExtractFilePath(ParamStr(0))); // Unpack files DecompressStream(eStream, ExtractFilePath(ParamStr(0))); // Unpack files
Result := True;
except except
raise Exception.Create('No files attached!'); Result := False;
end; end;
eStream.Free; eStream.Free;
end; end;

File diff suppressed because it is too large Load Diff

View File

@ -66,7 +66,7 @@ type
lblStep4: TLabel; lblStep4: TLabel;
jspInstallProgress: TJvStandardPage; jspInstallProgress: TJvStandardPage;
pnlHeader5: TPanel; pnlHeader5: TPanel;
imgIcon5: TImage; imgIcon4: TImage;
lblTitle5: TLabel; lblTitle5: TLabel;
lblSubTitle5: TLabel; lblSubTitle5: TLabel;
ggeAll: TFlatGauge; ggeAll: TFlatGauge;
@ -82,12 +82,11 @@ type
bvlSpacer5: TBevel; bvlSpacer5: TBevel;
jspSelectMod: TJvStandardPage; jspSelectMod: TJvStandardPage;
pnlSelectMod: TPanel; pnlSelectMod: TPanel;
imgIcon6: TImage; imgIcon5: TImage;
lblSelectMod: TLabel; lblSelectMod: TLabel;
lblSelectModInfo: TLabel; lblSelectModInfo: TLabel;
bvlSelectMod: TBevel; bvlSelectMod: TBevel;
lblInfo: TLabel; lblInfo: TLabel;
lstMods: TmxFlatListBox;
chkPassive: TFlatCheckBox; chkPassive: TFlatCheckBox;
lblStep3: TLabel; lblStep3: TLabel;
pnlOS: TPanel; pnlOS: TPanel;
@ -99,6 +98,9 @@ type
frbStandaloneServer: TFlatRadioButton; frbStandaloneServer: TFlatRadioButton;
tmrSpeed: TTimer; tmrSpeed: TTimer;
IdLogFile: TIdLogFile; IdLogFile: TIdLogFile;
shpMods: TShape;
trvMods: TTreeView;
FlatRadioButton1: TFlatRadioButton;
procedure jvwStepsCancelButtonClick(Sender: TObject); procedure jvwStepsCancelButtonClick(Sender: TObject);
procedure cmdCancelClick(Sender: TObject); procedure cmdCancelClick(Sender: TObject);
procedure cmdNextClick(Sender: TObject); procedure cmdNextClick(Sender: TObject);
@ -107,7 +109,6 @@ type
procedure cmdConnectClick(Sender: TObject); procedure cmdConnectClick(Sender: TObject);
procedure jplWizardChange(Sender: TObject); procedure jplWizardChange(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure lstModsClick(Sender: TObject);
procedure cmdProxySettingsClick(Sender: TObject); procedure cmdProxySettingsClick(Sender: TObject);
procedure txtPortChange(Sender: TObject); procedure txtPortChange(Sender: TObject);
procedure trvDirectoriesExpanded(Sender: TObject; Node: TTreeNode); procedure trvDirectoriesExpanded(Sender: TObject; Node: TTreeNode);
@ -120,6 +121,7 @@ type
var AllowExpansion: Boolean); var AllowExpansion: Boolean);
procedure trvDirectoriesCollapsing(Sender: TObject; Node: TTreeNode; procedure trvDirectoriesCollapsing(Sender: TObject; Node: TTreeNode;
var AllowCollapse: Boolean); var AllowCollapse: Boolean);
procedure trvModsClick(Sender: TObject);
private private
OldProgress: Integer; OldProgress: Integer;
CurrProgress: Integer; CurrProgress: Integer;
@ -130,7 +132,7 @@ type
var var
frmMain: TfrmMain; frmMain: TfrmMain;
var VERSION: String = '1.2.3'; var VERSION: String = '1.2.4';
implementation implementation
@ -154,6 +156,7 @@ var ePath: String;
eStr: TStringList; eStr: TStringList;
CurNode: TTreeNode; CurNode: TTreeNode;
eOS: TOS; eOS: TOS;
i: integer;
begin begin
{ FTP } { FTP }
if jplWizard.ActivePage = jspFTP then begin if jplWizard.ActivePage = jspFTP then begin
@ -198,55 +201,58 @@ begin
else if jplWizard.ActivePage = jspSelectMod then begin else if jplWizard.ActivePage = jspSelectMod then begin
{ Dedicated Server } { Dedicated Server }
if (frbDedicatedServer.Checked) or (frbStandaloneServer.Checked) then begin if (frbDedicatedServer.Checked) or (frbStandaloneServer.Checked) then begin
jspInstallProgress.Show; ePath := trvMods.Selected.Text;
ePath := lstMods.Items[lstMods.ItemIndex];
if ePath = 'Counter-Strike:Source' then if ePath = 'Counter-Strike:Source' then
ePath := 'cstrike' ePath := 'cstrike'
else if ePath = 'Day of Defeat:Source' then else if ePath = 'Day of Defeat:Source' then
ePath := 'dod' ePath := 'dod'
else else
ePath := 'hl2mp'; ePath := 'hl2mp';
ePath := 'SteamApps\' + trvMods.Selected.Parent.Text + '\source dedicated server\' + ePath;
// install it // install it
if frbDedicatedServer.Checked then begin if frbDedicatedServer.Checked then begin
if DirectoryExists(SteamPath + ePath) then if DirectoryExists(SteamPath + ePath) then begin
InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True) jspInstallProgress.Show;
InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True);
end
else begin else begin
MessageBox(Handle, 'Error: The directory of the mod you selected doesn''t exist any more. Run Dedicated Server with the chosen mod and try again.', PChar(Application.Title), MB_ICONERROR); MessageBox(Handle, 'Error: The directory of the mod you selected doesn''t exist any more. Run Dedicated Server with the chosen mod and try again.', PChar(Application.Title), MB_ICONERROR);
Application.Terminate; jspSelectMod.Show;
exit; exit;
end; end;
end end
else begin else begin
if DirectoryExists(StandaloneServer + ePath) then if DirectoryExists(StandaloneServer + ePath) then begin
jspInstallProgress.Show;
InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False) InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False)
end
else begin else begin
MessageBox(Handle, 'Error: The directory of the mod you selected doesn''t exist (any more). Run Half-Life Dedicated Server with the chosen mod again and restart.', PChar(Application.Title), MB_ICONERROR); MessageBox(Handle, 'Error: The directory of the mod you selected doesn''t exist (any more). Run Half-Life Dedicated Server with the chosen mod again and restart.', PChar(Application.Title), MB_ICONERROR);
Application.Terminate; jspSelectMod.Show;
exit; exit;
end; end;
end; end;
end; end;
{ Listen Server } { Listen Server }
if frbListenServer.Checked then begin if frbListenServer.Checked then begin
ePath := lstMods.Items[lstMods.ItemIndex]; ePath := trvMods.Selected.Text;
if ePath = 'Counter-Strike:Source' then if ePath = 'Counter-Strike:Source' then
ePath := SteamPath + 'counter-strike source\cstrike' ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\counter-strike source\cstrike'
else if ePath = 'Half-Life 2 Deathmatch' then else if ePath = 'Half-Life 2 Deathmatch' then
ePath := SteamPath + 'half-life 2 deathmatch\hl2mp' ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\half-life 2 deathmatch\hl2mp'
else else
ePath := SteamPath + 'Day Of Defeat source\dod'; ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\day of defeat source\dod';
if Pos(SteamPath, ePath) = 0 then if Pos(SteamPath, ePath) = 0 then
MessageBox(Handle, 'An error occured. Please report this bug to the Metamod:Source team and post a new thread on the forums of www.amxmodx.org.', PChar(Application.Title), MB_ICONSTOP) MessageBox(Handle, 'An error occured. Please report this bug to the Metamod:Source team and post a new thread on the forums of www.amxmodx.org.', PChar(Application.Title), MB_ICONSTOP)
else begin else begin
if not FileExists(ePath + '\gameinfo.txt') then begin if not FileExists(ePath + '\gameinfo.txt') then begin
MessageBox(Handle, 'You have to play this game once before installing Metamod:Source. Do this and try again.', PChar(Application.Title), MB_ICONWARNING); MessageBox(Handle, 'You have to play this game once before installing Metamod:Source. Do that and try again.', PChar(Application.Title), MB_ICONWARNING);
exit; exit;
end; end;
jspInstallProgress.Show; jspInstallProgress.Show;
ePath := IncludeTrailingPathDelimiter(ePath); InstallListen(IncludeTrailingPathDelimiter(ePath));
InstallListen(ePath);
end; end;
end; end;
{ Custom mod below } { Custom mod below }
@ -259,21 +265,33 @@ begin
try try
eRegistry.RootKey := HKEY_CURRENT_USER; eRegistry.RootKey := HKEY_CURRENT_USER;
if eRegistry.OpenKey('Software\Valve\Steam', False) then begin if eRegistry.OpenKey('Software\Valve\Steam', False) then begin
ePath := eRegistry.ReadString('ModInstallPath'); ePath := eRegistry.ReadString('SteamPath');
ePath := Copy(ePath, 1, Length(ePath) -10) + '\source dedicated server\'; ePath := IncludeTrailingPathDelimiter(StringReplace(ePath, '/', '\', [rfReplaceAll]));
SteamPath := ePath;
ePath := ePath + 'SteamApps\';
if DirectoryExists(ePath) then begin if DirectoryExists(ePath) then begin
SteamPath := ePath; trvMods.Items.Clear;
lstMods.Clear;
// Check Mods // Check Mods
if DirectoryExists(SteamPath + 'cstrike') then eStr := GetAllFiles(ePath + '*.*', faDirectory, False, True, False);
lstMods.Items.Add('Counter-Strike:Source'); for i := 0 to eStr.Count -1 do begin
if DirectoryExists(SteamPath + 'dod') then CurNode := trvMods.Items.Add(nil, eStr[i]);
lstMods.Items.Add('Day of Defeat:Source');
if DirectoryExists(SteamPath + 'hl2mp') then if DirectoryExists(ePath + eStr[i] + '\source dedicated server\cstrike') then
lstMods.Items.Add('Half-Life 2 Deatmatch'); trvMods.Items.AddChild(CurNode, 'Counter-Strike:Source');
if DirectoryExists(ePath + eStr[i] + '\source dedicated server\dod') then
trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
if DirectoryExists(ePath + eStr[i] + '\source dedicated server\hl2mp') then
trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
if CurNode.Count = 0 then
CurNode.Free
else
CurNode.Expand(False);
end;
// Misc // Misc
jspSelectMod.Show; jspSelectMod.Show;
lstMods.ItemIndex := -1; trvMods.Selected := nil;
cmdNext.Enabled := False; cmdNext.Enabled := False;
end end
else else
@ -290,21 +308,33 @@ begin
try try
eRegistry.RootKey := HKEY_CURRENT_USER; eRegistry.RootKey := HKEY_CURRENT_USER;
if eRegistry.OpenKey('Software\Valve\Steam', False) then begin if eRegistry.OpenKey('Software\Valve\Steam', False) then begin
ePath := eRegistry.ReadString('ModInstallPath') + '\'; ePath := eRegistry.ReadString('SteamPath');
lstMods.Clear; ePath := IncludeTrailingPathDelimiter(StringReplace(ePath, '/', '\', [rfReplaceAll]));
ePath := Copy(ePath, 1, Length(ePath) -10); SteamPath := ePath;
ePath := ePath + 'SteamApps\';
if DirectoryExists(ePath) then begin if DirectoryExists(ePath) then begin
SteamPath := ePath; trvMods.Items.Clear;
// Check Mods // Check Mods
if DirectoryExists(SteamPath + 'counter-strike source') then eStr := GetAllFiles(ePath + '*.*', faDirectory, False, True, False);
lstMods.Items.Add('Counter-Strike:Source'); for i := 0 to eStr.Count -1 do begin
if DirectoryExists(SteamPath + 'half-life 2 deathmatch') then CurNode := trvMods.Items.Add(nil, eStr[i]);
lstMods.Items.Add('Half-Life 2 Deathmatch');
if DirectoryExists(SteamPath + 'Day Of Defeat source') then if DirectoryExists(ePath + eStr[i] + '\counter-strike source') then
lstMods.Items.Add('Day of Defeat: Source'); trvMods.Items.AddChild(CurNode, 'Counter-Strike:Source');
if DirectoryExists(ePath + eStr[i] + '\day of defeat source') then
trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
if DirectoryExists(ePath + eStr[i] + '\half-life 2 deathmatch') then
trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
if CurNode.Count = 0 then
CurNode.Free
else
CurNode.Expand(False);
end;
// Misc // Misc
jspSelectMod.Show; jspSelectMod.Show;
lstMods.ItemIndex := -1; trvMods.Selected := nil;
cmdNext.Enabled := False; cmdNext.Enabled := False;
end end
else else
@ -323,12 +353,13 @@ begin
if eRegistry.OpenKey('Software\Valve\HLServer', False) then begin if eRegistry.OpenKey('Software\Valve\HLServer', False) then begin
StandaloneServer := IncludeTrailingPathDelimiter(eRegistry.ReadString('InstallPath')); StandaloneServer := IncludeTrailingPathDelimiter(eRegistry.ReadString('InstallPath'));
if DirectoryExists(StandaloneServer + 'cstrike') then if DirectoryExists(StandaloneServer + 'cstrike') then
lstMods.Items.Add('Counter-Strike:Source'); trvMods.Items.Add(nil, 'Counter-Strike:Source');
if DirectoryExists(StandaloneServer + 'dod') then if DirectoryExists(StandaloneServer + 'dod') then
lstMods.Items.Add('Day of Defeat:Source'); trvMods.Items.Add(nil, 'Day of Defeat:Source');
if DirectoryExists(StandaloneServer + 'hl2mp') then if DirectoryExists(StandaloneServer + 'hl2mp') then
lstMods.Items.Add('Half-Life 2 Deatmatch'); trvMods.Items.Add(nil, 'Half-Life 2 Deatmatch');
jspSelectMod.Show; jspSelectMod.Show;
cmdNext.Enabled := False;
end end
else else
MessageBox(Handle, 'You haven''t installed Half-Life Dedicated Server yet!', 'Error', MB_ICONWARNING); MessageBox(Handle, 'You haven''t installed Half-Life Dedicated Server yet!', 'Error', MB_ICONWARNING);
@ -512,11 +543,6 @@ begin
rtfDetails.Clear; rtfDetails.Clear;
end; end;
procedure TfrmMain.lstModsClick(Sender: TObject);
begin
cmdNext.Enabled := lstMods.ItemIndex <> -1;
end;
procedure TfrmMain.cmdProxySettingsClick(Sender: TObject); procedure TfrmMain.cmdProxySettingsClick(Sender: TObject);
begin begin
frmProxy.ShowModal; frmProxy.ShowModal;
@ -648,4 +674,12 @@ begin
Node.SelectedIndex := 0; Node.SelectedIndex := 0;
end; end;
procedure TfrmMain.trvModsClick(Sender: TObject);
begin
if Assigned(trvMods.Selected) then
cmdNext.Enabled := Assigned(trvMods.Selected.Parent)
else
cmdNext.Enabled := False;
end;
end. end.