fix CD rip logic a little

will still fail on setup.z
This commit is contained in:
Matthias Mailänder
2012-06-02 21:17:42 +02:00
parent accaf027fe
commit 83ee6b758e
4 changed files with 15 additions and 12 deletions

View File

@@ -77,7 +77,6 @@ namespace OpenRA.Mods.D2k
{
var args = new WidgetArgs()
{
{ "continueLoading", () => TestAndContinue() },
{ "installData", Info }
};
Ui.OpenWindow(Info["InstallerMenuWidget"], args);

View File

@@ -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

View File

@@ -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 }
};

View File

@@ -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