Install cnc from cd
This commit is contained in:
@@ -72,7 +72,6 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public static void Mount(string name)
|
||||
{
|
||||
var start = name;
|
||||
var optional = name.StartsWith("~");
|
||||
if (optional) name = name.Substring(1);
|
||||
|
||||
|
||||
@@ -60,14 +60,23 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
}
|
||||
};
|
||||
|
||||
if (FileSystem.Exists(Info.TestFile))
|
||||
ContinueLoading();
|
||||
TestAndContinue();
|
||||
}
|
||||
|
||||
void TestAndContinue()
|
||||
{
|
||||
if (FileSystem.Exists(Info.TestFile))
|
||||
{
|
||||
Game.LoadShellMap();
|
||||
Widget.RootWidget.RemoveChildren();
|
||||
Widget.OpenWindow("MAINMENU_BG");
|
||||
}
|
||||
else
|
||||
{
|
||||
MainMenuButtonsDelegate.DisplayModSelector();
|
||||
ShowInstallMethodDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ShowInstallMethodDialog()
|
||||
{
|
||||
@@ -99,10 +108,20 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
window.GetWidget("CANCEL").OnMouseUp = mi => { ShowInstallMethodDialog(); return true; };
|
||||
window.GetWidget("RETRY").OnMouseUp = mi => PromptForCD();
|
||||
|
||||
if (Info.InstallMode != "ra")
|
||||
ShowDownloadError(window, "Installing from CD not supported");
|
||||
else if (InstallRAPackages(window, path, Info.ResolvedPackagePath))
|
||||
Game.RunAfterTick(ContinueLoading);
|
||||
switch (Info.InstallMode)
|
||||
{
|
||||
case "ra":
|
||||
if (InstallRAPackages(window, path, Info.ResolvedPackagePath))
|
||||
Game.RunAfterTick(TestAndContinue);
|
||||
break;
|
||||
case "cnc":
|
||||
if (InstallCncPackages(window, path, Info.ResolvedPackagePath))
|
||||
Game.RunAfterTick(TestAndContinue);
|
||||
break;
|
||||
default:
|
||||
ShowDownloadError(window, "Installing from CD not supported");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ShowDownloadDialog()
|
||||
@@ -131,7 +150,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
progress.Indeterminate = true;
|
||||
|
||||
if (ExtractZip(window, file, Info.ResolvedPackagePath))
|
||||
Game.RunAfterTick(ContinueLoading);
|
||||
Game.RunAfterTick(TestAndContinue);
|
||||
|
||||
}
|
||||
};
|
||||
@@ -150,13 +169,6 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
window.GetWidget<ButtonWidget>("CANCEL").IsVisible = () => true;
|
||||
}
|
||||
}
|
||||
|
||||
void ContinueLoading()
|
||||
{
|
||||
Game.LoadShellMap();
|
||||
Widget.RootWidget.RemoveChildren();
|
||||
Widget.OpenWindow("MAINMENU_BG");
|
||||
}
|
||||
|
||||
// General support methods
|
||||
public class Download
|
||||
@@ -265,6 +277,17 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
new string[] { "conquer.mix", "russian.mix", "allies.mix", "sounds.mix",
|
||||
"scores.mix", "snow.mix", "interior.mix", "temperat.mix" }, dest);
|
||||
}
|
||||
|
||||
bool InstallCncPackages(Widget window, string source, string dest)
|
||||
{
|
||||
if (!CopyFiles(window, source,
|
||||
new string[] { "CONQUER.MIX", "DESERT.MIX", "GENERAL.MIX", "SCORES.MIX",
|
||||
"SOUNDS.MIX", "TEMPERAT.MIX", "WINTER.MIX"},
|
||||
dest))
|
||||
return false;
|
||||
return ExtractFromPackage(window, source, "INSTALL/SETUP.Z",
|
||||
new string[] { "cclocal.mix", "speech.mix", "tempicnh.mix", "updatec.mix" }, dest);
|
||||
}
|
||||
}
|
||||
|
||||
static class InstallUtils
|
||||
|
||||
@@ -34,14 +34,11 @@ Background@INIT_CHOOSEINSTALL:
|
||||
Y:70
|
||||
Width:PARENT_RIGHT
|
||||
Height:25
|
||||
# Text:Content can be downloaded, or copied from the install CD.
|
||||
Text:A 6.1MB download is required.
|
||||
Text:Content can be downloaded, or copied from the install CD.
|
||||
Align:Center
|
||||
Button@DOWNLOAD:
|
||||
Id:DOWNLOAD
|
||||
# X:PARENT_RIGHT - 420
|
||||
# Y:PARENT_BOTTOM - 45
|
||||
X:PARENT_RIGHT - 280
|
||||
X:PARENT_RIGHT - 420
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:120
|
||||
Height:25
|
||||
@@ -54,7 +51,6 @@ Background@INIT_CHOOSEINSTALL:
|
||||
Width:120
|
||||
Height:25
|
||||
Text:From CD
|
||||
Visible:false
|
||||
Bold:True
|
||||
Button@QUIT:
|
||||
Id:QUIT
|
||||
|
||||
Reference in New Issue
Block a user