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