fix CD rip logic a little
will still fail on setup.z
This commit is contained in:
@@ -77,7 +77,6 @@ namespace OpenRA.Mods.D2k
|
||||
{
|
||||
var args = new WidgetArgs()
|
||||
{
|
||||
{ "continueLoading", () => TestAndContinue() },
|
||||
{ "installData", Info }
|
||||
};
|
||||
Ui.OpenWindow(Info["InstallerMenuWidget"], args);
|
||||
|
||||
@@ -23,14 +23,12 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
||||
Widget panel;
|
||||
ProgressBarWidget progressBar;
|
||||
LabelWidget statusLabel;
|
||||
Action continueLoading;
|
||||
ButtonWidget retryButton, backButton;
|
||||
Widget installingContainer, insertDiskContainer;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public D2kInstallFromCDLogic(Widget widget, Action continueLoading)
|
||||
public D2kInstallFromCDLogic(Widget widget)
|
||||
{
|
||||
this.continueLoading = continueLoading;
|
||||
panel = widget.Get("INSTALL_FROMCD_PANEL");
|
||||
progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
|
||||
statusLabel = panel.Get<LabelWidget>("STATUS_LABEL");
|
||||
@@ -46,12 +44,18 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
||||
CheckForDisk();
|
||||
}
|
||||
|
||||
public static bool IsValidDisk(string diskRoot)
|
||||
{
|
||||
var files = new string[][] {
|
||||
new [] { diskRoot, "music", "ambush.aud" },
|
||||
};
|
||||
|
||||
return files.All(f => File.Exists(f.Aggregate(Path.Combine)));
|
||||
}
|
||||
|
||||
void CheckForDisk()
|
||||
{
|
||||
Func<string, bool> ValidDiskFilter = diskRoot => File.Exists(diskRoot+Path.DirectorySeparatorChar+"MAIN.MIX") &&
|
||||
File.Exists(new string[] { diskRoot, "setup", "setup.z" }.Aggregate(Path.Combine));
|
||||
|
||||
var path = InstallUtils.GetMountedDisk(ValidDiskFilter);
|
||||
var path = InstallUtils.GetMountedDisk(IsValidDisk);
|
||||
|
||||
if (path != null)
|
||||
Install(path);
|
||||
@@ -105,7 +109,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
||||
Game.RunAfterTick(() =>
|
||||
{
|
||||
Ui.CloseWindow();
|
||||
continueLoading();
|
||||
Game.Exit();
|
||||
});
|
||||
}
|
||||
catch
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
||||
public class D2kInstallLogic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public D2kInstallLogic(Widget widget, Dictionary<string,string> installData, Action continueLoading)
|
||||
public D2kInstallLogic(Widget widget, Dictionary<string,string> installData)
|
||||
{
|
||||
var panel = widget.Get("INSTALL_PANEL");
|
||||
var args = new WidgetArgs()
|
||||
{
|
||||
{ "afterInstall", () => { Ui.CloseWindow(); continueLoading(); } },
|
||||
{ "afterInstall", () => { Ui.CloseWindow(); Game.Exit(); } },
|
||||
{ "installData", installData }
|
||||
};
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ Background@INSTALL_PANEL:
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:150
|
||||
Height:25
|
||||
Text:Use CD (will crash)
|
||||
Text:Use CD (broken)
|
||||
Font:Bold
|
||||
Button@QUIT_BUTTON:
|
||||
X:PARENT_RIGHT - 140
|
||||
|
||||
Reference in New Issue
Block a user