From 22093c9e8fe15691cca79795acc2616a8b7ec4ff Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sat, 15 Dec 2018 19:53:09 +0100 Subject: [PATCH 1/3] Removed some warnings --- DvdLib/Ifo/ProgramChain.cs | 1 - Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs | 17 +++++++---------- Emby.IsoMounting/IsoMounter/LinuxMount.cs | 3 --- .../Library/LibraryManager.cs | 2 +- Mono.Nat/Pmp/PmpNatDevice.cs | 4 ++-- RSSDP/DiscoveredSsdpDevice.cs | 4 +--- RSSDP/SsdpDeviceLocator.cs | 4 ++-- RSSDP/SsdpDevicePublisher.cs | 4 ++-- SocketHttpListener/Net/HttpListenerContext.cs | 6 ------ .../Net/HttpListenerRequestUriBuilder.cs | 6 +++--- SocketHttpListener/WebSocket.cs | 8 ++++---- 11 files changed, 22 insertions(+), 37 deletions(-) diff --git a/DvdLib/Ifo/ProgramChain.cs b/DvdLib/Ifo/ProgramChain.cs index 57cb5d6bd0..6b4e5fa32f 100644 --- a/DvdLib/Ifo/ProgramChain.cs +++ b/DvdLib/Ifo/ProgramChain.cs @@ -35,7 +35,6 @@ namespace DvdLib.Ifo private ushort _goupProgramNumber; public readonly ProgramChain Goup; // ?? maybe Group - private byte _playbackMode; public ProgramPlaybackMode PlaybackMode { get; private set; } public uint ProgramCount { get; private set; } diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs index 12669d05d3..4716c64b20 100644 --- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs +++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs @@ -144,24 +144,21 @@ namespace IsoMounter return Task.FromResult(false); } - public async Task Mount(string isoPath, CancellationToken cancellationToken) + public Task Mount(string isoPath, CancellationToken cancellationToken) { - LinuxMount mountedISO; - if (MountISO(isoPath, out mountedISO)) { - - return mountedISO; - - }else{ - + if (MountISO(isoPath, out mountedISO)) + { + return Task.FromResult(mountedISO); + } + else + { throw new IOException(String.Format( "An error occurred trying to mount image [$0].", isoPath )); - } - } #endregion diff --git a/Emby.IsoMounting/IsoMounter/LinuxMount.cs b/Emby.IsoMounting/IsoMounter/LinuxMount.cs index 8d1f56e395..9c60f9d0a8 100644 --- a/Emby.IsoMounting/IsoMounter/LinuxMount.cs +++ b/Emby.IsoMounting/IsoMounter/LinuxMount.cs @@ -1,8 +1,5 @@ using System; -using MediaBrowser.Model.Diagnostics; using MediaBrowser.Model.IO; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.System; namespace IsoMounter { diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 31af9370c7..17516d6b90 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -3179,4 +3179,4 @@ namespace Emby.Server.Implementations.Library CollectionFolder.SaveLibraryOptions(virtualFolderPath, libraryOptions); } } -} \ No newline at end of file +} diff --git a/Mono.Nat/Pmp/PmpNatDevice.cs b/Mono.Nat/Pmp/PmpNatDevice.cs index 2ef66fdbb6..bf27bfebcb 100644 --- a/Mono.Nat/Pmp/PmpNatDevice.cs +++ b/Mono.Nat/Pmp/PmpNatDevice.cs @@ -109,7 +109,7 @@ namespace Mono.Nat.Pmp if (attempt == 0) { - Task.Run(() => CreatePortMapListen(udpClient, mapping, cancellationTokenSource.Token)); + await Task.Run(() => CreatePortMapListen(udpClient, mapping, cancellationTokenSource.Token)); } attempt++; @@ -214,4 +214,4 @@ namespace Mono.Nat.Pmp this.localAddress, this.publicAddress, this.LastSeen); } } -} \ No newline at end of file +} diff --git a/RSSDP/DiscoveredSsdpDevice.cs b/RSSDP/DiscoveredSsdpDevice.cs index 66b8bea36a..7e70817ddf 100644 --- a/RSSDP/DiscoveredSsdpDevice.cs +++ b/RSSDP/DiscoveredSsdpDevice.cs @@ -17,7 +17,6 @@ namespace Rssdp #region Fields - private SsdpRootDevice _Device; private DateTimeOffset _AsAt; #endregion @@ -55,7 +54,6 @@ namespace Rssdp if (_AsAt != value) { _AsAt = value; - _Device = null; } } } @@ -93,4 +91,4 @@ namespace Rssdp #endregion } -} \ No newline at end of file +} diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.cs index 6a61a52f3e..32289822f9 100644 --- a/RSSDP/SsdpDeviceLocator.cs +++ b/RSSDP/SsdpDeviceLocator.cs @@ -124,7 +124,7 @@ namespace Rssdp.Infrastructure { await SearchAsync(CancellationToken.None).ConfigureAwait(false); } - catch (Exception ex) + catch (Exception) { } @@ -621,4 +621,4 @@ namespace Rssdp.Infrastructure #endregion } -} \ No newline at end of file +} diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs index 8d57deb5ef..2646023e89 100644 --- a/RSSDP/SsdpDevicePublisher.cs +++ b/RSSDP/SsdpDevicePublisher.cs @@ -312,7 +312,7 @@ namespace Rssdp.Infrastructure { await _CommsServer.SendMessage(System.Text.Encoding.UTF8.GetBytes(message), endPoint, receivedOnlocalIpAddress, cancellationToken).ConfigureAwait(false); } - catch (Exception ex) + catch (Exception) { } @@ -558,4 +558,4 @@ namespace Rssdp.Infrastructure } } } -} \ No newline at end of file +} diff --git a/SocketHttpListener/Net/HttpListenerContext.cs b/SocketHttpListener/Net/HttpListenerContext.cs index f4679568a3..b90f075671 100644 --- a/SocketHttpListener/Net/HttpListenerContext.cs +++ b/SocketHttpListener/Net/HttpListenerContext.cs @@ -1,19 +1,13 @@ using System; using System.Net; using System.Security.Principal; -using MediaBrowser.Model.Cryptography; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Text; using SocketHttpListener.Net.WebSockets; -using SocketHttpListener.Primitives; using System.Threading.Tasks; namespace SocketHttpListener.Net { public sealed unsafe partial class HttpListenerContext { - internal HttpListener _listener; private HttpListenerResponse _response; private IPrincipal _user; diff --git a/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs b/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs index e61bde32e3..34b5eaf74b 100644 --- a/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs +++ b/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs @@ -253,7 +253,7 @@ namespace SocketHttpListener.Net //if (NetEventSource.IsEnabled) // NetEventSource.Error(this, SR.Format(SR.net_log_listener_cant_convert_percent_value, codePoint)); } - catch (EncoderFallbackException e) + catch (EncoderFallbackException) { // If utf8Encoding.GetBytes() fails //if (NetEventSource.IsEnabled) NetEventSource.Error(this, SR.Format(SR.net_log_listener_cant_convert_to_utf8, unicodeString, e.Message)); @@ -303,11 +303,11 @@ namespace SocketHttpListener.Net return true; } - catch (DecoderFallbackException e) + catch (DecoderFallbackException) { //if (NetEventSource.IsEnabled) NetEventSource.Error(this, SR.Format(SR.net_log_listener_cant_convert_bytes, GetOctetsAsString(_rawOctets), e.Message)); } - catch (EncoderFallbackException e) + catch (EncoderFallbackException) { // If utf8Encoding.GetBytes() fails //if (NetEventSource.IsEnabled) NetEventSource.Error(this, SR.Format(SR.net_log_listener_cant_convert_to_utf8, decodedString, e.Message)); diff --git a/SocketHttpListener/WebSocket.cs b/SocketHttpListener/WebSocket.cs index 385b25aed6..fd0c3e5bff 100644 --- a/SocketHttpListener/WebSocket.cs +++ b/SocketHttpListener/WebSocket.cs @@ -299,7 +299,7 @@ namespace SocketHttpListener } OnError.Emit(this, new ErrorEventArgs(message)); } - catch (Exception ex) + catch (Exception) { } } @@ -310,7 +310,7 @@ namespace SocketHttpListener { OnError.Emit(this, new ErrorEventArgs(message)); } - catch (Exception ex) + catch (Exception) { } } @@ -423,7 +423,7 @@ namespace SocketHttpListener private bool processPingFrame(WebSocketFrame frame) { - var mask = Mask.Unmask; + //var mask = Mask.Unmask; return true; } @@ -796,4 +796,4 @@ namespace SocketHttpListener #endregion } -} \ No newline at end of file +} From cb8cd1ff55d86317032365df0b6730815d8a8243 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 16 Dec 2018 00:48:40 +0100 Subject: [PATCH 2/3] Log exception where possible --- Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs | 8 ++------ RSSDP/SsdpDevicePublisher.cs | 9 +++++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs index 4716c64b20..620d3bae9e 100644 --- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs +++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs @@ -146,14 +146,10 @@ namespace IsoMounter public Task Mount(string isoPath, CancellationToken cancellationToken) { - LinuxMount mountedISO; - - if (MountISO(isoPath, out mountedISO)) - { + if (MountISO(isoPath, out LinuxMount mountedISO)) { return Task.FromResult(mountedISO); } - else - { + else { throw new IOException(String.Format( "An error occurred trying to mount image [$0].", isoPath diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs index 2646023e89..cee9b7f911 100644 --- a/RSSDP/SsdpDevicePublisher.cs +++ b/RSSDP/SsdpDevicePublisher.cs @@ -310,11 +310,16 @@ namespace Rssdp.Infrastructure try { - await _CommsServer.SendMessage(System.Text.Encoding.UTF8.GetBytes(message), endPoint, receivedOnlocalIpAddress, cancellationToken).ConfigureAwait(false); + await _CommsServer.SendMessage( + System.Text.Encoding.UTF8.GetBytes(message), + endPoint, + receivedOnlocalIpAddress, + cancellationToken) + .ConfigureAwait(false); } catch (Exception) { - + } //WriteTrace(String.Format("Sent search response to " + endPoint.ToString()), device); From 1a2153c3997f4624512182c747aec4ca0da1f5ed Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Mon, 17 Dec 2018 22:08:09 +0100 Subject: [PATCH 3/3] Update WebSocket.cs --- SocketHttpListener/WebSocket.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/SocketHttpListener/WebSocket.cs b/SocketHttpListener/WebSocket.cs index fd0c3e5bff..7d61850e60 100644 --- a/SocketHttpListener/WebSocket.cs +++ b/SocketHttpListener/WebSocket.cs @@ -423,8 +423,6 @@ namespace SocketHttpListener private bool processPingFrame(WebSocketFrame frame) { - //var mask = Mask.Unmask; - return true; }