Removed old code, made installing mods work.

This commit is contained in:
Matthew Bowra-Dean
2010-11-26 01:01:12 +13:00
parent db5b5698a7
commit ac513557a1
5 changed files with 1 additions and 434 deletions

View File

@@ -1,186 +0,0 @@
namespace OpenRA.Launcher
{
partial class InstallPackagesDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.radioPanel = new System.Windows.Forms.Panel();
this.progressPanel = new System.Windows.Forms.Panel();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.progressLabel = new System.Windows.Forms.Label();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.radioPanel.SuspendLayout();
this.progressPanel.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(13, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(280, 89);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(218, 163);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 1;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(109, 163);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(103, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Continue...";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(3, 3);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(138, 17);
this.radioButton1.TabIndex = 3;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Download From Internet";
this.radioButton1.UseVisualStyleBackColor = true;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(3, 26);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(96, 17);
this.radioButton2.TabIndex = 4;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "Install From CD";
this.radioButton2.UseVisualStyleBackColor = true;
//
// folderBrowserDialog1
//
this.folderBrowserDialog1.RootFolder = System.Environment.SpecialFolder.MyComputer;
this.folderBrowserDialog1.ShowNewFolderButton = false;
//
// radioPanel
//
this.radioPanel.Controls.Add(this.radioButton1);
this.radioPanel.Controls.Add(this.radioButton2);
this.radioPanel.Location = new System.Drawing.Point(12, 105);
this.radioPanel.Name = "radioPanel";
this.radioPanel.Size = new System.Drawing.Size(281, 52);
this.radioPanel.TabIndex = 5;
//
// progressPanel
//
this.progressPanel.Controls.Add(this.progressLabel);
this.progressPanel.Controls.Add(this.progressBar1);
this.progressPanel.Location = new System.Drawing.Point(12, 105);
this.progressPanel.Name = "progressPanel";
this.progressPanel.Size = new System.Drawing.Size(281, 52);
this.progressPanel.TabIndex = 6;
this.progressPanel.Visible = false;
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(3, 3);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(275, 23);
this.progressBar1.TabIndex = 0;
//
// progressLabel
//
this.progressLabel.AutoSize = true;
this.progressLabel.Location = new System.Drawing.Point(3, 29);
this.progressLabel.Name = "progressLabel";
this.progressLabel.Size = new System.Drawing.Size(0, 13);
this.progressLabel.TabIndex = 1;
//
// backgroundWorker1
//
this.backgroundWorker1.WorkerReportsProgress = true;
this.backgroundWorker1.WorkerSupportsCancellation = true;
this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
//
// InstallPackagesDialog
//
this.AcceptButton = this.button2;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(305, 198);
this.Controls.Add(this.progressPanel);
this.Controls.Add(this.radioPanel);
this.Controls.Add(this.button2);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "InstallPackagesDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Install Mod Files";
this.radioPanel.ResumeLayout(false);
this.radioPanel.PerformLayout();
this.progressPanel.ResumeLayout(false);
this.progressPanel.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
private System.Windows.Forms.Panel radioPanel;
private System.Windows.Forms.Panel progressPanel;
private System.Windows.Forms.Label progressLabel;
private System.Windows.Forms.ProgressBar progressBar1;
private System.ComponentModel.BackgroundWorker backgroundWorker1;
}
}

View File

@@ -1,112 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System;
using System.IO;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.IO.Pipes;
namespace OpenRA.Launcher
{
public partial class InstallPackagesDialog : Form
{
string mod;
public InstallPackagesDialog(string mod)
{
InitializeComponent();
Util.UacShield(button2);
this.mod = mod;
if (mod == "cnc") radioButton2.Enabled = false;
label1.Text = string.Format("In order to play OpenRA with the mod \"{0}\", you must install the original game files. " +
"These can either be downloaded or for some mods be installed from a CD copy of the original game. " +
"Please select your choice below and click continue", mod);
}
private void button2_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
radioPanel.Visible = false;
progressPanel.Visible = true;
button2.Enabled = false;
cancelButton.Enabled = false;
backgroundWorker1.RunWorkerAsync();
}
if (radioButton2.Checked && folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
var p = UtilityProgram.CallWithAdmin(string.Format("--install-{0}-packages", mod),
folderBrowserDialog1.SelectedPath + Path.DirectorySeparatorChar);
NamedPipeClientStream pipe = new NamedPipeClientStream(".", "OpenRA.Utility", PipeDirection.In);
pipe.Connect();
p.WaitForExit();
using (var response = new StreamReader(pipe))
{
string s = response.ReadToEnd();
if (Util.IsError(ref s))
DialogResult = DialogResult.No;
else
DialogResult = DialogResult.OK;
}
Close();
}
}
private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
var p = UtilityProgram.CallWithAdmin("--download-packages", mod);
Regex r = new Regex(@"(\d{1,3})% (\d+/\d+ bytes)");
NamedPipeClientStream pipe = new NamedPipeClientStream(".", "OpenRA.Utility", PipeDirection.In);
pipe.Connect();
using (var response = new StreamReader(pipe))
{
while (!p.HasExited)
{
string s = response.ReadLine();
if (Util.IsError(ref s))
{
e.Cancel = true;
e.Result = s;
return;
}
if (!r.IsMatch(s)) continue;
var m = r.Match(s);
backgroundWorker1.ReportProgress(int.Parse(m.Groups[1].Value), m.Groups[2].Value);
}
}
}
private void backgroundWorker1_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
progressLabel.Text = (string)e.UserState;
}
private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{
if (e.Cancelled)
{
MessageBox.Show((string)e.Result);
DialogResult = DialogResult.No;
}
else
DialogResult = DialogResult.OK;
progressPanel.Visible = false;
radioPanel.Visible = true;
Close();
}
}
}

View File

@@ -1,126 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>186, 17</value>
</metadata>
</root>

View File

@@ -114,7 +114,7 @@ namespace OpenRA.Launcher
private void InstallMod(object sender, EventArgs e)
{
if (installModDialog.ShowDialog() != DialogResult.OK) return;
var p = UtilityProgram.CallWithAdmin("--install-mod", installModDialog.FileName);
var p = UtilityProgram.CallWithAdmin("--extract-zip", installModDialog.FileName, "");
var pipe = new NamedPipeClientStream(".", "OpenRA.Utility", PipeDirection.In);
pipe.Connect();

View File

@@ -50,12 +50,6 @@
<Compile Include="Launcher.Designer.cs">
<DependentUpon>Launcher.cs</DependentUpon>
</Compile>
<Compile Include="InstallPackagesDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="InstallPackagesDialog.Designer.cs">
<DependentUpon>InstallPackagesDialog.cs</DependentUpon>
</Compile>
<Compile Include="Mod.cs" />
<Compile Include="Program.cs" />
<Compile Include="Util.cs" />
@@ -75,9 +69,6 @@
<EmbeddedResource Include="Launcher.resx">
<DependentUpon>Launcher.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="InstallPackagesDialog.resx">
<DependentUpon>InstallPackagesDialog.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />