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