diff --git a/OpenRA.Launcher/InstallPackagesDialog.Designer.cs b/OpenRA.Launcher/InstallPackagesDialog.Designer.cs deleted file mode 100644 index 950c70b173..0000000000 --- a/OpenRA.Launcher/InstallPackagesDialog.Designer.cs +++ /dev/null @@ -1,186 +0,0 @@ -namespace OpenRA.Launcher -{ - partial class InstallPackagesDialog - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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; - } -} \ No newline at end of file diff --git a/OpenRA.Launcher/InstallPackagesDialog.cs b/OpenRA.Launcher/InstallPackagesDialog.cs deleted file mode 100644 index d8ceddbf54..0000000000 --- a/OpenRA.Launcher/InstallPackagesDialog.cs +++ /dev/null @@ -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(); - } - } -} diff --git a/OpenRA.Launcher/InstallPackagesDialog.resx b/OpenRA.Launcher/InstallPackagesDialog.resx deleted file mode 100644 index 4b460ef5c7..0000000000 --- a/OpenRA.Launcher/InstallPackagesDialog.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 186, 17 - - \ No newline at end of file diff --git a/OpenRA.Launcher/Launcher.cs b/OpenRA.Launcher/Launcher.cs index c6182ed894..3dde52d980 100644 --- a/OpenRA.Launcher/Launcher.cs +++ b/OpenRA.Launcher/Launcher.cs @@ -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(); diff --git a/OpenRA.Launcher/OpenRA.Launcher.csproj b/OpenRA.Launcher/OpenRA.Launcher.csproj index 9c06919767..1dbaa4e306 100644 --- a/OpenRA.Launcher/OpenRA.Launcher.csproj +++ b/OpenRA.Launcher/OpenRA.Launcher.csproj @@ -50,12 +50,6 @@ Launcher.cs - - Form - - - InstallPackagesDialog.cs - @@ -75,9 +69,6 @@ Launcher.cs - - InstallPackagesDialog.cs -