From ef6b90b8e6e6c317fcda85a392c79324f91250db Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 25 Oct 2016 15:02:04 -0400 Subject: make controller project portable --- MediaBrowser.Common.Implementations/Archiving/ZipClient.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Common.Implementations/Archiving/ZipClient.cs') diff --git a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs index 1272e43b9..89cde3ff8 100644 --- a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs +++ b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs @@ -6,7 +6,8 @@ using SharpCompress.Common; using SharpCompress.Reader; using SharpCompress.Reader.Zip; using System.IO; -using CommonIO; +using MediaBrowser.Common.IO; +using MediaBrowser.Model.IO; namespace MediaBrowser.Common.Implementations.Archiving { -- cgit v1.2.3 From bdcaf5dd023a6bc0470915e07cc7fe7a46cb6c5d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 27 Oct 2016 23:11:21 -0400 Subject: trim nat project --- .../Archiving/ZipClient.cs | 4 +- .../EntryPoints/ExternalPortForwarding.cs | 19 - Mono.Nat/AbstractNatDevice.cs | 38 -- Mono.Nat/INatDevice.cs | 18 - Mono.Nat/Mono.Nat.csproj | 12 +- Mono.Nat/NatUtility.cs | 19 +- Mono.Nat/Pmp/PmpNatDevice.cs | 322 ++++++--------- .../Upnp/AsyncResults/GetAllMappingsAsyncResult.cs | 56 --- Mono.Nat/Upnp/AsyncResults/PortMapAsyncResult.cs | 75 ---- Mono.Nat/Upnp/Messages/ErrorMessage.cs | 5 - Mono.Nat/Upnp/Messages/GetServicesMessage.cs | 11 - .../Messages/Requests/CreatePortMappingMessage.cs | 20 - .../Messages/Requests/DeletePortMappingMessage.cs | 71 ---- .../Requests/GetExternalIPAddressMessage.cs | 56 --- .../Requests/GetGenericPortMappingEntry.cs | 67 ---- .../Requests/GetSpecificPortMappingEntryMessage.cs | 74 ---- .../Responses/CreatePortMappingResponseMessage.cs | 5 - .../Responses/DeletePortMappingResponseMessage.cs | 51 --- .../GetExternalIPAddressResponseMessage.cs | 59 --- .../GetGenericPortMappingEntryResponseMessage.cs | 114 ------ Mono.Nat/Upnp/Messages/UpnpMessage.cs | 70 ---- Mono.Nat/Upnp/UpnpNatDevice.cs | 433 +-------------------- 22 files changed, 143 insertions(+), 1456 deletions(-) delete mode 100644 Mono.Nat/Upnp/AsyncResults/GetAllMappingsAsyncResult.cs delete mode 100644 Mono.Nat/Upnp/AsyncResults/PortMapAsyncResult.cs delete mode 100644 Mono.Nat/Upnp/Messages/Requests/DeletePortMappingMessage.cs delete mode 100644 Mono.Nat/Upnp/Messages/Requests/GetExternalIPAddressMessage.cs delete mode 100644 Mono.Nat/Upnp/Messages/Requests/GetGenericPortMappingEntry.cs delete mode 100644 Mono.Nat/Upnp/Messages/Requests/GetSpecificPortMappingEntryMessage.cs delete mode 100644 Mono.Nat/Upnp/Messages/Responses/DeletePortMappingResponseMessage.cs delete mode 100644 Mono.Nat/Upnp/Messages/Responses/GetExternalIPAddressResponseMessage.cs delete mode 100644 Mono.Nat/Upnp/Messages/Responses/GetGenericPortMappingEntryResponseMessage.cs (limited to 'MediaBrowser.Common.Implementations/Archiving/ZipClient.cs') diff --git a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs index 89cde3ff8..24e816aef 100644 --- a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs +++ b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs @@ -6,8 +6,6 @@ using SharpCompress.Common; using SharpCompress.Reader; using SharpCompress.Reader.Zip; using System.IO; -using MediaBrowser.Common.IO; -using MediaBrowser.Model.IO; namespace MediaBrowser.Common.Implementations.Archiving { @@ -16,7 +14,7 @@ namespace MediaBrowser.Common.Implementations.Archiving /// public class ZipClient : IZipClient { - private IFileSystem _fileSystem; + private readonly IFileSystem _fileSystem; public ZipClient(IFileSystem fileSystem) { diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs index 3d860a27b..9db49f97a 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs @@ -91,9 +91,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints NatUtility.DeviceLost += NatUtility_DeviceLost; - // it is hard to say what one should do when an unhandled exception is raised - // because there isn't anything one can do about it. Probably save a log or ignored it. - NatUtility.UnhandledException += NatUtility_UnhandledException; NatUtility.StartDiscovery(); _timer = new PeriodicTimer(ClearCreatedRules, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)); @@ -184,21 +181,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints } } - void NatUtility_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - var ex = e.ExceptionObject as Exception; - - if (ex == null) - { - //_logger.Error("Unidentified error reported by Mono.Nat"); - } - else - { - // Seeing some blank exceptions coming through here - //_logger.ErrorException("Error reported by Mono.Nat: ", ex); - } - } - void NatUtility_DeviceFound(object sender, DeviceEventArgs e) { try @@ -287,7 +269,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints NatUtility.StopDiscovery(); NatUtility.DeviceFound -= NatUtility_DeviceFound; NatUtility.DeviceLost -= NatUtility_DeviceLost; - NatUtility.UnhandledException -= NatUtility_UnhandledException; } // Statements in try-block will no fail because StopDiscovery is a one-line // method that was no chances to fail. diff --git a/Mono.Nat/AbstractNatDevice.cs b/Mono.Nat/AbstractNatDevice.cs index e998a6ea4..1b4216002 100644 --- a/Mono.Nat/AbstractNatDevice.cs +++ b/Mono.Nat/AbstractNatDevice.cs @@ -52,43 +52,5 @@ namespace Mono.Nat } public abstract Task CreatePortMap(Mapping mapping); - - public virtual void DeletePortMap (Mapping mapping) - { - IAsyncResult result = BeginDeletePortMap (mapping, null, mapping); - EndDeletePortMap(result); - } - - public virtual Mapping[] GetAllMappings () - { - IAsyncResult result = BeginGetAllMappings (null, null); - return EndGetAllMappings (result); - } - - public virtual IPAddress GetExternalIP () - { - IAsyncResult result = BeginGetExternalIP(null, null); - return EndGetExternalIP(result); - } - - public virtual Mapping GetSpecificMapping (Protocol protocol, int port) - { - IAsyncResult result = this.BeginGetSpecificMapping (protocol, port, null, null); - return this.EndGetSpecificMapping(result); - } - - public abstract IAsyncResult BeginCreatePortMap(Mapping mapping, AsyncCallback callback, object asyncState); - public abstract IAsyncResult BeginDeletePortMap (Mapping mapping, AsyncCallback callback, object asyncState); - - public abstract IAsyncResult BeginGetAllMappings (AsyncCallback callback, object asyncState); - public abstract IAsyncResult BeginGetExternalIP (AsyncCallback callback, object asyncState); - public abstract IAsyncResult BeginGetSpecificMapping(Protocol protocol, int externalPort, AsyncCallback callback, object asyncState); - - public abstract void EndCreatePortMap (IAsyncResult result); - public abstract void EndDeletePortMap (IAsyncResult result); - - public abstract Mapping[] EndGetAllMappings (IAsyncResult result); - public abstract IPAddress EndGetExternalIP (IAsyncResult result); - public abstract Mapping EndGetSpecificMapping (IAsyncResult result); } } diff --git a/Mono.Nat/INatDevice.cs b/Mono.Nat/INatDevice.cs index 44ba5223b..b0401627b 100644 --- a/Mono.Nat/INatDevice.cs +++ b/Mono.Nat/INatDevice.cs @@ -37,26 +37,8 @@ namespace Mono.Nat public interface INatDevice { Task CreatePortMap (Mapping mapping); - void DeletePortMap (Mapping mapping); IPAddress LocalAddress { get; } - Mapping[] GetAllMappings (); - IPAddress GetExternalIP (); - Mapping GetSpecificMapping (Protocol protocol, int port); - - IAsyncResult BeginCreatePortMap (Mapping mapping, AsyncCallback callback, object asyncState); - IAsyncResult BeginDeletePortMap (Mapping mapping, AsyncCallback callback, object asyncState); - - IAsyncResult BeginGetAllMappings (AsyncCallback callback, object asyncState); - IAsyncResult BeginGetExternalIP (AsyncCallback callback, object asyncState); - IAsyncResult BeginGetSpecificMapping (Protocol protocol, int externalPort, AsyncCallback callback, object asyncState); - - void EndCreatePortMap (IAsyncResult result); - void EndDeletePortMap (IAsyncResult result); - - Mapping[] EndGetAllMappings (IAsyncResult result); - IPAddress EndGetExternalIP (IAsyncResult result); - Mapping EndGetSpecificMapping (IAsyncResult result); DateTime LastSeen { get; set; } } diff --git a/Mono.Nat/Mono.Nat.csproj b/Mono.Nat/Mono.Nat.csproj index c9d79bbdf..273bdb20c 100644 --- a/Mono.Nat/Mono.Nat.csproj +++ b/Mono.Nat/Mono.Nat.csproj @@ -56,20 +56,11 @@ - - - - - - - - - @@ -89,6 +80,9 @@ MediaBrowser.Model + + +