Make it actually work
This commit is contained in:
@@ -18,6 +18,7 @@ using ICSharpCode.SharpZipLib.Zip;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Widgets;
|
||||
using System.Threading;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
{
|
||||
@@ -108,6 +109,8 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
window.GetWidget("CANCEL").OnMouseUp = mi => { ShowInstallMethodDialog(); return true; };
|
||||
window.GetWidget("RETRY").OnMouseUp = mi => PromptForCD();
|
||||
|
||||
var t = new Thread( _ =>
|
||||
{
|
||||
switch (Info.InstallMode)
|
||||
{
|
||||
case "ra":
|
||||
@@ -119,9 +122,11 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
Game.RunAfterTick(TestAndContinue);
|
||||
break;
|
||||
default:
|
||||
ShowDownloadError(window, "Installing from CD not supported");
|
||||
ShowError(window, "Installing from CD not supported");
|
||||
break;
|
||||
}
|
||||
}) { IsBackground = true };
|
||||
t.Start();
|
||||
}
|
||||
|
||||
void ShowDownloadDialog()
|
||||
@@ -142,7 +147,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
Action<AsyncCompletedEventArgs, bool> onDownloadComplete = (i, cancelled) =>
|
||||
{
|
||||
if (i.Error != null)
|
||||
ShowDownloadError(window, i.Error.Message);
|
||||
ShowError(window, i.Error.Message);
|
||||
else if (!cancelled)
|
||||
{
|
||||
// Automatically extract
|
||||
@@ -151,7 +156,6 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
|
||||
if (ExtractZip(window, file, Info.ResolvedPackagePath))
|
||||
Game.RunAfterTick(TestAndContinue);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -160,7 +164,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
window.GetWidget("RETRY").OnMouseUp = mi => { dl.Cancel(); ShowDownloadDialog(); return true; };
|
||||
}
|
||||
|
||||
void ShowDownloadError(Widget window, string e)
|
||||
void ShowError(Widget window, string e)
|
||||
{
|
||||
if (window.GetWidget<LabelWidget>("STATUS") != null) /* ugh */
|
||||
{
|
||||
@@ -202,7 +206,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
{
|
||||
if (!File.Exists(zipFile))
|
||||
{
|
||||
ShowDownloadError(window, "Invalid path: "+zipFile);
|
||||
ShowError(window, "Invalid path: "+zipFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -216,7 +220,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
{
|
||||
foreach(var f in extracted)
|
||||
File.Delete(f);
|
||||
ShowDownloadError(window, "Archive corrupt");
|
||||
ShowError(window, "Archive corrupt");
|
||||
return false;
|
||||
}
|
||||
status.GetText = () => "Extraction complete";
|
||||
@@ -231,9 +235,9 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
if (!Directory.Exists(destPath))
|
||||
Directory.CreateDirectory(destPath);
|
||||
|
||||
if (!Directory.Exists(srcPath)) { ShowDownloadError(window, "Cannot find "+package); return false; }
|
||||
if (!Directory.Exists(srcPath)) { ShowError(window, "Cannot find "+package); return false; }
|
||||
FileSystem.Mount(srcPath);
|
||||
if (!FileSystem.Exists(package)) { ShowDownloadError(window, "Cannot find "+package); return false; }
|
||||
if (!FileSystem.Exists(package)) { ShowError(window, "Cannot find "+package); return false; }
|
||||
FileSystem.Mount(package);
|
||||
|
||||
foreach (string s in files)
|
||||
@@ -260,7 +264,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
var fromPath = Path.Combine(srcPath, file);
|
||||
if (!File.Exists(fromPath))
|
||||
{
|
||||
ShowDownloadError(window, "Cannot find "+file);
|
||||
ShowError(window, "Cannot find "+file);
|
||||
return false;
|
||||
}
|
||||
status.GetText = () => "Extracting "+file.ToLowerInvariant();
|
||||
|
||||
@@ -58,10 +58,7 @@ namespace OpenRA.Utility
|
||||
|
||||
var supportDir = GetNamedArg(args, "--SupportDir");
|
||||
if (supportDir != null)
|
||||
{
|
||||
Log.LogPath = Path.Combine(supportDir.Replace("\"", ""), "Logs");
|
||||
Console.WriteLine("LogPath: {0}", Log.LogPath);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ GameInitInfo@INIT_SETUP:
|
||||
TestFile: conquer.mix
|
||||
GameTitle: Command & Conquer
|
||||
PackageURL:http://open-ra.org/get-dependency.php?file=cnc-packages
|
||||
PackagePath:^/packages/cnc
|
||||
PackagePath:^/Content/cnc
|
||||
InstallMode:cnc
|
||||
Delegate:GameInitDelegate
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Folders:
|
||||
./mods/cnc/bits
|
||||
./mods/cnc/uibits
|
||||
~./mods/cnc/packages
|
||||
~^/packages/cnc
|
||||
~^/Content/cnc
|
||||
|
||||
Packages:
|
||||
overrides.mix
|
||||
|
||||
@@ -3,7 +3,7 @@ GameInitInfo@INIT_SETUP:
|
||||
TestFile: redalert.mix
|
||||
GameTitle: Red Alert
|
||||
PackageURL:http://open-ra.org/get-dependency.php?file=ra-packages
|
||||
PackagePath:^/packages/ra
|
||||
PackagePath:^/Content/ra
|
||||
InstallMode:ra
|
||||
Delegate:GameInitDelegate
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Folders:
|
||||
./mods/ra/bits
|
||||
./mods/ra/uibits
|
||||
~./mods/ra/packages
|
||||
~^/packages/ra
|
||||
~^/Content/ra
|
||||
|
||||
Packages:
|
||||
~main.mix
|
||||
|
||||
Reference in New Issue
Block a user