Refactoring. Add a missing file.
This commit is contained in:
@@ -17,8 +17,6 @@ using System.Diagnostics;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.ComponentModel;
|
||||
using ICSharpCode.SharpZipLib;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
@@ -86,24 +84,21 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
var status = window.GetWidget<LabelWidget>("STATUS");
|
||||
status.GetText = () => "Initializing...";
|
||||
var progress = window.GetWidget<ProgressBarWidget>("PROGRESS");
|
||||
|
||||
// TODO: Download to a temp location or the support dir
|
||||
|
||||
|
||||
var dl = new Download(Info.PackageURL, file,
|
||||
|
||||
// Save the package to a temp file
|
||||
var file = Path.GetTempPath() + Path.DirectorySeparatorChar + Path.GetRandomFileName();
|
||||
Action<DownloadProgressChangedEventArgs> onDownloadChange = i =>
|
||||
{
|
||||
status.GetText = () => "Downloading {1}/{2} kB ({0}%)".F(i.ProgressPercentage, i.BytesReceived/1024, i.TotalBytesToReceive/1024);
|
||||
progress.Percentage = i.ProgressPercentage;
|
||||
},
|
||||
(i, cancelled) => {
|
||||
System.Console.WriteLine("here");
|
||||
progress.Percentage = i.ProgressPercentage;
|
||||
};
|
||||
|
||||
Action<AsyncCompletedEventArgs, bool> onDownloadComplete = (i, cancelled) =>
|
||||
{
|
||||
{
|
||||
if (i.Error != null)
|
||||
ShowDownloadError(i.Error.Message);
|
||||
ShowDownloadError(i.Error.Message);
|
||||
else if (!cancelled)
|
||||
{
|
||||
{
|
||||
// Automatically extract
|
||||
status.GetText = () => "Extracting...";
|
||||
@@ -120,9 +115,9 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
window.GetWidget<LabelWidget>("STATUS").GetText = () => s.Substring(7).Trim();
|
||||
},
|
||||
() => {if (!error) Game.RunAfterTick(() => ContinueLoading(Info));}));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var dl = new Download(Info.PackageURL, file, onDownloadChange, onDownloadComplete);
|
||||
window.GetWidget("CANCEL").OnMouseUp = mi => { dl.Cancel(); ShowInstallMethodDialog(); return true; };
|
||||
window.GetWidget("RETRY").OnMouseUp = mi => { dl.Cancel(); ShowDownloadDialog(); return true; };
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
public string TestFile;
|
||||
public string GameTitle;
|
||||
public string PackageURL;
|
||||
public string PackageName;
|
||||
public string PackagePath;
|
||||
|
||||
public override void DrawInner() {}
|
||||
|
||||
@@ -3,7 +3,6 @@ GameInitInfo@INIT_SETUP:
|
||||
TestFile: conquer.mix
|
||||
GameTitle: Command & Conquer
|
||||
PackageURL:http://open-ra.org/get-dependency.php?file=cnc-packages
|
||||
PackageName:cnc-packages.zip
|
||||
PackagePath:cnc/packages/
|
||||
Delegate:GameInitDelegate
|
||||
|
||||
|
||||
116
mods/ra/chrome/gameinit.yaml
Normal file
116
mods/ra/chrome/gameinit.yaml
Normal file
@@ -0,0 +1,116 @@
|
||||
GameInitInfo@INIT_SETUP:
|
||||
Id:INIT_SETUP
|
||||
TestFile: redalert.mix
|
||||
GameTitle: Red Alert
|
||||
PackageURL:http://open-ra.org/get-dependency.php?file=ra-packages
|
||||
PackagePath:ra/packages/
|
||||
Delegate:GameInitDelegate
|
||||
|
||||
Background@INIT_CHOOSEINSTALL:
|
||||
Id:INIT_CHOOSEINSTALL
|
||||
X:(WINDOW_RIGHT - WIDTH)/2
|
||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||
Width:500
|
||||
Height:160
|
||||
Children:
|
||||
Label@TITLE:
|
||||
X:0
|
||||
Y:20
|
||||
Width:PARENT_RIGHT
|
||||
Height:25
|
||||
Text:Install Required
|
||||
Align:Center
|
||||
Bold:True
|
||||
Label@DESC1:
|
||||
X:0
|
||||
Y:50
|
||||
Width:PARENT_RIGHT
|
||||
Height:25
|
||||
Text:OpenRA requires the original Red Alert game content.
|
||||
Align:Center
|
||||
Label@DESC2:
|
||||
X:0
|
||||
Y:70
|
||||
Width:PARENT_RIGHT
|
||||
Height:25
|
||||
Text:Content can be downloaded automatically or installed from CD.
|
||||
Align:Center
|
||||
Button@DOWNLOAD:
|
||||
Id:DOWNLOAD
|
||||
X:PARENT_RIGHT - 420
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:120
|
||||
Height:25
|
||||
Text:Download
|
||||
Bold:True
|
||||
Button@FROMCD:
|
||||
Id:FROMCD
|
||||
X:PARENT_RIGHT - 280
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:120
|
||||
Height:25
|
||||
Text:From CD
|
||||
Bold:True
|
||||
Button@QUIT:
|
||||
Id:QUIT
|
||||
X:PARENT_RIGHT - 140
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:120
|
||||
Height:25
|
||||
Text:Quit
|
||||
Bold:True
|
||||
|
||||
Background@INIT_DOWNLOAD:
|
||||
Id:INIT_DOWNLOAD
|
||||
X:(WINDOW_RIGHT - WIDTH)/2
|
||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||
Width:500
|
||||
Height:160
|
||||
Children:
|
||||
Label@TITLE:
|
||||
X:0
|
||||
Y:20
|
||||
Width:PARENT_RIGHT
|
||||
Height:25
|
||||
Text:Downloading Red Alert Content
|
||||
Align:Center
|
||||
Bold:True
|
||||
ProgressBar@PROGRESS:
|
||||
Id:PROGRESS
|
||||
X:50
|
||||
Y:55
|
||||
Width:PARENT_RIGHT - 100
|
||||
Height:25
|
||||
Label@STATUS:
|
||||
Id:STATUS
|
||||
X:50
|
||||
Y:80
|
||||
Width:PARENT_RIGHT - 100
|
||||
Height:25
|
||||
Align:Left
|
||||
Button@RETRY:
|
||||
Id:RETRY
|
||||
X:PARENT_RIGHT - 280
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:120
|
||||
Height:25
|
||||
Visible: false
|
||||
Text:Retry
|
||||
Bold:True
|
||||
Button@CANCEL:
|
||||
Id:CANCEL
|
||||
X:PARENT_RIGHT - 140
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:120
|
||||
Height:25
|
||||
Text:Cancel
|
||||
Bold:True
|
||||
Button@EXTRACT:
|
||||
Id:EXTRACT
|
||||
X:PARENT_RIGHT - 140
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:120
|
||||
Height:25
|
||||
Visible: false
|
||||
Text:Extract
|
||||
Bold:True
|
||||
Reference in New Issue
Block a user