Browse Source

Reformatted the files with notes.

Erwin de Haan 6 years ago
parent
commit
846456b41e

+ 1 - 1
Emby.Dlna/ConnectionManager/ServiceActionListBuilder.cs

@@ -77,7 +77,7 @@ namespace Emby.Dlna.ConnectionManager
 
             return action;
         }
-        
+
         private static ServiceAction GetCurrentConnectionInfo()
         {
             var action = new ServiceAction

+ 2 - 2
Emby.Naming/Video/VideoListResolver.cs

@@ -1,4 +1,4 @@
-using Emby.Naming.Common;
+using Emby.Naming.Common;
 using System;
 using System.Collections.Generic;
 using System.IO;
@@ -236,7 +236,7 @@ namespace Emby.Naming.Video
             if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
             {
                 testFilename = testFilename.Substring(folderName.Length).Trim();
-                return testFilename.StartsWith("-", StringComparison.OrdinalIgnoreCase)||Regex.Replace(testFilename, @"\[([^]]*)\]", "").Trim() == string.Empty;
+                return testFilename.StartsWith("-", StringComparison.OrdinalIgnoreCase) || Regex.Replace(testFilename, @"\[([^]]*)\]", "").Trim() == string.Empty;
             }
 
             return false;

+ 4 - 3
Emby.Server.Implementations/Devices/DeviceId.cs

@@ -89,9 +89,10 @@ namespace Emby.Server.Implementations.Devices
 
         public DeviceId(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem)
         {
-			if (fileSystem == null) {
-				throw new ArgumentNullException(nameof(fileSystem));
-			}
+            if (fileSystem == null)
+            {
+                throw new ArgumentNullException(nameof(fileSystem));
+            }
 
             _appPaths = appPaths;
             _logger = logger;

+ 1 - 1
Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs

@@ -332,7 +332,7 @@ namespace Emby.Server.Implementations.LiveTv
                     {
                         try
                         {
-                            dto.ParentBackdropImageTags = new []
+                            dto.ParentBackdropImageTags = new[]
                             {
                                     _imageProcessor.GetImageCacheTag(program, image)
                             };

+ 1 - 1
Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs

@@ -207,7 +207,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
                     throw new ArgumentNullException(nameof(buffer));
 
                 if (offset + count < 0)
-                    throw new ArgumentOutOfRangeException(nameof(offset),"offset + count must not be negative");
+                    throw new ArgumentOutOfRangeException(nameof(offset), "offset + count must not be negative");
 
                 if (offset + count > buffer.Length)
                     throw new ArgumentException("offset + count must not be greater than the length of buffer");

+ 1 - 1
Emby.Server.Implementations/Playlists/PlaylistManager.cs

@@ -459,7 +459,7 @@ namespace Emby.Server.Implementations.Playlists
         {
             if (string.IsNullOrEmpty(folderPath))
             {
-                throw new ArgumentException("Folder path was null or empty.",nameof(folderPath));
+                throw new ArgumentException("Folder path was null or empty.", nameof(folderPath));
             }
 
             if (string.IsNullOrEmpty(fileAbsolutePath))

+ 1 - 2
Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
@@ -29,7 +29,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// <value>The scheduled task.</value>
         public IScheduledTask ScheduledTask { get; private set; }
 
-        /// <summary>
         /// Gets or sets the json serializer.
         /// </summary>
         /// <value>The json serializer.</value>

+ 1 - 2
Emby.Server.Implementations/Services/ServicePath.cs

@@ -116,7 +116,6 @@ namespace Emby.Server.Implementations.Services
             {
                 if (string.IsNullOrEmpty(component)) continue;
 
-         
                 if (StringContains(component, VariablePrefix)
                     && component.IndexOf(ComponentSeperator) != -1)
                 {
@@ -352,7 +351,7 @@ namespace Emby.Server.Implementations.Services
 
             if (withPathInfoParts.Length != this.PathComponentsCount && !this.IsWildCardPath)
             {
-               return false;
+                return false;
             }
 
             if (!Verbs.Contains(httpMethod, StringComparer.OrdinalIgnoreCase))

+ 2 - 2
Emby.Server.Implementations/Sorting/SeriesSortNameComparer.cs

@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Sorting;
 using MediaBrowser.Model.Querying;
 using System;
@@ -24,7 +24,7 @@ namespace Emby.Server.Implementations.Sorting
 
             return hasSeries != null ? hasSeries.FindSeriesSortName() : null;
         }
-        
+
         /// <summary>
         /// Gets the name.
         /// </summary>

+ 19 - 19
Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/StringExtensions.cs

@@ -1,25 +1,25 @@
-using System;
+using System;
 
 namespace NLangDetect.Core.Extensions
 {
-  public static class StringExtensions
-  {
-    /// <summary>
-    /// Returns a new character sequence that is a subsequence of this sequence. The subsequence starts with the character at the specified index and ends with the character at index end - 1. The length of the returned sequence is end - start, so if start == end then an empty sequence is returned.
-    /// </summary>
-    /// <param name="s"></param>
-    /// <param name="start">the start index, inclusive</param>
-    /// <param name="end">the end index, exclusive</param>
-    /// <returns>the specified subsequence</returns>
-    /// <exception cref="IndexOutOfRangeException"> if start or end are negative, if end is greater than length(), or if start is greater than end</exception>
-    public static string SubSequence(this string s, int start, int end)
+    public static class StringExtensions
     {
-      if (start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Argument must not be negative.");
-      if (end < 0) throw new ArgumentOutOfRangeException(nameof(end), "Argument must not be negative.");
-      if (end > s.Length) throw new ArgumentOutOfRangeException(nameof(end), "Argument must not be greater than the input string's length.");
-      if (start > end) throw new ArgumentOutOfRangeException(nameof(start), "Argument must not be greater than the 'end' argument.");
-      
-      return s.Substring(start, end - start);
+        /// <summary>
+        /// Returns a new character sequence that is a subsequence of this sequence. The subsequence starts with the character at the specified index and ends with the character at index end - 1. The length of the returned sequence is end - start, so if start == end then an empty sequence is returned.
+        /// </summary>
+        /// <param name="s"></param>
+        /// <param name="start">the start index, inclusive</param>
+        /// <param name="end">the end index, exclusive</param>
+        /// <returns>the specified subsequence</returns>
+        /// <exception cref="IndexOutOfRangeException"> if start or end are negative, if end is greater than length(), or if start is greater than end</exception>
+        public static string SubSequence(this string s, int start, int end)
+        {
+            if (start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Argument must not be negative.");
+            if (end < 0) throw new ArgumentOutOfRangeException(nameof(end), "Argument must not be negative.");
+            if (end > s.Length) throw new ArgumentOutOfRangeException(nameof(end), "Argument must not be greater than the input string's length.");
+            if (start > end) throw new ArgumentOutOfRangeException(nameof(start), "Argument must not be greater than the 'end' argument.");
+
+            return s.Substring(start, end - start);
+        }
     }
-  }
 }

+ 5 - 3
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Devices;
 using MediaBrowser.Controller.Dlna;
@@ -595,8 +595,10 @@ namespace MediaBrowser.Api.Playback
         /// <param name="request">The stream request.</param>
         private void ParseStreamOptions(StreamRequest request)
         {
-            foreach (var param in Request.QueryString) {
-                if (char.IsLower(param.Name[0])) {
+            foreach (var param in Request.QueryString)
+            {
+                if (char.IsLower(param.Name[0]))
+                {
                     // This was probably not parsed initially and should be a StreamOptions
                     // TODO: This should be incorporated either in the lower framework for parsing requests
                     // or the generated URL should correctly serialize it

+ 2 - 2
MediaBrowser.Controller/Entities/PeopleHelper.cs

@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Entities;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.Entities
 
             if (string.IsNullOrEmpty(person.Name))
             {
-                throw new ArgumentException("The person's name was empty or null.",nameof(person));
+                throw new ArgumentException("The person's name was empty or null.", nameof(person));
             }
 
             // Normalize

+ 2 - 2
MediaBrowser.Controller/Library/ItemResolveArgs.cs

@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Providers;
 using System;
 using System.Collections.Generic;
@@ -155,7 +155,7 @@ namespace MediaBrowser.Controller.Library
         {
             if (string.IsNullOrEmpty(path))
             {
-                throw new ArgumentException("The path was empty or null.",nameof(path));
+                throw new ArgumentException("The path was empty or null.", nameof(path));
             }
 
             if (AdditionalLocations == null)

+ 2 - 2
MediaBrowser.Providers/Omdb/OmdbProvider.cs

@@ -1,4 +1,4 @@
-using MediaBrowser.Model.IO;
+using MediaBrowser.Model.IO;
 using MediaBrowser.Common.Net;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Entities;
@@ -320,7 +320,7 @@ namespace MediaBrowser.Providers.Omdb
         {
             if (string.IsNullOrWhiteSpace(seriesImdbId))
             {
-                throw new ArgumentException("The series IMDb ID was null or whitespace.",nameof(seriesImdbId));
+                throw new ArgumentException("The series IMDb ID was null or whitespace.", nameof(seriesImdbId));
             }
 
             var imdbParam = seriesImdbId.StartsWith("tt", StringComparison.OrdinalIgnoreCase) ? seriesImdbId : "tt" + seriesImdbId;

+ 2 - 2
MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs

@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Configuration;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Providers;
 using MediaBrowser.Model.Entities;
@@ -65,7 +65,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
 
             if (string.IsNullOrEmpty(metadataFile))
             {
-                throw new ArgumentException("The metadata file was empty or null.",nameof(metadataFile));
+                throw new ArgumentException("The metadata file was empty or null.", nameof(metadataFile));
             }
 
             var settings = XmlReaderSettingsFactory.Create(false);

+ 9 - 9
RSSDP/DeviceEventArgs.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Text;
 
@@ -18,14 +18,14 @@ namespace Rssdp
 
         #region Constructors
 
-		/// <summary>
-		/// Constructs a new instance for the specified <see cref="SsdpDevice"/>.
-		/// </summary>
-		/// <param name="device">The <see cref="SsdpDevice"/> associated with the event this argument class is being used for.</param>
-		/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
-		public DeviceEventArgs(SsdpDevice device)
-		{
-			if (device == null) throw new ArgumentNullException(nameof(device));
+        /// <summary>
+        /// Constructs a new instance for the specified <see cref="SsdpDevice"/>.
+        /// </summary>
+        /// <param name="device">The <see cref="SsdpDevice"/> associated with the event this argument class is being used for.</param>
+        /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
+        public DeviceEventArgs(SsdpDevice device)
+        {
+            if (device == null) throw new ArgumentNullException(nameof(device));
 
             _Device = device;
         }

+ 53 - 53
RSSDP/DeviceUnavailableEventArgs.cs

@@ -1,59 +1,59 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 
 namespace Rssdp
 {
-	/// <summary>
-	/// Event arguments for the <see cref="Rssdp.Infrastructure.SsdpDeviceLocatorBase.DeviceUnavailable"/> event.
-	/// </summary>
-	public sealed class DeviceUnavailableEventArgs : EventArgs
-	{
-
-		#region Fields
-
-		private readonly DiscoveredSsdpDevice _DiscoveredDevice;
-		private readonly bool _Expired;
-
-		#endregion
-
-		#region Constructors
-
-		/// <summary>
-		/// Full constructor.
-		/// </summary>
-		/// <param name="discoveredDevice">A <see cref="DiscoveredSsdpDevice"/> instance representing the device that has become unavailable.</param>
-		/// <param name="expired">A boolean value indicating whether this device is unavailable because it expired, or because it explicitly sent a byebye notification.. See <see cref="Expired"/> for more detail.</param>
-		/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="discoveredDevice"/> parameter is null.</exception>
-		public DeviceUnavailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool expired) 
-		{
-			if (discoveredDevice == null) throw new ArgumentNullException(nameof(discoveredDevice));
-
-			_DiscoveredDevice = discoveredDevice;
-			_Expired = expired;
-		}
-
-		#endregion
-
-		#region Public Properties
-
-		/// <summary>
-		/// Returns true if the device is considered unavailable because it's cached information expired before a new alive notification or search result was received. Returns false if the device is unavailable because it sent an explicit notification of it's unavailability.
-		/// </summary>
-		public bool Expired
-		{
-			get { return _Expired; }
-		}
-
-		/// <summary>
-		/// A reference to a <see cref="Rssdp.DiscoveredSsdpDevice"/> instance containing the discovery details of the removed device.
-		/// </summary>
-		public DiscoveredSsdpDevice DiscoveredDevice
-		{
-			get { return _DiscoveredDevice; }
-		} 
-
-		#endregion
-	}
-}
+    /// <summary>
+    /// Event arguments for the <see cref="Rssdp.Infrastructure.SsdpDeviceLocatorBase.DeviceUnavailable"/> event.
+    /// </summary>
+    public sealed class DeviceUnavailableEventArgs : EventArgs
+    {
+
+        #region Fields
+
+        private readonly DiscoveredSsdpDevice _DiscoveredDevice;
+        private readonly bool _Expired;
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Full constructor.
+        /// </summary>
+        /// <param name="discoveredDevice">A <see cref="DiscoveredSsdpDevice"/> instance representing the device that has become unavailable.</param>
+        /// <param name="expired">A boolean value indicating whether this device is unavailable because it expired, or because it explicitly sent a byebye notification.. See <see cref="Expired"/> for more detail.</param>
+        /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="discoveredDevice"/> parameter is null.</exception>
+        public DeviceUnavailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool expired)
+        {
+            if (discoveredDevice == null) throw new ArgumentNullException(nameof(discoveredDevice));
+
+            _DiscoveredDevice = discoveredDevice;
+            _Expired = expired;
+        }
+
+        #endregion
+
+        #region Public Properties
+
+        /// <summary>
+        /// Returns true if the device is considered unavailable because it's cached information expired before a new alive notification or search result was received. Returns false if the device is unavailable because it sent an explicit notification of it's unavailability.
+        /// </summary>
+        public bool Expired
+        {
+            get { return _Expired; }
+        }
+
+        /// <summary>
+        /// A reference to a <see cref="Rssdp.DiscoveredSsdpDevice"/> instance containing the discovery details of the removed device.
+        /// </summary>
+        public DiscoveredSsdpDevice DiscoveredDevice
+        {
+            get { return _DiscoveredDevice; }
+        }
+
+        #endregion
+    }
+}

+ 65 - 65
RSSDP/HttpRequestParser.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Net;
@@ -8,70 +8,70 @@ using System.Threading.Tasks;
 
 namespace Rssdp.Infrastructure
 {
-	/// <summary>
-	/// Parses a string into a <see cref="System.Net.Http.HttpRequestMessage"/> or throws an exception.
-	/// </summary>
-	public sealed class HttpRequestParser : HttpParserBase<HttpRequestMessage>
-	{
-
-		#region Fields & Constants
-
-		private readonly string[] ContentHeaderNames = new string[]
-				{
-					"Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
-				};
-
-		#endregion
-
-		#region Public Methods
-
-		/// <summary>
-		/// Parses the specified data into a <see cref="System.Net.Http.HttpRequestMessage"/> instance.
-		/// </summary>
-		/// <param name="data">A string containing the data to parse.</param>
-		/// <returns>A <see cref="System.Net.Http.HttpRequestMessage"/> instance containing the parsed data.</returns>
-		public override System.Net.Http.HttpRequestMessage Parse(string data)
-		{
-			System.Net.Http.HttpRequestMessage retVal = null;
-
-			try
-			{
-				retVal = new System.Net.Http.HttpRequestMessage();
-
-				Parse(retVal, retVal.Headers, data);
-
-				return retVal;
-			}
-			finally
-			{
-				if (retVal != null)
-					retVal.Dispose();
-			}
-		}
-
-		#endregion
-
-		#region Overrides
-
-		/// <summary>
-		/// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
-		/// </summary>
-		/// <param name="data">The first line of the HTTP message to be parsed.</param>
-		/// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
-		protected override void ParseStatusLine(string data, HttpRequestMessage message)
-		{
-			if (data == null) throw new ArgumentNullException(nameof(data));
-			if (message == null) throw new ArgumentNullException(nameof(message));
-
-			var parts = data.Split(' ');
-			if (parts.Length < 2) throw new ArgumentException("Status line is invalid. Insufficient status parts.", nameof(data));
-
-			message.Method = new HttpMethod(parts[0].Trim());
-			Uri requestUri;
-			if (Uri.TryCreate(parts[1].Trim(), UriKind.RelativeOrAbsolute, out requestUri))
-				message.RequestUri = requestUri;
-			else
-				System.Diagnostics.Debug.WriteLine(parts[1]);
+    /// <summary>
+    /// Parses a string into a <see cref="System.Net.Http.HttpRequestMessage"/> or throws an exception.
+    /// </summary>
+    public sealed class HttpRequestParser : HttpParserBase<HttpRequestMessage>
+    {
+
+        #region Fields & Constants
+
+        private readonly string[] ContentHeaderNames = new string[]
+                {
+                    "Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
+                };
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Parses the specified data into a <see cref="System.Net.Http.HttpRequestMessage"/> instance.
+        /// </summary>
+        /// <param name="data">A string containing the data to parse.</param>
+        /// <returns>A <see cref="System.Net.Http.HttpRequestMessage"/> instance containing the parsed data.</returns>
+        public override System.Net.Http.HttpRequestMessage Parse(string data)
+        {
+            System.Net.Http.HttpRequestMessage retVal = null;
+
+            try
+            {
+                retVal = new System.Net.Http.HttpRequestMessage();
+
+                Parse(retVal, retVal.Headers, data);
+
+                return retVal;
+            }
+            finally
+            {
+                if (retVal != null)
+                    retVal.Dispose();
+            }
+        }
+
+        #endregion
+
+        #region Overrides
+
+        /// <summary>
+        /// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
+        /// </summary>
+        /// <param name="data">The first line of the HTTP message to be parsed.</param>
+        /// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
+        protected override void ParseStatusLine(string data, HttpRequestMessage message)
+        {
+            if (data == null) throw new ArgumentNullException(nameof(data));
+            if (message == null) throw new ArgumentNullException(nameof(message));
+
+            var parts = data.Split(' ');
+            if (parts.Length < 2) throw new ArgumentException("Status line is invalid. Insufficient status parts.", nameof(data));
+
+            message.Method = new HttpMethod(parts[0].Trim());
+            Uri requestUri;
+            if (Uri.TryCreate(parts[1].Trim(), UriKind.RelativeOrAbsolute, out requestUri))
+                message.RequestUri = requestUri;
+            else
+                System.Diagnostics.Debug.WriteLine(parts[1]);
 
             if (parts.Length >= 3)
             {

+ 77 - 77
RSSDP/HttpResponseParser.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Net;
@@ -8,82 +8,82 @@ using System.Threading.Tasks;
 
 namespace Rssdp.Infrastructure
 {
-	/// <summary>
-	/// Parses a string into a <see cref="System.Net.Http.HttpResponseMessage"/> or throws an exception.
-	/// </summary>
-	public sealed class HttpResponseParser : HttpParserBase<System.Net.Http.HttpResponseMessage> 
-	{
-
-		#region Fields & Constants
-
-		private readonly string[] ContentHeaderNames = new string[]
-				{
-					"Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
-				};
-
-		#endregion
-
-		#region Public Methods
-
-		/// <summary>
-		/// Parses the specified data into a <see cref="System.Net.Http.HttpResponseMessage"/> instance.
-		/// </summary>
-		/// <param name="data">A string containing the data to parse.</param>
-		/// <returns>A <see cref="System.Net.Http.HttpResponseMessage"/> instance containing the parsed data.</returns>
-		public override HttpResponseMessage Parse(string data)
-		{
-			System.Net.Http.HttpResponseMessage retVal = null;
-			try
-			{
-				retVal = new System.Net.Http.HttpResponseMessage();
-
-				Parse(retVal, retVal.Headers, data);
-
-				return retVal;
-			}
-			catch
-			{
-				if (retVal != null)
-					retVal.Dispose();
-
-				throw;
-			}
-		}
-
-		#endregion
-
-		#region Overrides Methods
-
-		/// <summary>
-		/// Returns a boolean indicating whether the specified HTTP header name represents a content header (true), or a message header (false).
-		/// </summary>
-		/// <param name="headerName">A string containing the name of the header to return the type of.</param>
-		/// <returns>A boolean, true if th specified header relates to HTTP content, otherwise false.</returns>
-		protected override bool IsContentHeader(string headerName)
-		{
-			return ContentHeaderNames.Contains(headerName, StringComparer.OrdinalIgnoreCase);
-		}
-
-		/// <summary>
-		/// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
-		/// </summary>
-		/// <param name="data">The first line of the HTTP message to be parsed.</param>
-		/// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
-		protected override void ParseStatusLine(string data, HttpResponseMessage message)
-		{
-			if (data == null) throw new ArgumentNullException(nameof(data));
-			if (message == null) throw new ArgumentNullException(nameof(message));
-
-			var parts = data.Split(' ');
-			if (parts.Length < 2) throw new ArgumentException("data status line is invalid. Insufficient status parts.", nameof(data));
-
-			message.Version = ParseHttpVersion(parts[0].Trim());
-
-			int statusCode = -1;
-			if (!Int32.TryParse(parts[1].Trim(), out statusCode))
-				throw new ArgumentException("data status line is invalid. Status code is not a valid integer.", nameof(data));
-
-			message.StatusCode = (HttpStatusCode)statusCode;
+    /// <summary>
+    /// Parses a string into a <see cref="System.Net.Http.HttpResponseMessage"/> or throws an exception.
+    /// </summary>
+    public sealed class HttpResponseParser : HttpParserBase<System.Net.Http.HttpResponseMessage>
+    {
+
+        #region Fields & Constants
+
+        private readonly string[] ContentHeaderNames = new string[]
+                {
+                    "Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
+                };
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Parses the specified data into a <see cref="System.Net.Http.HttpResponseMessage"/> instance.
+        /// </summary>
+        /// <param name="data">A string containing the data to parse.</param>
+        /// <returns>A <see cref="System.Net.Http.HttpResponseMessage"/> instance containing the parsed data.</returns>
+        public override HttpResponseMessage Parse(string data)
+        {
+            System.Net.Http.HttpResponseMessage retVal = null;
+            try
+            {
+                retVal = new System.Net.Http.HttpResponseMessage();
+
+                Parse(retVal, retVal.Headers, data);
+
+                return retVal;
+            }
+            catch
+            {
+                if (retVal != null)
+                    retVal.Dispose();
+
+                throw;
+            }
+        }
+
+        #endregion
+
+        #region Overrides Methods
+
+        /// <summary>
+        /// Returns a boolean indicating whether the specified HTTP header name represents a content header (true), or a message header (false).
+        /// </summary>
+        /// <param name="headerName">A string containing the name of the header to return the type of.</param>
+        /// <returns>A boolean, true if th specified header relates to HTTP content, otherwise false.</returns>
+        protected override bool IsContentHeader(string headerName)
+        {
+            return ContentHeaderNames.Contains(headerName, StringComparer.OrdinalIgnoreCase);
+        }
+
+        /// <summary>
+        /// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
+        /// </summary>
+        /// <param name="data">The first line of the HTTP message to be parsed.</param>
+        /// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
+        protected override void ParseStatusLine(string data, HttpResponseMessage message)
+        {
+            if (data == null) throw new ArgumentNullException(nameof(data));
+            if (message == null) throw new ArgumentNullException(nameof(message));
+
+            var parts = data.Split(' ');
+            if (parts.Length < 2) throw new ArgumentException("data status line is invalid. Insufficient status parts.", nameof(data));
+
+            message.Version = ParseHttpVersion(parts[0].Trim());
+
+            int statusCode = -1;
+            if (!Int32.TryParse(parts[1].Trim(), out statusCode))
+                throw new ArgumentException("data status line is invalid. Status code is not a valid integer.", nameof(data));
+
+            message.StatusCode = (HttpStatusCode)statusCode;
 
             if (parts.Length >= 3)
             {

+ 7 - 7
RSSDP/IEnumerableExtensions.cs

@@ -1,16 +1,16 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 
 namespace Rssdp.Infrastructure
 {
-	internal static class IEnumerableExtensions
-	{
-		public static IEnumerable<T> SelectManyRecursive<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> selector)
-		{
-			if (source == null) throw new ArgumentNullException(nameof(source));
-			if (selector == null) throw new ArgumentNullException(nameof(selector));
+    internal static class IEnumerableExtensions
+    {
+        public static IEnumerable<T> SelectManyRecursive<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> selector)
+        {
+            if (source == null) throw new ArgumentNullException(nameof(source));
+            if (selector == null) throw new ArgumentNullException(nameof(selector));
 
             return !source.Any() ? source :
                 source.Concat(