From 7ffb42d3fbef832ba8b201176328bfa10300abe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20S?= Date: Thu, 27 Oct 2016 17:52:52 +0200 Subject: [PATCH] Updated SendCommand. --- ASFui/Util.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ASFui/Util.cs b/ASFui/Util.cs index b49fb54..839e209 100644 --- a/ASFui/Util.cs +++ b/ASFui/Util.cs @@ -14,6 +14,8 @@ namespace ASFui { internal static class Util { + private static readonly BasicHttpBinding Binding = new BasicHttpBinding {SendTimeout = new TimeSpan(0, 30, 0)}; + public static bool CheckBinary() { return File.Exists(Settings.Default.ASFBinary) || !Settings.Default.IsLocal; @@ -21,10 +23,10 @@ public static bool CheckBinary() public static string SendCommand(string command) { - var binding = new BasicHttpBinding {SendTimeout = new TimeSpan(0, 30, 0)}; - var asfClient = new Client(binding, new EndpointAddress(GetEndpointAddress())); - - return asfClient.HandleCommand(command); + using (var asfClient = new Client(Binding, new EndpointAddress(GetEndpointAddress()))) + { + return asfClient.HandleCommand(command); + } } public static string GenerateCommand(string command, string user, string args = "")