From a4493f48d508634ffb648b74d8954b7b5c2726b3 Mon Sep 17 00:00:00 2001 From: Matthew Bowra-Dean Date: Fri, 31 Dec 2010 14:40:38 +1300 Subject: [PATCH] httpRequest in win launcher uses utility program. Clean up usings and add missing license notices. --- OpenRA.Launcher/Download.cs | 17 +++++++++++------ OpenRA.Launcher/JSBridge.cs | 21 +++++++++++++-------- OpenRA.Launcher/Launcher.cs | 2 +- OpenRA.Launcher/Mod.cs | 14 ++++++++++---- OpenRA.Launcher/Util.cs | 3 --- OpenRA.Launcher/UtilityProgram.cs | 4 ++-- 6 files changed, 37 insertions(+), 24 deletions(-) diff --git a/OpenRA.Launcher/Download.cs b/OpenRA.Launcher/Download.cs index 36dbc7f1f5..d1957f9b4c 100644 --- a/OpenRA.Launcher/Download.cs +++ b/OpenRA.Launcher/Download.cs @@ -1,9 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +#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.ComponentModel; +using System.IO; using System.IO.Pipes; using System.Text.RegularExpressions; using System.Windows.Forms; @@ -166,7 +172,6 @@ namespace OpenRA.Launcher void DoExtraction(object sender, DoWorkEventArgs e) { - var bgWorker = sender as BackgroundWorker; string[] args = e.Argument as string[]; string zipFile = args[0]; string destPath = args[1]; diff --git a/OpenRA.Launcher/JSBridge.cs b/OpenRA.Launcher/JSBridge.cs index e9c0ea90a4..91abe3771c 100644 --- a/OpenRA.Launcher/JSBridge.cs +++ b/OpenRA.Launcher/JSBridge.cs @@ -1,12 +1,19 @@ -using System; +#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.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; using System.Diagnostics; +using System.IO; +using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; -using System.Net; namespace OpenRA.Launcher { @@ -160,9 +167,7 @@ namespace OpenRA.Launcher public string httpRequest(string url) { - var wc = new WebClient(); - var data = wc.DownloadData(new Uri(url)); - return Encoding.UTF8.GetString(data); + return UtilityProgram.CallSimpleResponse("--download-url", url); } } } diff --git a/OpenRA.Launcher/Launcher.cs b/OpenRA.Launcher/Launcher.cs index 785125ccaa..30e3c7bdfb 100644 --- a/OpenRA.Launcher/Launcher.cs +++ b/OpenRA.Launcher/Launcher.cs @@ -120,7 +120,7 @@ namespace OpenRA.Launcher using (var response = new StreamReader(pipe)) { - string s = response.ReadToEnd(); + response.ReadToEnd(); } RefreshMods(); diff --git a/OpenRA.Launcher/Mod.cs b/OpenRA.Launcher/Mod.cs index 3815ab1a10..c8b79b4e39 100644 --- a/OpenRA.Launcher/Mod.cs +++ b/OpenRA.Launcher/Mod.cs @@ -1,7 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +#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; namespace OpenRA.Launcher { diff --git a/OpenRA.Launcher/Util.cs b/OpenRA.Launcher/Util.cs index 9a177e0a83..6a132f2a45 100644 --- a/OpenRA.Launcher/Util.cs +++ b/OpenRA.Launcher/Util.cs @@ -9,9 +9,6 @@ #endregion using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Runtime.InteropServices; using System.Windows.Forms; diff --git a/OpenRA.Launcher/UtilityProgram.cs b/OpenRA.Launcher/UtilityProgram.cs index b4326e83a3..0c5fd70353 100644 --- a/OpenRA.Launcher/UtilityProgram.cs +++ b/OpenRA.Launcher/UtilityProgram.cs @@ -12,8 +12,8 @@ using System; using System.ComponentModel; using System.Diagnostics; using System.IO; -using System.Text; using System.IO.Pipes; +using System.Text; namespace OpenRA.Launcher { @@ -81,7 +81,7 @@ namespace OpenRA.Launcher public static string CallSimpleResponse(string command, params string[] args) { - var p = Call(command, args); + Call(command, args); string responseString; NamedPipeClientStream pipe = new NamedPipeClientStream(".", "OpenRA.Utility", PipeDirection.In); pipe.Connect();