From 36ffebbb49e6e54cd062848882df40ccbb8922a0 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 1 Dec 2014 08:17:37 +0100 Subject: [PATCH] Adds usings for the http request, client and response --- src/Umbraco.Web/Install/InstallHelper.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web/Install/InstallHelper.cs b/src/Umbraco.Web/Install/InstallHelper.cs index c08dac71d8..da0cb3c7ee 100644 --- a/src/Umbraco.Web/Install/InstallHelper.cs +++ b/src/Umbraco.Web/Install/InstallHelper.cs @@ -41,7 +41,7 @@ namespace Umbraco.Web.Install public IEnumerable GetAllSteps() { return new List - { + { new NewInstallStep(_umbContext.Application), new UpgradeStep(), new FilePermissionsStep(), @@ -87,12 +87,12 @@ namespace Umbraco.Web.Install { Directory.Move(IOHelper.MapPath(SystemDirectories.Install), IOHelper.MapPath("~/app_data/temp/install_backup")); } - } + } if (Directory.Exists(IOHelper.MapPath("~/Areas/UmbracoInstall"))) - { + { Directory.Delete(IOHelper.MapPath("~/Areas/UmbracoInstall"), true); - } + } } internal void InstallStatus(bool isCompleted, string errorMsg) @@ -193,14 +193,17 @@ namespace Umbraco.Web.Install { var requestUri = string.Format("http://our.umbraco.org/webapi/StarterKit/Get/?umbracoVersion={0}", UmbracoVersion.Current); - var request = new HttpRequestMessage(HttpMethod.Get, requestUri); - var httpClient = new HttpClient(); - var response = httpClient.SendAsync(request).Result; - packages = response.Content.ReadAsAsync>().Result.ToList(); + + using (var request = new HttpRequestMessage(HttpMethod.Get, requestUri)) + using (var httpClient = new HttpClient()) + using (var response = httpClient.SendAsync(request).Result) + { + packages = response.Content.ReadAsAsync>().Result.ToList(); + } } catch (AggregateException ex) { - LogHelper.Error("Could not download list of available starter kits", ex); + LogHelper.Error("Could not download list of available starter kits", ex); } return packages;