From b6d3c28fa1c745c625423d7bcaa416877e92494a Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 10 Aug 2013 13:30:27 -0700 Subject: [PATCH] minor cleanup --- .../{Host => AccessControl}/FirewallAdapter.cs | 13 ++++--------- .../{Host => AccessControl}/UrlAclAdapter.cs | 4 +--- NzbDrone.Host/ApplicationServer.cs | 2 +- NzbDrone.Host/NzbDrone.Host.csproj | 4 ++-- NzbDrone/NzbDrone.csproj | 3 --- NzbDrone/Resources/NzbDroneIcon.bmp | Bin 3382 -> 0 bytes 6 files changed, 8 insertions(+), 18 deletions(-) rename NzbDrone.Host/{Host => AccessControl}/FirewallAdapter.cs (92%) rename NzbDrone.Host/{Host => AccessControl}/UrlAclAdapter.cs (97%) delete mode 100644 NzbDrone/Resources/NzbDroneIcon.bmp diff --git a/NzbDrone.Host/Host/FirewallAdapter.cs b/NzbDrone.Host/AccessControl/FirewallAdapter.cs similarity index 92% rename from NzbDrone.Host/Host/FirewallAdapter.cs rename to NzbDrone.Host/AccessControl/FirewallAdapter.cs index 044ed12d3..96fb87679 100644 --- a/NzbDrone.Host/Host/FirewallAdapter.cs +++ b/NzbDrone.Host/AccessControl/FirewallAdapter.cs @@ -3,12 +3,11 @@ using NetFwTypeLib; using NLog; using NzbDrone.Core.Configuration; -namespace NzbDrone.Host.Host +namespace NzbDrone.Host.AccessControl { public interface IFirewallAdapter { void MakeAccessible(); - bool IsNzbDronePortOpen(); } public class FirewallAdapter : IFirewallAdapter @@ -24,8 +23,6 @@ namespace NzbDrone.Host.Host public void MakeAccessible() { - int port = 0; - if (IsFirewallEnabled()) { if (IsNzbDronePortOpen()) @@ -42,7 +39,7 @@ namespace NzbDrone.Host.Host } - public bool IsNzbDronePortOpen() + private bool IsNzbDronePortOpen() { try { @@ -75,7 +72,7 @@ namespace NzbDrone.Host.Host try { var type = Type.GetTypeFromProgID("HNetCfg.FWOpenPort", false); - var port = Activator.CreateInstance(type) as INetFwOpenPort; + var port = (INetFwOpenPort)Activator.CreateInstance(type); port.Port = portNumber; port.Name = "NzbDrone"; @@ -94,7 +91,7 @@ namespace NzbDrone.Host.Host } } - private int CloseFirewallPort() + private void CloseFirewallPort() { try { @@ -116,14 +113,12 @@ namespace NzbDrone.Host.Host if (portNumber != _configFileProvider.Port) { ports.Remove(portNumber, NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_TCP); - return portNumber; } } catch (Exception ex) { _logger.WarnException("Failed to close port in firewall for NzbDrone", ex); } - return 0; } private bool IsFirewallEnabled() diff --git a/NzbDrone.Host/Host/UrlAclAdapter.cs b/NzbDrone.Host/AccessControl/UrlAclAdapter.cs similarity index 97% rename from NzbDrone.Host/Host/UrlAclAdapter.cs rename to NzbDrone.Host/AccessControl/UrlAclAdapter.cs index ac9469690..03a0e6c8d 100644 --- a/NzbDrone.Host/Host/UrlAclAdapter.cs +++ b/NzbDrone.Host/AccessControl/UrlAclAdapter.cs @@ -4,7 +4,7 @@ using NzbDrone.Common; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.Configuration; -namespace NzbDrone.Host.Host +namespace NzbDrone.Host.AccessControl { public interface IUrlAclAdapter { @@ -43,8 +43,6 @@ namespace NzbDrone.Host.Host { try { - - var process = _processProvider.ShellExecute("netsh.exe", arguments); process.WaitForExit(5000); } diff --git a/NzbDrone.Host/ApplicationServer.cs b/NzbDrone.Host/ApplicationServer.cs index f91720d68..089be7982 100644 --- a/NzbDrone.Host/ApplicationServer.cs +++ b/NzbDrone.Host/ApplicationServer.cs @@ -4,7 +4,7 @@ using NLog; using NzbDrone.Common; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.Configuration; -using NzbDrone.Host.Host; +using NzbDrone.Host.AccessControl; using NzbDrone.Host.Owin; namespace NzbDrone.Host diff --git a/NzbDrone.Host/NzbDrone.Host.csproj b/NzbDrone.Host/NzbDrone.Host.csproj index df614234b..025568f03 100644 --- a/NzbDrone.Host/NzbDrone.Host.csproj +++ b/NzbDrone.Host/NzbDrone.Host.csproj @@ -107,8 +107,8 @@ Component - - + + diff --git a/NzbDrone/NzbDrone.csproj b/NzbDrone/NzbDrone.csproj index dd99af137..6bf15cf39 100644 --- a/NzbDrone/NzbDrone.csproj +++ b/NzbDrone/NzbDrone.csproj @@ -121,9 +121,6 @@ Resources.Designer.cs - - - diff --git a/NzbDrone/Resources/NzbDroneIcon.bmp b/NzbDrone/Resources/NzbDroneIcon.bmp deleted file mode 100644 index 55516c7aaa3591604865d4cd18379f8f650c3104..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3382 zcmeIwA#&YN425B3CLjUbgJ57$uqM1+gO+lZkut%6E<(#F6wORPc)-i=r?4!c_Vwp; zZ3Fx2>gm_x54#?Zw`LE_etx;JyM1xL@%<_@PLnpcGPUluKQDjn-|L&12NJySLSxLr z;9wF7q0kt!G&lm>q)=$g*LR%^B!og^%$Qm^0tune7=F^=2qc6;W6U^h9D#&TXpDvN zo8~x1LMSw5m*!3e5<;OdyXkPr%u*^;D_frLmI06Zw(3st}a59h(3XRzqWFR3F8nf*xCj$wg(3oxIax#z*3XRz|Zzlr@q3r$RV$Z*g8j2NO iuBTlt#|(_)(Q$tsX9dm*oE11La8}@~z*&L+tOB3FDm>c&