Browse Source

fix SA1503 for one line if statements

telans 5 years ago
parent
commit
98db8f72e0
64 changed files with 843 additions and 193 deletions
  1. 13 3
      DvdLib/Ifo/Dvd.cs
  2. 8 2
      DvdLib/Ifo/DvdTime.cs
  3. 9 2
      DvdLib/Ifo/ProgramChain.cs
  4. 4 1
      DvdLib/Ifo/Title.cs
  5. 8 2
      Emby.Dlna/PlayTo/PlayToManager.cs
  6. 79 16
      Emby.Server.Implementations/Data/SqliteItemRepository.cs
  7. 8 1
      Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
  8. 8 2
      Emby.Server.Implementations/Net/UdpSocket.cs
  9. 10 2
      Emby.Server.Implementations/Playlists/PlaylistManager.cs
  10. 4 1
      Emby.Server.Implementations/Services/ServiceController.cs
  11. 4 1
      Emby.Server.Implementations/Services/ServiceExec.cs
  12. 4 1
      Emby.Server.Implementations/Services/ServicePath.cs
  13. 15 4
      Jellyfin.Data/Entities/Artwork.cs
  14. 15 3
      Jellyfin.Data/Entities/BookMetadata.cs
  15. 10 2
      Jellyfin.Data/Entities/Chapter.cs
  16. 15 4
      Jellyfin.Data/Entities/CollectionItem.cs
  17. 25 5
      Jellyfin.Data/Entities/Company.cs
  18. 15 4
      Jellyfin.Data/Entities/CompanyMetadata.cs
  19. 15 4
      Jellyfin.Data/Entities/CustomItemMetadata.cs
  20. 5 1
      Jellyfin.Data/Entities/Episode.cs
  21. 15 4
      Jellyfin.Data/Entities/EpisodeMetadata.cs
  22. 10 3
      Jellyfin.Data/Entities/Genre.cs
  23. 5 2
      Jellyfin.Data/Entities/Library.cs
  24. 5 2
      Jellyfin.Data/Entities/LibraryRoot.cs
  25. 10 2
      Jellyfin.Data/Entities/MediaFile.cs
  26. 5 2
      Jellyfin.Data/Entities/MediaFileStream.cs
  27. 10 2
      Jellyfin.Data/Entities/Metadata.cs
  28. 5 2
      Jellyfin.Data/Entities/MetadataProvider.cs
  29. 25 6
      Jellyfin.Data/Entities/MetadataProviderId.cs
  30. 15 3
      Jellyfin.Data/Entities/MovieMetadata.cs
  31. 15 3
      Jellyfin.Data/Entities/MusicAlbumMetadata.cs
  32. 5 1
      Jellyfin.Data/Entities/Person.cs
  33. 5 1
      Jellyfin.Data/Entities/PersonRole.cs
  34. 15 4
      Jellyfin.Data/Entities/PhotoMetadata.cs
  35. 15 4
      Jellyfin.Data/Entities/ProviderMapping.cs
  36. 5 2
      Jellyfin.Data/Entities/Rating.cs
  37. 5 2
      Jellyfin.Data/Entities/RatingSource.cs
  38. 35 7
      Jellyfin.Data/Entities/Release.cs
  39. 5 1
      Jellyfin.Data/Entities/Season.cs
  40. 15 4
      Jellyfin.Data/Entities/SeasonMetadata.cs
  41. 15 3
      Jellyfin.Data/Entities/SeriesMetadata.cs
  42. 5 1
      Jellyfin.Data/Entities/Track.cs
  43. 15 4
      Jellyfin.Data/Entities/TrackMetadata.cs
  44. 4 1
      MediaBrowser.Controller/Entities/BaseItem.cs
  45. 5 1
      MediaBrowser.Controller/Library/ItemResolveArgs.cs
  46. 25 5
      MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
  47. 4 1
      MediaBrowser.Model/Dlna/StreamBuilder.cs
  48. 4 1
      MediaBrowser.Model/Entities/MediaStream.cs
  49. 15 3
      MediaBrowser.Model/Services/RouteAttribute.cs
  50. 4 1
      MediaBrowser.Providers/Manager/ItemImageProvider.cs
  51. 4 1
      MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetProvider.cs
  52. 4 1
      MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs
  53. 4 1
      RSSDP/DeviceAvailableEventArgs.cs
  54. 4 1
      RSSDP/DeviceEventArgs.cs
  55. 4 1
      RSSDP/DeviceUnavailableEventArgs.cs
  56. 4 1
      RSSDP/DisposableManagedObjectBase.cs
  57. 22 5
      RSSDP/HttpParserBase.cs
  58. 13 3
      RSSDP/HttpRequestParser.cs
  59. 13 3
      RSSDP/HttpResponseParser.cs
  60. 9 2
      RSSDP/IEnumerableExtensions.cs
  61. 17 4
      RSSDP/SsdpCommunicationsServer.cs
  62. 18 4
      RSSDP/SsdpDevice.cs
  63. 69 15
      RSSDP/SsdpDeviceLocator.cs
  64. 63 12
      RSSDP/SsdpDevicePublisher.cs

+ 13 - 3
DvdLib/Ifo/Dvd.cs

@@ -117,12 +117,19 @@ namespace DvdLib.Ifo
                         uint chapNum = 1;
                         vtsFs.Seek(baseAddr + offsets[titleNum], SeekOrigin.Begin);
                         var t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum + 1));
-                        if (t == null) continue;
+                        if (t == null)
+                        {
+                            continue;
+                        }
 
                         do
                         {
                             t.Chapters.Add(new Chapter(vtsRead.ReadUInt16(), vtsRead.ReadUInt16(), chapNum));
-                            if (titleNum + 1 < numTitles && vtsFs.Position == (baseAddr + offsets[titleNum + 1])) break;
+                            if (titleNum + 1 < numTitles && vtsFs.Position == (baseAddr + offsets[titleNum + 1]))
+                            {
+                                break;
+                            }
+
                             chapNum++;
                         }
                         while (vtsFs.Position < (baseAddr + endaddr));
@@ -147,7 +154,10 @@ namespace DvdLib.Ifo
                         uint vtsPgcOffset = vtsRead.ReadUInt32();
 
                         var t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum));
-                        if (t != null) t.AddPgc(vtsRead, startByte + vtsPgcOffset, entryPgc, pgcNum);
+                        if (t != null)
+                        {
+                            t.AddPgc(vtsRead, startByte + vtsPgcOffset, entryPgc, pgcNum);
+                        }
                     }
                 }
             }

+ 8 - 2
DvdLib/Ifo/DvdTime.cs

@@ -15,8 +15,14 @@ namespace DvdLib.Ifo
             Second = GetBCDValue(data[2]);
             Frames = GetBCDValue((byte)(data[3] & 0x3F));
 
-            if ((data[3] & 0x80) != 0) FrameRate = 30;
-            else if ((data[3] & 0x40) != 0) FrameRate = 25;
+            if ((data[3] & 0x80) != 0)
+            {
+                FrameRate = 30;
+            }
+            else if ((data[3] & 0x40) != 0)
+            {
+                FrameRate = 25;
+            }
         }
 
         private static byte GetBCDValue(byte data)

+ 9 - 2
DvdLib/Ifo/ProgramChain.cs

@@ -75,8 +75,15 @@ namespace DvdLib.Ifo
 
             StillTime = br.ReadByte();
             byte pbMode = br.ReadByte();
-            if (pbMode == 0) PlaybackMode = ProgramPlaybackMode.Sequential;
-            else PlaybackMode = ((pbMode & 0x80) == 0) ? ProgramPlaybackMode.Random : ProgramPlaybackMode.Shuffle;
+            if (pbMode == 0)
+            {
+                PlaybackMode = ProgramPlaybackMode.Sequential;
+            }
+            else
+            {
+                PlaybackMode = ((pbMode & 0x80) == 0) ? ProgramPlaybackMode.Random : ProgramPlaybackMode.Shuffle;
+            }
+
             ProgramCount = (uint)(pbMode & 0x7F);
 
             Palette = br.ReadBytes(64);

+ 4 - 1
DvdLib/Ifo/Title.cs

@@ -59,7 +59,10 @@ namespace DvdLib.Ifo
             var pgc = new ProgramChain(pgcNum);
             pgc.ParseHeader(br);
             ProgramChains.Add(pgc);
-            if (entryPgc) EntryProgramChain = pgc;
+            if (entryPgc)
+            {
+                EntryProgramChain = pgc;
+            }
 
             br.BaseStream.Seek(curPos, SeekOrigin.Begin);
         }

+ 8 - 2
Emby.Dlna/PlayTo/PlayToManager.cs

@@ -78,9 +78,15 @@ namespace Emby.Dlna.PlayTo
 
             var info = e.Argument;
 
-            if (!info.Headers.TryGetValue("USN", out string usn)) usn = string.Empty;
+            if (!info.Headers.TryGetValue("USN", out string usn))
+            {
+                usn = string.Empty;
+            }
 
-            if (!info.Headers.TryGetValue("NT", out string nt)) nt = string.Empty;
+            if (!info.Headers.TryGetValue("NT", out string nt))
+            {
+                nt = string.Empty;
+            }
 
             string location = info.Location.ToString();
 

+ 79 - 16
Emby.Server.Implementations/Data/SqliteItemRepository.cs

@@ -2775,22 +2775,85 @@ namespace Emby.Server.Implementations.Data
 
         private string FixUnicodeChars(string buffer)
         {
-            if (buffer.IndexOf('\u2013') > -1) buffer = buffer.Replace('\u2013', '-'); // en dash
-            if (buffer.IndexOf('\u2014') > -1) buffer = buffer.Replace('\u2014', '-'); // em dash
-            if (buffer.IndexOf('\u2015') > -1) buffer = buffer.Replace('\u2015', '-'); // horizontal bar
-            if (buffer.IndexOf('\u2017') > -1) buffer = buffer.Replace('\u2017', '_'); // double low line
-            if (buffer.IndexOf('\u2018') > -1) buffer = buffer.Replace('\u2018', '\''); // left single quotation mark
-            if (buffer.IndexOf('\u2019') > -1) buffer = buffer.Replace('\u2019', '\''); // right single quotation mark
-            if (buffer.IndexOf('\u201a') > -1) buffer = buffer.Replace('\u201a', ','); // single low-9 quotation mark
-            if (buffer.IndexOf('\u201b') > -1) buffer = buffer.Replace('\u201b', '\''); // single high-reversed-9 quotation mark
-            if (buffer.IndexOf('\u201c') > -1) buffer = buffer.Replace('\u201c', '\"'); // left double quotation mark
-            if (buffer.IndexOf('\u201d') > -1) buffer = buffer.Replace('\u201d', '\"'); // right double quotation mark
-            if (buffer.IndexOf('\u201e') > -1) buffer = buffer.Replace('\u201e', '\"'); // double low-9 quotation mark
-            if (buffer.IndexOf('\u2026') > -1) buffer = buffer.Replace("\u2026", "..."); // horizontal ellipsis
-            if (buffer.IndexOf('\u2032') > -1) buffer = buffer.Replace('\u2032', '\''); // prime
-            if (buffer.IndexOf('\u2033') > -1) buffer = buffer.Replace('\u2033', '\"'); // double prime
-            if (buffer.IndexOf('\u0060') > -1) buffer = buffer.Replace('\u0060', '\''); // grave accent
-            if (buffer.IndexOf('\u00B4') > -1) buffer = buffer.Replace('\u00B4', '\''); // acute accent
+            if (buffer.IndexOf('\u2013') > -1)
+            {
+                buffer = buffer.Replace('\u2013', '-'); // en dash
+            }
+
+            if (buffer.IndexOf('\u2014') > -1)
+            {
+                buffer = buffer.Replace('\u2014', '-'); // em dash
+            }
+
+            if (buffer.IndexOf('\u2015') > -1)
+            {
+                buffer = buffer.Replace('\u2015', '-'); // horizontal bar
+            }
+
+            if (buffer.IndexOf('\u2017') > -1)
+            {
+                buffer = buffer.Replace('\u2017', '_'); // double low line
+            }
+
+            if (buffer.IndexOf('\u2018') > -1)
+            {
+                buffer = buffer.Replace('\u2018', '\''); // left single quotation mark
+            }
+
+            if (buffer.IndexOf('\u2019') > -1)
+            {
+                buffer = buffer.Replace('\u2019', '\''); // right single quotation mark
+            }
+
+            if (buffer.IndexOf('\u201a') > -1)
+            {
+                buffer = buffer.Replace('\u201a', ','); // single low-9 quotation mark
+            }
+
+            if (buffer.IndexOf('\u201b') > -1)
+            {
+                buffer = buffer.Replace('\u201b', '\''); // single high-reversed-9 quotation mark
+            }
+
+            if (buffer.IndexOf('\u201c') > -1)
+            {
+                buffer = buffer.Replace('\u201c', '\"'); // left double quotation mark
+            }
+
+            if (buffer.IndexOf('\u201d') > -1)
+            {
+                buffer = buffer.Replace('\u201d', '\"'); // right double quotation mark
+            }
+
+            if (buffer.IndexOf('\u201e') > -1)
+            {
+                buffer = buffer.Replace('\u201e', '\"'); // double low-9 quotation mark
+            }
+
+            if (buffer.IndexOf('\u2026') > -1)
+            {
+                buffer = buffer.Replace("\u2026", "..."); // horizontal ellipsis
+            }
+
+            if (buffer.IndexOf('\u2032') > -1)
+            {
+                buffer = buffer.Replace('\u2032', '\''); // prime
+            }
+
+            if (buffer.IndexOf('\u2033') > -1)
+            {
+                buffer = buffer.Replace('\u2033', '\"'); // double prime
+            }
+
+            if (buffer.IndexOf('\u0060') > -1)
+            {
+                buffer = buffer.Replace('\u0060', '\''); // grave accent
+            }
+
+            if (buffer.IndexOf('\u00B4') > -1)
+            {
+                buffer = buffer.Replace('\u00B4', '\''); // acute accent
+            }
 
             return buffer;
         }

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

@@ -201,7 +201,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
                         var index = line.IndexOf("Channel", StringComparison.OrdinalIgnoreCase);
                         var name = line.Substring(0, index - 1);
                         var currentChannel = line.Substring(index + 7);
-                        if (currentChannel != "none") { status = LiveTvTunerStatus.LiveTv; } else { status = LiveTvTunerStatus.Available; }
+                        if (currentChannel != "none")
+                        {
+                            status = LiveTvTunerStatus.LiveTv;
+                        }
+                        else
+                        {
+                            status = LiveTvTunerStatus.Available;
+                        }
 
                         tuners.Add(new LiveTvTunerInfo
                         {

+ 8 - 2
Emby.Server.Implementations/Net/UdpSocket.cs

@@ -37,7 +37,10 @@ namespace Emby.Server.Implementations.Net
 
         public UdpSocket(Socket socket, int localPort, IPAddress ip)
         {
-            if (socket == null) throw new ArgumentNullException(nameof(socket));
+            if (socket == null)
+            {
+                throw new ArgumentNullException(nameof(socket));
+            }
 
             _socket = socket;
             _localPort = localPort;
@@ -103,7 +106,10 @@ namespace Emby.Server.Implementations.Net
 
         public UdpSocket(Socket socket, IPEndPoint endPoint)
         {
-            if (socket == null) throw new ArgumentNullException(nameof(socket));
+            if (socket == null)
+            {
+                throw new ArgumentNullException(nameof(socket));
+            }
 
             _socket = socket;
             _socket.Connect(endPoint);

+ 10 - 2
Emby.Server.Implementations/Playlists/PlaylistManager.cs

@@ -539,13 +539,21 @@ namespace Emby.Server.Implementations.Playlists
 
         private static string UnEscape(string content)
         {
-            if (content == null) return content;
+            if (content == null)
+            {
+                return content;
+            }
+
             return content.Replace("&amp;", "&").Replace("&apos;", "'").Replace("&quot;", "\"").Replace("&gt;", ">").Replace("&lt;", "<");
         }
 
         private static string Escape(string content)
         {
-            if (content == null) return null;
+            if (content == null)
+            {
+                return null;
+            }
+
             return content.Replace("&", "&amp;").Replace("'", "&apos;").Replace("\"", "&quot;").Replace(">", "&gt;").Replace("<", "&lt;");
         }
 

+ 4 - 1
Emby.Server.Implementations/Services/ServiceController.cs

@@ -144,7 +144,10 @@ namespace Emby.Server.Implementations.Services
             var yieldedWildcardMatches = RestPath.GetFirstMatchWildCardHashKeys(matchUsingPathParts);
             foreach (var potentialHashMatch in yieldedWildcardMatches)
             {
-                if (!this.RestPathMap.TryGetValue(potentialHashMatch, out firstMatches)) continue;
+                if (!this.RestPathMap.TryGetValue(potentialHashMatch, out firstMatches))
+                {
+                    continue;
+                }
 
                 var bestScore = -1;
                 RestPath bestMatch = null;

+ 4 - 1
Emby.Server.Implementations/Services/ServiceExec.cs

@@ -63,7 +63,10 @@ namespace Emby.Server.Implementations.Services
         {
             foreach (var actionCtx in actions)
             {
-                if (execMap.ContainsKey(actionCtx.Id)) continue;
+                if (execMap.ContainsKey(actionCtx.Id))
+                {
+                    continue;
+                }
 
                 execMap[actionCtx.Id] = actionCtx;
             }

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

@@ -124,7 +124,10 @@ namespace Emby.Server.Implementations.Services
             var hasSeparators = new List<bool>();
             foreach (var component in this.restPath.Split(PathSeperatorChar))
             {
-                if (string.IsNullOrEmpty(component)) continue;
+                if (string.IsNullOrEmpty(component))
+                {
+                    continue;
+                }
 
                 if (component.IndexOf(VariablePrefix, StringComparison.OrdinalIgnoreCase) != -1
                     && component.IndexOf(ComponentSeperator) != -1)

+ 15 - 4
Jellyfin.Data/Entities/Artwork.cs

@@ -32,17 +32,28 @@ namespace Jellyfin.Data.Entities
         /// <param name="_personrole1"></param>
         public Artwork(string path, Enums.ArtKind kind, Metadata _metadata0, PersonRole _personrole1)
         {
-            if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
+            if (string.IsNullOrEmpty(path))
+            {
+                throw new ArgumentNullException(nameof(path));
+            }
+
             this.Path = path;
 
             this.Kind = kind;
 
-            if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
+            if (_metadata0 == null)
+            {
+                throw new ArgumentNullException(nameof(_metadata0));
+            }
+
             _metadata0.Artwork.Add(this);
 
-            if (_personrole1 == null) throw new ArgumentNullException(nameof(_personrole1));
-            _personrole1.Artwork = this;
+            if (_personrole1 == null)
+            {
+                throw new ArgumentNullException(nameof(_personrole1));
+            }
 
+            _personrole1.Artwork = this;
 
             Init();
         }

+ 15 - 3
Jellyfin.Data/Entities/BookMetadata.cs

@@ -34,13 +34,25 @@ namespace Jellyfin.Data.Entities
         /// <param name="_book0"></param>
         public BookMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
-            if (_book0 == null) throw new ArgumentNullException(nameof(_book0));
+            if (_book0 == null)
+            {
+                throw new ArgumentNullException(nameof(_book0));
+            }
+
             _book0.BookMetadata.Add(this);
 
             this.Publishers = new HashSet<Company>();

+ 10 - 2
Jellyfin.Data/Entities/Chapter.cs

@@ -32,12 +32,20 @@ namespace Jellyfin.Data.Entities
         /// <param name="_release0"></param>
         public Chapter(string language, long timestart, Release _release0)
         {
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
             this.TimeStart = timestart;
 
-            if (_release0 == null) throw new ArgumentNullException(nameof(_release0));
+            if (_release0 == null)
+            {
+                throw new ArgumentNullException(nameof(_release0));
+            }
+
             _release0.Chapters.Add(this);
 
 

+ 15 - 4
Jellyfin.Data/Entities/CollectionItem.cs

@@ -38,15 +38,26 @@ namespace Jellyfin.Data.Entities
             // NOTE: This class has one-to-one associations with CollectionItem.
             // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
 
-            if (_collection0 == null) throw new ArgumentNullException(nameof(_collection0));
+            if (_collection0 == null)
+            {
+                throw new ArgumentNullException(nameof(_collection0));
+            }
+
             _collection0.CollectionItem.Add(this);
 
-            if (_collectionitem1 == null) throw new ArgumentNullException(nameof(_collectionitem1));
+            if (_collectionitem1 == null)
+            {
+                throw new ArgumentNullException(nameof(_collectionitem1));
+            }
+
             _collectionitem1.Next = this;
 
-            if (_collectionitem2 == null) throw new ArgumentNullException(nameof(_collectionitem2));
-            _collectionitem2.Previous = this;
+            if (_collectionitem2 == null)
+            {
+                throw new ArgumentNullException(nameof(_collectionitem2));
+            }
 
+            _collectionitem2.Previous = this;
 
             Init();
         }

+ 25 - 5
Jellyfin.Data/Entities/Company.cs

@@ -37,19 +37,39 @@ namespace Jellyfin.Data.Entities
         /// <param name="_company4"></param>
         public Company(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
         {
-            if (_moviemetadata0 == null) throw new ArgumentNullException(nameof(_moviemetadata0));
+            if (_moviemetadata0 == null)
+            {
+                throw new ArgumentNullException(nameof(_moviemetadata0));
+            }
+
             _moviemetadata0.Studios.Add(this);
 
-            if (_seriesmetadata1 == null) throw new ArgumentNullException(nameof(_seriesmetadata1));
+            if (_seriesmetadata1 == null)
+            {
+                throw new ArgumentNullException(nameof(_seriesmetadata1));
+            }
+
             _seriesmetadata1.Networks.Add(this);
 
-            if (_musicalbummetadata2 == null) throw new ArgumentNullException(nameof(_musicalbummetadata2));
+            if (_musicalbummetadata2 == null)
+            {
+                throw new ArgumentNullException(nameof(_musicalbummetadata2));
+            }
+
             _musicalbummetadata2.Labels.Add(this);
 
-            if (_bookmetadata3 == null) throw new ArgumentNullException(nameof(_bookmetadata3));
+            if (_bookmetadata3 == null)
+            {
+                throw new ArgumentNullException(nameof(_bookmetadata3));
+            }
+
             _bookmetadata3.Publishers.Add(this);
 
-            if (_company4 == null) throw new ArgumentNullException(nameof(_company4));
+            if (_company4 == null)
+            {
+                throw new ArgumentNullException(nameof(_company4));
+            }
+
             _company4.Parent = this;
 
             this.CompanyMetadata = new HashSet<CompanyMetadata>();

+ 15 - 4
Jellyfin.Data/Entities/CompanyMetadata.cs

@@ -31,15 +31,26 @@ namespace Jellyfin.Data.Entities
         /// <param name="_company0"></param>
         public CompanyMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Company _company0)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
-            if (_company0 == null) throw new ArgumentNullException(nameof(_company0));
-            _company0.CompanyMetadata.Add(this);
+            if (_company0 == null)
+            {
+                throw new ArgumentNullException(nameof(_company0));
+            }
 
+            _company0.CompanyMetadata.Add(this);
 
             Init();
         }

+ 15 - 4
Jellyfin.Data/Entities/CustomItemMetadata.cs

@@ -30,15 +30,26 @@ namespace Jellyfin.Data.Entities
         /// <param name="_customitem0"></param>
         public CustomItemMetadata(string title, string language, DateTime dateadded, DateTime datemodified, CustomItem _customitem0)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
-            if (_customitem0 == null) throw new ArgumentNullException(nameof(_customitem0));
-            _customitem0.CustomItemMetadata.Add(this);
+            if (_customitem0 == null)
+            {
+                throw new ArgumentNullException(nameof(_customitem0));
+            }
 
+            _customitem0.CustomItemMetadata.Add(this);
 
             Init();
         }

+ 5 - 1
Jellyfin.Data/Entities/Episode.cs

@@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
 
             this.UrlId = urlid;
 
-            if (_season0 == null) throw new ArgumentNullException(nameof(_season0));
+            if (_season0 == null)
+            {
+                throw new ArgumentNullException(nameof(_season0));
+            }
+
             _season0.Episodes.Add(this);
 
             this.Releases = new HashSet<Release>();

+ 15 - 4
Jellyfin.Data/Entities/EpisodeMetadata.cs

@@ -31,15 +31,26 @@ namespace Jellyfin.Data.Entities
         /// <param name="_episode0"></param>
         public EpisodeMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Episode _episode0)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
-            if (_episode0 == null) throw new ArgumentNullException(nameof(_episode0));
-            _episode0.EpisodeMetadata.Add(this);
+            if (_episode0 == null)
+            {
+                throw new ArgumentNullException(nameof(_episode0));
+            }
 
+            _episode0.EpisodeMetadata.Add(this);
 
             Init();
         }

+ 10 - 3
Jellyfin.Data/Entities/Genre.cs

@@ -31,12 +31,19 @@ namespace Jellyfin.Data.Entities
         /// <param name="_metadata0"></param>
         public Genre(string name, Metadata _metadata0)
         {
-            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
+            if (string.IsNullOrEmpty(name))
+            {
+                throw new ArgumentNullException(nameof(name));
+            }
+
             this.Name = name;
 
-            if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
-            _metadata0.Genres.Add(this);
+            if (_metadata0 == null)
+            {
+                throw new ArgumentNullException(nameof(_metadata0));
+            }
 
+            _metadata0.Genres.Add(this);
 
             Init();
         }

+ 5 - 2
Jellyfin.Data/Entities/Library.cs

@@ -30,9 +30,12 @@ namespace Jellyfin.Data.Entities
         /// <param name="name"></param>
         public Library(string name)
         {
-            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
-            this.Name = name;
+            if (string.IsNullOrEmpty(name))
+            {
+                throw new ArgumentNullException(nameof(name));
+            }
 
+            this.Name = name;
 
             Init();
         }

+ 5 - 2
Jellyfin.Data/Entities/LibraryRoot.cs

@@ -30,9 +30,12 @@ namespace Jellyfin.Data.Entities
         /// <param name="path">Absolute Path.</param>
         public LibraryRoot(string path)
         {
-            if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
-            this.Path = path;
+            if (string.IsNullOrEmpty(path))
+            {
+                throw new ArgumentNullException(nameof(path));
+            }
 
+            this.Path = path;
 
             Init();
         }

+ 10 - 2
Jellyfin.Data/Entities/MediaFile.cs

@@ -35,12 +35,20 @@ namespace Jellyfin.Data.Entities
         /// <param name="_release0"></param>
         public MediaFile(string path, Enums.MediaFileKind kind, Release _release0)
         {
-            if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
+            if (string.IsNullOrEmpty(path))
+            {
+                throw new ArgumentNullException(nameof(path));
+            }
+
             this.Path = path;
 
             this.Kind = kind;
 
-            if (_release0 == null) throw new ArgumentNullException(nameof(_release0));
+            if (_release0 == null)
+            {
+                throw new ArgumentNullException(nameof(_release0));
+            }
+
             _release0.MediaFiles.Add(this);
 
             this.MediaFileStreams = new HashSet<MediaFileStream>();

+ 5 - 2
Jellyfin.Data/Entities/MediaFileStream.cs

@@ -33,9 +33,12 @@ namespace Jellyfin.Data.Entities
         {
             this.StreamNumber = streamnumber;
 
-            if (_mediafile0 == null) throw new ArgumentNullException(nameof(_mediafile0));
-            _mediafile0.MediaFileStreams.Add(this);
+            if (_mediafile0 == null)
+            {
+                throw new ArgumentNullException(nameof(_mediafile0));
+            }
 
+            _mediafile0.MediaFileStreams.Add(this);
 
             Init();
         }

+ 10 - 2
Jellyfin.Data/Entities/Metadata.cs

@@ -30,10 +30,18 @@ namespace Jellyfin.Data.Entities
         /// <param name="language">ISO-639-3 3-character language codes.</param>
         protected Metadata(string title, string language, DateTime dateadded, DateTime datemodified)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
             this.PersonRoles = new HashSet<PersonRole>();

+ 5 - 2
Jellyfin.Data/Entities/MetadataProvider.cs

@@ -30,9 +30,12 @@ namespace Jellyfin.Data.Entities
         /// <param name="name"></param>
         public MetadataProvider(string name)
         {
-            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
-            this.Name = name;
+            if (string.IsNullOrEmpty(name))
+            {
+                throw new ArgumentNullException(nameof(name));
+            }
 
+            this.Name = name;
 
             Init();
         }

+ 25 - 6
Jellyfin.Data/Entities/MetadataProviderId.cs

@@ -40,21 +40,40 @@ namespace Jellyfin.Data.Entities
             // NOTE: This class has one-to-one associations with MetadataProviderId.
             // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
 
-            if (string.IsNullOrEmpty(providerid)) throw new ArgumentNullException(nameof(providerid));
+            if (string.IsNullOrEmpty(providerid))
+            {
+                throw new ArgumentNullException(nameof(providerid));
+            }
+
             this.ProviderId = providerid;
 
-            if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
+            if (_metadata0 == null)
+            {
+                throw new ArgumentNullException(nameof(_metadata0));
+            }
+
             _metadata0.Sources.Add(this);
 
-            if (_person1 == null) throw new ArgumentNullException(nameof(_person1));
+            if (_person1 == null)
+            {
+                throw new ArgumentNullException(nameof(_person1));
+            }
+
             _person1.Sources.Add(this);
 
-            if (_personrole2 == null) throw new ArgumentNullException(nameof(_personrole2));
+            if (_personrole2 == null)
+            {
+                throw new ArgumentNullException(nameof(_personrole2));
+            }
+
             _personrole2.Sources.Add(this);
 
-            if (_ratingsource3 == null) throw new ArgumentNullException(nameof(_ratingsource3));
-            _ratingsource3.Source = this;
+            if (_ratingsource3 == null)
+            {
+                throw new ArgumentNullException(nameof(_ratingsource3));
+            }
 
+            _ratingsource3.Source = this;
 
             Init();
         }

+ 15 - 3
Jellyfin.Data/Entities/MovieMetadata.cs

@@ -35,13 +35,25 @@ namespace Jellyfin.Data.Entities
         /// <param name="_movie0"></param>
         public MovieMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Movie _movie0)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
-            if (_movie0 == null) throw new ArgumentNullException(nameof(_movie0));
+            if (_movie0 == null)
+            {
+                throw new ArgumentNullException(nameof(_movie0));
+            }
+
             _movie0.MovieMetadata.Add(this);
 
             this.Studios = new HashSet<Company>();

+ 15 - 3
Jellyfin.Data/Entities/MusicAlbumMetadata.cs

@@ -35,13 +35,25 @@ namespace Jellyfin.Data.Entities
         /// <param name="_musicalbum0"></param>
         public MusicAlbumMetadata(string title, string language, DateTime dateadded, DateTime datemodified, MusicAlbum _musicalbum0)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
-            if (_musicalbum0 == null) throw new ArgumentNullException(nameof(_musicalbum0));
+            if (_musicalbum0 == null)
+            {
+                throw new ArgumentNullException(nameof(_musicalbum0));
+            }
+
             _musicalbum0.MusicAlbumMetadata.Add(this);
 
             this.Labels = new HashSet<Company>();

+ 5 - 1
Jellyfin.Data/Entities/Person.cs

@@ -36,7 +36,11 @@ namespace Jellyfin.Data.Entities
         {
             this.UrlId = urlid;
 
-            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
+            if (string.IsNullOrEmpty(name))
+            {
+                throw new ArgumentNullException(nameof(name));
+            }
+
             this.Name = name;
 
             this.Sources = new HashSet<MetadataProviderId>();

+ 5 - 1
Jellyfin.Data/Entities/PersonRole.cs

@@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
 
             this.Type = type;
 
-            if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
+            if (_metadata0 == null)
+            {
+                throw new ArgumentNullException(nameof(_metadata0));
+            }
+
             _metadata0.PersonRoles.Add(this);
 
             this.Sources = new HashSet<MetadataProviderId>();

+ 15 - 4
Jellyfin.Data/Entities/PhotoMetadata.cs

@@ -31,15 +31,26 @@ namespace Jellyfin.Data.Entities
         /// <param name="_photo0"></param>
         public PhotoMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Photo _photo0)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
-            if (_photo0 == null) throw new ArgumentNullException(nameof(_photo0));
-            _photo0.PhotoMetadata.Add(this);
+            if (_photo0 == null)
+            {
+                throw new ArgumentNullException(nameof(_photo0));
+            }
 
+            _photo0.PhotoMetadata.Add(this);
 
             Init();
         }

+ 15 - 4
Jellyfin.Data/Entities/ProviderMapping.cs

@@ -34,15 +34,26 @@ namespace Jellyfin.Data.Entities
         /// <param name="_group1"></param>
         public ProviderMapping(string providername, string providersecrets, string providerdata, User _user0, Group _group1)
         {
-            if (string.IsNullOrEmpty(providername)) throw new ArgumentNullException(nameof(providername));
+            if (string.IsNullOrEmpty(providername))
+            {
+                throw new ArgumentNullException(nameof(providername));
+            }
+
             this.ProviderName = providername;
 
-            if (string.IsNullOrEmpty(providersecrets)) throw new ArgumentNullException(nameof(providersecrets));
+            if (string.IsNullOrEmpty(providersecrets))
+            {
+                throw new ArgumentNullException(nameof(providersecrets));
+            }
+
             this.ProviderSecrets = providersecrets;
 
-            if (string.IsNullOrEmpty(providerdata)) throw new ArgumentNullException(nameof(providerdata));
-            this.ProviderData = providerdata;
+            if (string.IsNullOrEmpty(providerdata))
+            {
+                throw new ArgumentNullException(nameof(providerdata));
+            }
 
+            this.ProviderData = providerdata;
 
             Init();
         }

+ 5 - 2
Jellyfin.Data/Entities/Rating.cs

@@ -33,9 +33,12 @@ namespace Jellyfin.Data.Entities
         {
             this.Value = value;
 
-            if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
-            _metadata0.Ratings.Add(this);
+            if (_metadata0 == null)
+            {
+                throw new ArgumentNullException(nameof(_metadata0));
+            }
 
+            _metadata0.Ratings.Add(this);
 
             Init();
         }

+ 5 - 2
Jellyfin.Data/Entities/RatingSource.cs

@@ -39,9 +39,12 @@ namespace Jellyfin.Data.Entities
 
             this.MinimumValue = minimumvalue;
 
-            if (_rating0 == null) throw new ArgumentNullException(nameof(_rating0));
-            _rating0.RatingType = this;
+            if (_rating0 == null)
+            {
+                throw new ArgumentNullException(nameof(_rating0));
+            }
 
+            _rating0.RatingType = this;
 
             Init();
         }

+ 35 - 7
Jellyfin.Data/Entities/Release.cs

@@ -40,25 +40,53 @@ namespace Jellyfin.Data.Entities
         /// <param name="_photo5"></param>
         public Release(string name, Movie _movie0, Episode _episode1, Track _track2, CustomItem _customitem3, Book _book4, Photo _photo5)
         {
-            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
+            if (string.IsNullOrEmpty(name))
+            {
+                throw new ArgumentNullException(nameof(name));
+            }
+
             this.Name = name;
 
-            if (_movie0 == null) throw new ArgumentNullException(nameof(_movie0));
+            if (_movie0 == null)
+            {
+                throw new ArgumentNullException(nameof(_movie0));
+            }
+
             _movie0.Releases.Add(this);
 
-            if (_episode1 == null) throw new ArgumentNullException(nameof(_episode1));
+            if (_episode1 == null)
+            {
+                throw new ArgumentNullException(nameof(_episode1));
+            }
+
             _episode1.Releases.Add(this);
 
-            if (_track2 == null) throw new ArgumentNullException(nameof(_track2));
+            if (_track2 == null)
+            {
+                throw new ArgumentNullException(nameof(_track2));
+            }
+
             _track2.Releases.Add(this);
 
-            if (_customitem3 == null) throw new ArgumentNullException(nameof(_customitem3));
+            if (_customitem3 == null)
+            {
+                throw new ArgumentNullException(nameof(_customitem3));
+            }
+
             _customitem3.Releases.Add(this);
 
-            if (_book4 == null) throw new ArgumentNullException(nameof(_book4));
+            if (_book4 == null)
+            {
+                throw new ArgumentNullException(nameof(_book4));
+            }
+
             _book4.Releases.Add(this);
 
-            if (_photo5 == null) throw new ArgumentNullException(nameof(_photo5));
+            if (_photo5 == null)
+            {
+                throw new ArgumentNullException(nameof(_photo5));
+            }
+
             _photo5.Releases.Add(this);
 
             this.MediaFiles = new HashSet<MediaFile>();

+ 5 - 1
Jellyfin.Data/Entities/Season.cs

@@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
 
             this.UrlId = urlid;
 
-            if (_series0 == null) throw new ArgumentNullException(nameof(_series0));
+            if (_series0 == null)
+            {
+                throw new ArgumentNullException(nameof(_series0));
+            }
+
             _series0.Seasons.Add(this);
 
             this.SeasonMetadata = new HashSet<SeasonMetadata>();

+ 15 - 4
Jellyfin.Data/Entities/SeasonMetadata.cs

@@ -32,15 +32,26 @@ namespace Jellyfin.Data.Entities
         /// <param name="_season0"></param>
         public SeasonMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Season _season0)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
-            if (_season0 == null) throw new ArgumentNullException(nameof(_season0));
-            _season0.SeasonMetadata.Add(this);
+            if (_season0 == null)
+            {
+                throw new ArgumentNullException(nameof(_season0));
+            }
 
+            _season0.SeasonMetadata.Add(this);
 
             Init();
         }

+ 15 - 3
Jellyfin.Data/Entities/SeriesMetadata.cs

@@ -35,13 +35,25 @@ namespace Jellyfin.Data.Entities
         /// <param name="_series0"></param>
         public SeriesMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Series _series0)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
-            if (_series0 == null) throw new ArgumentNullException(nameof(_series0));
+            if (_series0 == null)
+            {
+                throw new ArgumentNullException(nameof(_series0));
+            }
+
             _series0.SeriesMetadata.Add(this);
 
             this.Networks = new HashSet<Company>();

+ 5 - 1
Jellyfin.Data/Entities/Track.cs

@@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
 
             this.UrlId = urlid;
 
-            if (_musicalbum0 == null) throw new ArgumentNullException(nameof(_musicalbum0));
+            if (_musicalbum0 == null)
+            {
+                throw new ArgumentNullException(nameof(_musicalbum0));
+            }
+
             _musicalbum0.Tracks.Add(this);
 
             this.Releases = new HashSet<Release>();

+ 15 - 4
Jellyfin.Data/Entities/TrackMetadata.cs

@@ -31,15 +31,26 @@ namespace Jellyfin.Data.Entities
         /// <param name="_track0"></param>
         public TrackMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Track _track0)
         {
-            if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+            if (string.IsNullOrEmpty(title))
+            {
+                throw new ArgumentNullException(nameof(title));
+            }
+
             this.Title = title;
 
-            if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+            if (string.IsNullOrEmpty(language))
+            {
+                throw new ArgumentNullException(nameof(language));
+            }
+
             this.Language = language;
 
-            if (_track0 == null) throw new ArgumentNullException(nameof(_track0));
-            _track0.TrackMetadata.Add(this);
+            if (_track0 == null)
+            {
+                throw new ArgumentNullException(nameof(_track0));
+            }
 
+            _track0.TrackMetadata.Add(this);
 
             Init();
         }

+ 4 - 1
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -690,7 +690,10 @@ namespace MediaBrowser.Controller.Entities
         /// <returns>System.String.</returns>
         protected virtual string CreateSortName()
         {
-            if (Name == null) return null; // some items may not have name filled in properly
+            if (Name == null)
+            {
+                return null; // some items may not have name filled in properly
+            }
 
             if (!EnableAlphaNumericSorting)
             {

+ 5 - 1
MediaBrowser.Controller/Library/ItemResolveArgs.cs

@@ -252,7 +252,11 @@ namespace MediaBrowser.Controller.Library
         {
             if (args != null)
             {
-                if (args.Path == null && Path == null) return true;
+                if (args.Path == null && Path == null)
+                {
+                    return true;
+                }
+
                 return args.Path != null && BaseItem.FileSystem.AreEqual(args.Path, Path);
             }
 

+ 25 - 5
MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs

@@ -1065,23 +1065,43 @@ namespace MediaBrowser.MediaEncoding.Probing
 
             // These support mulitple values, but for now we only store the first.
             var mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Artist Id"));
-            if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMARTISTID"));
+            if (mb == null)
+            {
+                mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMARTISTID"));
+            }
+
             audio.SetProviderId(MetadataProvider.MusicBrainzAlbumArtist, mb);
 
             mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Artist Id"));
-            if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ARTISTID"));
+            if (mb == null)
+            {
+                mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ARTISTID"));
+            }
+
             audio.SetProviderId(MetadataProvider.MusicBrainzArtist, mb);
 
             mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Id"));
-            if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMID"));
+            if (mb == null)
+            {
+                mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMID"));
+            }
+
             audio.SetProviderId(MetadataProvider.MusicBrainzAlbum, mb);
 
             mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Group Id"));
-            if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASEGROUPID"));
+            if (mb == null)
+            {
+                mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASEGROUPID"));
+            }
+
             audio.SetProviderId(MetadataProvider.MusicBrainzReleaseGroup, mb);
 
             mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Track Id"));
-            if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASETRACKID"));
+            if (mb == null)
+            {
+                mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASETRACKID"));
+            }
+
             audio.SetProviderId(MetadataProvider.MusicBrainzTrack, mb);
         }
 

+ 4 - 1
MediaBrowser.Model/Dlna/StreamBuilder.cs

@@ -384,7 +384,10 @@ namespace MediaBrowser.Model.Dlna
                         audioCodecProfiles.Add(i);
                     }
 
-                    if (audioCodecProfiles.Count >= 1) break;
+                    if (audioCodecProfiles.Count >= 1)
+                    {
+                        break;
+                    }
                 }
 
                 var audioTranscodingConditions = new List<ProfileCondition>();

+ 4 - 1
MediaBrowser.Model/Entities/MediaStream.cs

@@ -421,7 +421,10 @@ namespace MediaBrowser.Model.Entities
         {
             get
             {
-                if (Type != MediaStreamType.Subtitle) return false;
+                if (Type != MediaStreamType.Subtitle)
+                {
+                    return false;
+                }
 
                 if (string.IsNullOrEmpty(Codec) && !IsExternal)
                 {

+ 15 - 3
MediaBrowser.Model/Services/RouteAttribute.cs

@@ -128,9 +128,21 @@ namespace MediaBrowser.Model.Services
 
         public override bool Equals(object obj)
         {
-            if (ReferenceEquals(null, obj)) return false;
-            if (ReferenceEquals(this, obj)) return true;
-            if (obj.GetType() != this.GetType()) return false;
+            if (ReferenceEquals(null, obj))
+            {
+                return false;
+            }
+
+            if (ReferenceEquals(this, obj))
+            {
+                return true;
+            }
+
+            if (obj.GetType() != this.GetType())
+            {
+                return false;
+            }
+
             return Equals((RouteAttribute)obj);
         }
 

+ 4 - 1
MediaBrowser.Providers/Manager/ItemImageProvider.cs

@@ -113,7 +113,10 @@ namespace MediaBrowser.Providers.Manager
 
                 foreach (var imageType in images)
                 {
-                    if (!IsEnabled(savedOptions, imageType, item)) continue;
+                    if (!IsEnabled(savedOptions, imageType, item))
+                    {
+                        continue;
+                    }
 
                     if (!HasImage(item, imageType) || (refreshOptions.IsReplacingImage(imageType) && !downloadedImages.Contains(imageType)))
                     {

+ 4 - 1
MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetProvider.cs

@@ -159,7 +159,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
         {
             var mainResult = await FetchMainResult(tmdbId, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
 
-            if (mainResult == null) return;
+            if (mainResult == null)
+            {
+                return;
+            }
 
             var dataFilePath = GetDataFilePath(_config.ApplicationPaths, tmdbId, preferredMetadataLanguage);
 

+ 4 - 1
MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs

@@ -194,7 +194,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
         {
             var mainResult = await FetchMainResult(id, true, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
 
-            if (mainResult == null) return;
+            if (mainResult == null)
+            {
+                return;
+            }
 
             var dataFilePath = GetDataFilePath(id, preferredMetadataLanguage);
 

+ 4 - 1
RSSDP/DeviceAvailableEventArgs.cs

@@ -22,7 +22,10 @@ namespace Rssdp
         /// <exception cref="ArgumentNullException">Thrown if the <paramref name="discoveredDevice"/> parameter is null.</exception>
         public DeviceAvailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool isNewlyDiscovered)
         {
-            if (discoveredDevice == null) throw new ArgumentNullException(nameof(discoveredDevice));
+            if (discoveredDevice == null)
+            {
+                throw new ArgumentNullException(nameof(discoveredDevice));
+            }
 
             _DiscoveredDevice = discoveredDevice;
             _IsNewlyDiscovered = isNewlyDiscovered;

+ 4 - 1
RSSDP/DeviceEventArgs.cs

@@ -16,7 +16,10 @@ namespace Rssdp
         /// <exception cref="ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
         public DeviceEventArgs(SsdpDevice device)
         {
-            if (device == null) throw new ArgumentNullException(nameof(device));
+            if (device == null)
+            {
+                throw new ArgumentNullException(nameof(device));
+            }
 
             _Device = device;
         }

+ 4 - 1
RSSDP/DeviceUnavailableEventArgs.cs

@@ -19,7 +19,10 @@ namespace Rssdp
         /// <exception cref="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));
+            if (discoveredDevice == null)
+            {
+                throw new ArgumentNullException(nameof(discoveredDevice));
+            }
 
             _DiscoveredDevice = discoveredDevice;
             _Expired = expired;

+ 4 - 1
RSSDP/DisposableManagedObjectBase.cs

@@ -23,7 +23,10 @@ namespace Rssdp.Infrastructure
         /// <seealso cref="Dispose()"/>
         protected virtual void ThrowIfDisposed()
         {
-            if (this.IsDisposed) throw new ObjectDisposedException(this.GetType().FullName);
+            if (this.IsDisposed)
+            {
+                throw new ObjectDisposedException(this.GetType().FullName);
+            }
         }
 
         /// <summary>

+ 22 - 5
RSSDP/HttpParserBase.cs

@@ -31,9 +31,20 @@ namespace Rssdp.Infrastructure
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "Honestly, it's fine. MemoryStream doesn't mind.")]
         protected virtual void Parse(T message, System.Net.Http.Headers.HttpHeaders headers, string data)
         {
-            if (data == null) throw new ArgumentNullException(nameof(data));
-            if (data.Length == 0) throw new ArgumentException("data cannot be an empty string.", nameof(data));
-            if (!LineTerminators.Any(data.Contains)) throw new ArgumentException("data is not a valid request, it does not contain any CRLF/LF terminators.", nameof(data));
+            if (data == null)
+            {
+                throw new ArgumentNullException(nameof(data));
+            }
+
+            if (data.Length == 0)
+            {
+                throw new ArgumentException("data cannot be an empty string.", nameof(data));
+            }
+
+            if (!LineTerminators.Any(data.Contains))
+            {
+                throw new ArgumentException("data is not a valid request, it does not contain any CRLF/LF terminators.", nameof(data));
+            }
 
             using (var retVal = new ByteArrayContent(Array.Empty<byte>()))
             {
@@ -66,10 +77,16 @@ namespace Rssdp.Infrastructure
         /// <returns>A <see cref="Version"/> object containing the parsed version data.</returns>
         protected Version ParseHttpVersion(string versionData)
         {
-            if (versionData == null) throw new ArgumentNullException(nameof(versionData));
+            if (versionData == null)
+            {
+                throw new ArgumentNullException(nameof(versionData));
+            }
 
             var versionSeparatorIndex = versionData.IndexOf('/');
-            if (versionSeparatorIndex <= 0 || versionSeparatorIndex == versionData.Length) throw new ArgumentException("request header line is invalid. Http Version not supplied or incorrect format.", nameof(versionData));
+            if (versionSeparatorIndex <= 0 || versionSeparatorIndex == versionData.Length)
+            {
+                throw new ArgumentException("request header line is invalid. Http Version not supplied or incorrect format.", nameof(versionData));
+            }
 
             return Version.Parse(versionData.Substring(versionSeparatorIndex + 1));
         }

+ 13 - 3
RSSDP/HttpRequestParser.cs

@@ -45,11 +45,21 @@ namespace Rssdp.Infrastructure
         /// <param name="message">Either a <see cref="HttpResponseMessage"/> or <see cref="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));
+            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));
+            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;

+ 13 - 3
RSSDP/HttpResponseParser.cs

@@ -57,11 +57,21 @@ namespace Rssdp.Infrastructure
         /// <param name="message">Either a <see cref="HttpResponseMessage"/> or <see cref="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));
+            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));
+            if (parts.Length < 2)
+            {
+                throw new ArgumentException("data status line is invalid. Insufficient status parts.", nameof(data));
+            }
 
             message.Version = ParseHttpVersion(parts[0].Trim());
 

+ 9 - 2
RSSDP/IEnumerableExtensions.cs

@@ -8,8 +8,15 @@ namespace Rssdp.Infrastructure
     {
         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));
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (selector == null)
+            {
+                throw new ArgumentNullException(nameof(selector));
+            }
 
             return !source.Any() ? source :
                 source.Concat(

+ 17 - 4
RSSDP/SsdpCommunicationsServer.cs

@@ -80,8 +80,15 @@ namespace Rssdp.Infrastructure
         /// <exception cref="ArgumentOutOfRangeException">The <paramref name="multicastTimeToLive"/> argument is less than or equal to zero.</exception>
         public SsdpCommunicationsServer(ISocketFactory socketFactory, int localPort, int multicastTimeToLive, INetworkManager networkManager, ILogger logger, bool enableMultiSocketBinding)
         {
-            if (socketFactory == null) throw new ArgumentNullException(nameof(socketFactory));
-            if (multicastTimeToLive <= 0) throw new ArgumentOutOfRangeException(nameof(multicastTimeToLive), "multicastTimeToLive must be greater than zero.");
+            if (socketFactory == null)
+            {
+                throw new ArgumentNullException(nameof(socketFactory));
+            }
+
+            if (multicastTimeToLive <= 0)
+            {
+                throw new ArgumentOutOfRangeException(nameof(multicastTimeToLive), "multicastTimeToLive must be greater than zero.");
+            }
 
             _BroadcastListenSocketSynchroniser = new object();
             _SendSocketSynchroniser = new object();
@@ -151,7 +158,10 @@ namespace Rssdp.Infrastructure
         /// </summary>
         public async Task SendMessage(byte[] messageData, IPEndPoint destination, IPAddress fromLocalIpAddress, CancellationToken cancellationToken)
         {
-            if (messageData == null) throw new ArgumentNullException(nameof(messageData));
+            if (messageData == null)
+            {
+                throw new ArgumentNullException(nameof(messageData));
+            }
 
             ThrowIfDisposed();
 
@@ -234,7 +244,10 @@ namespace Rssdp.Infrastructure
         /// </summary>
         public async Task SendMulticastMessage(string message, int sendCount, IPAddress fromLocalIpAddress, CancellationToken cancellationToken)
         {
-            if (message == null) throw new ArgumentNullException(nameof(message));
+            if (message == null)
+            {
+                throw new ArgumentNullException(nameof(message));
+            }
 
             byte[] messageData = Encoding.UTF8.GetBytes(message);
 

+ 18 - 4
RSSDP/SsdpDevice.cs

@@ -259,9 +259,20 @@ namespace Rssdp
         /// <seealso cref="DeviceAdded"/>
         public void AddDevice(SsdpEmbeddedDevice device)
         {
-            if (device == null) throw new ArgumentNullException(nameof(device));
-            if (device.RootDevice != null && device.RootDevice != this.ToRootDevice()) throw new InvalidOperationException("This device is already associated with a different root device (has been added as a child in another branch).");
-            if (device == this) throw new InvalidOperationException("Can't add device to itself.");
+            if (device == null)
+            {
+                throw new ArgumentNullException(nameof(device));
+            }
+
+            if (device.RootDevice != null && device.RootDevice != this.ToRootDevice())
+            {
+                throw new InvalidOperationException("This device is already associated with a different root device (has been added as a child in another branch).");
+            }
+
+            if (device == this)
+            {
+                throw new InvalidOperationException("Can't add device to itself.");
+            }
 
             bool wasAdded = false;
             lock (_Devices)
@@ -287,7 +298,10 @@ namespace Rssdp
         /// <seealso cref="DeviceRemoved"/>
         public void RemoveDevice(SsdpEmbeddedDevice device)
         {
-            if (device == null) throw new ArgumentNullException(nameof(device));
+            if (device == null)
+            {
+                throw new ArgumentNullException(nameof(device));
+            }
 
             bool wasRemoved = false;
             lock (_Devices)

+ 69 - 15
RSSDP/SsdpDeviceLocator.cs

@@ -27,7 +27,10 @@ namespace Rssdp.Infrastructure
         /// </summary>
         public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer)
         {
-            if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer));
+            if (communicationsServer == null)
+            {
+                throw new ArgumentNullException(nameof(communicationsServer));
+            }
 
             _CommunicationsServer = communicationsServer;
             _CommunicationsServer.ResponseReceived += CommsServer_ResponseReceived;
@@ -140,10 +143,25 @@ namespace Rssdp.Infrastructure
 
         private Task SearchAsync(string searchTarget, TimeSpan searchWaitTime, CancellationToken cancellationToken)
         {
-            if (searchTarget == null) throw new ArgumentNullException(nameof(searchTarget));
-            if (searchTarget.Length == 0) throw new ArgumentException("searchTarget cannot be an empty string.", nameof(searchTarget));
-            if (searchWaitTime.TotalSeconds < 0) throw new ArgumentException("searchWaitTime must be a positive time.");
-            if (searchWaitTime.TotalSeconds > 0 && searchWaitTime.TotalSeconds <= 1) throw new ArgumentException("searchWaitTime must be zero (if you are not using the result and relying entirely in the events), or greater than one second.");
+            if (searchTarget == null)
+            {
+                throw new ArgumentNullException(nameof(searchTarget));
+            }
+
+            if (searchTarget.Length == 0)
+            {
+                throw new ArgumentException("searchTarget cannot be an empty string.", nameof(searchTarget));
+            }
+
+            if (searchWaitTime.TotalSeconds < 0)
+            {
+                throw new ArgumentException("searchWaitTime must be a positive time.");
+            }
+
+            if (searchWaitTime.TotalSeconds > 0 && searchWaitTime.TotalSeconds <= 1)
+            {
+                throw new ArgumentException("searchWaitTime must be zero (if you are not using the result and relying entirely in the events), or greater than one second.");
+            }
 
             ThrowIfDisposed();
 
@@ -192,7 +210,10 @@ namespace Rssdp.Infrastructure
         /// <seealso cref="DeviceAvailable"/>
         protected virtual void OnDeviceAvailable(DiscoveredSsdpDevice device, bool isNewDevice, IPAddress localIpAddress)
         {
-            if (this.IsDisposed) return;
+            if (this.IsDisposed)
+            {
+                return;
+            }
 
             var handlers = this.DeviceAvailable;
             if (handlers != null)
@@ -210,11 +231,16 @@ namespace Rssdp.Infrastructure
         /// <seealso cref="DeviceUnavailable"/>
         protected virtual void OnDeviceUnavailable(DiscoveredSsdpDevice device, bool expired)
         {
-            if (this.IsDisposed) return;
+            if (this.IsDisposed)
+            {
+                return;
+            }
 
             var handlers = this.DeviceUnavailable;
             if (handlers != null)
+            {
                 handlers(this, new DeviceUnavailableEventArgs(device, expired));
+            }
         }
 
         /// <summary>
@@ -281,7 +307,10 @@ namespace Rssdp.Infrastructure
 
         private void DeviceFound(DiscoveredSsdpDevice device, bool isNewDevice, IPAddress localIpAddress)
         {
-            if (!NotificationTypeMatchesFilter(device)) return;
+            if (!NotificationTypeMatchesFilter(device))
+            {
+                return;
+            }
 
             OnDeviceAvailable(device, isNewDevice, localIpAddress);
         }
@@ -318,7 +347,10 @@ namespace Rssdp.Infrastructure
 
         private void ProcessSearchResponseMessage(HttpResponseMessage message, IPAddress localIpAddress)
         {
-            if (!message.IsSuccessStatusCode) return;
+            if (!message.IsSuccessStatusCode)
+            {
+                return;
+            }
 
             var location = GetFirstHeaderUriValue("Location", message);
             if (location != null)
@@ -339,13 +371,20 @@ namespace Rssdp.Infrastructure
 
         private void ProcessNotificationMessage(HttpRequestMessage message, IPAddress localIpAddress)
         {
-            if (String.Compare(message.Method.Method, "Notify", StringComparison.OrdinalIgnoreCase) != 0) return;
+            if (String.Compare(message.Method.Method, "Notify", StringComparison.OrdinalIgnoreCase) != 0)
+            {
+                return;
+            }
 
             var notificationType = GetFirstHeaderStringValue("NTS", message);
             if (String.Compare(notificationType, SsdpConstants.SsdpKeepAliveNotification, StringComparison.OrdinalIgnoreCase) == 0)
+            {
                 ProcessAliveNotification(message, localIpAddress);
+            }
             else if (String.Compare(notificationType, SsdpConstants.SsdpByeByeNotification, StringComparison.OrdinalIgnoreCase) == 0)
+            {
                 ProcessByeByeNotification(message);
+            }
         }
 
         private void ProcessAliveNotification(HttpRequestMessage message, IPAddress localIpAddress)
@@ -454,14 +493,20 @@ namespace Rssdp.Infrastructure
 
         private TimeSpan CacheAgeFromHeader(System.Net.Http.Headers.CacheControlHeaderValue headerValue)
         {
-            if (headerValue == null) return TimeSpan.Zero;
+            if (headerValue == null)
+            {
+                return TimeSpan.Zero;
+            }
 
             return (TimeSpan)(headerValue.MaxAge ?? headerValue.SharedMaxAge ?? TimeSpan.Zero);
         }
 
         private void RemoveExpiredDevicesFromCache()
         {
-            if (this.IsDisposed) return;
+            if (this.IsDisposed)
+            {
+                return;
+            }
 
             DiscoveredSsdpDevice[] expiredDevices = null;
             lock (_Devices)
@@ -470,7 +515,10 @@ namespace Rssdp.Infrastructure
 
                 foreach (var device in expiredDevices)
                 {
-                    if (this.IsDisposed) return;
+                    if (this.IsDisposed)
+                    {
+                        return;
+                    }
 
                     _Devices.Remove(device);
                 }
@@ -481,7 +529,10 @@ namespace Rssdp.Infrastructure
             // problems.
             foreach (var expiredUsn in (from expiredDevice in expiredDevices select expiredDevice.Usn).Distinct())
             {
-                if (this.IsDisposed) return;
+                if (this.IsDisposed)
+                {
+                    return;
+                }
 
                 DeviceDied(expiredUsn, true);
             }
@@ -495,7 +546,10 @@ namespace Rssdp.Infrastructure
                 existingDevices = FindExistingDeviceNotifications(_Devices, deviceUsn);
                 foreach (var existingDevice in existingDevices)
                 {
-                    if (this.IsDisposed) return true;
+                    if (this.IsDisposed)
+                    {
+                        return true;
+                    }
 
                     _Devices.Remove(existingDevice);
                 }

+ 63 - 12
RSSDP/SsdpDevicePublisher.cs

@@ -40,12 +40,35 @@ namespace Rssdp.Infrastructure
         public SsdpDevicePublisher(ISsdpCommunicationsServer communicationsServer, INetworkManager networkManager,
             string osName, string osVersion, bool sendOnlyMatchedHost)
         {
-            if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer));
-            if (networkManager == null) throw new ArgumentNullException(nameof(networkManager));
-            if (osName == null) throw new ArgumentNullException(nameof(osName));
-            if (osName.Length == 0) throw new ArgumentException("osName cannot be an empty string.", nameof(osName));
-            if (osVersion == null) throw new ArgumentNullException(nameof(osVersion));
-            if (osVersion.Length == 0) throw new ArgumentException("osVersion cannot be an empty string.", nameof(osName));
+            if (communicationsServer == null)
+            {
+                throw new ArgumentNullException(nameof(communicationsServer));
+            }
+
+            if (networkManager == null)
+            {
+                throw new ArgumentNullException(nameof(networkManager));
+            }
+
+            if (osName == null)
+            {
+                throw new ArgumentNullException(nameof(osName));
+            }
+
+            if (osName.Length == 0)
+            {
+                throw new ArgumentException("osName cannot be an empty string.", nameof(osName));
+            }
+
+            if (osVersion == null)
+            {
+                throw new ArgumentNullException(nameof(osVersion));
+            }
+
+            if (osVersion.Length == 0)
+            {
+                throw new ArgumentException("osVersion cannot be an empty string.", nameof(osName));
+            }
 
             _SupportPnpRootDevice = true;
             _Devices = new List<SsdpRootDevice>();
@@ -82,7 +105,10 @@ namespace Rssdp.Infrastructure
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "t", Justification = "Capture task to local variable supresses compiler warning, but task is not really needed.")]
         public void AddDevice(SsdpRootDevice device)
         {
-            if (device == null) throw new ArgumentNullException(nameof(device));
+            if (device == null)
+            {
+                throw new ArgumentNullException(nameof(device));
+            }
 
             ThrowIfDisposed();
 
@@ -115,7 +141,10 @@ namespace Rssdp.Infrastructure
         /// <exception cref="ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
         public async Task RemoveDevice(SsdpRootDevice device)
         {
-            if (device == null) throw new ArgumentNullException(nameof(device));
+            if (device == null)
+            {
+                throw new ArgumentNullException(nameof(device));
+            }
 
             bool wasRemoved = false;
             lock (_Devices)
@@ -227,10 +256,15 @@ namespace Rssdp.Infrastructure
                 // return;
             }
 
-            if (!Int32.TryParse(mx, out maxWaitInterval) || maxWaitInterval <= 0) return;
+            if (!Int32.TryParse(mx, out maxWaitInterval) || maxWaitInterval <= 0)
+            {
+                return;
+            }
 
             if (maxWaitInterval > 120)
+            {
                 maxWaitInterval = _Random.Next(0, 120);
+            }
 
             // Do not block synchronously as that may tie up a threadpool thread for several seconds.
             Task.Delay(_Random.Next(16, (maxWaitInterval * 1000))).ContinueWith((parentTask) =>
@@ -240,13 +274,21 @@ namespace Rssdp.Infrastructure
                 lock (_Devices)
                 {
                     if (String.Compare(SsdpConstants.SsdpDiscoverAllSTHeader, searchTarget, StringComparison.OrdinalIgnoreCase) == 0)
+                    {
                         devices = GetAllDevicesAsFlatEnumerable().ToArray();
+                    }
                     else if (String.Compare(SsdpConstants.UpnpDeviceTypeRootDevice, searchTarget, StringComparison.OrdinalIgnoreCase) == 0 || (this.SupportPnpRootDevice && String.Compare(SsdpConstants.PnpDeviceTypeRootDevice, searchTarget, StringComparison.OrdinalIgnoreCase) == 0))
+                    {
                         devices = _Devices.ToArray();
+                    }
                     else if (searchTarget.Trim().StartsWith("uuid:", StringComparison.OrdinalIgnoreCase))
+                    {
                         devices = (from device in GetAllDevicesAsFlatEnumerable() where String.Compare(device.Uuid, searchTarget.Substring(5), StringComparison.OrdinalIgnoreCase) == 0 select device).ToArray();
+                    }
                     else if (searchTarget.StartsWith("urn:", StringComparison.OrdinalIgnoreCase))
+                    {
                         devices = (from device in GetAllDevicesAsFlatEnumerable() where String.Compare(device.FullDeviceType, searchTarget, StringComparison.OrdinalIgnoreCase) == 0 select device).ToArray();
+                    }
                 }
 
                 if (devices != null)
@@ -382,7 +424,10 @@ namespace Rssdp.Infrastructure
         {
             try
             {
-                if (IsDisposed) return;
+                if (IsDisposed)
+                {
+                    return;
+                }
 
                 // WriteTrace("Begin Sending Alive Notifications For All Devices");
 
@@ -394,7 +439,10 @@ namespace Rssdp.Infrastructure
 
                 foreach (var device in devices)
                 {
-                    if (IsDisposed) return;
+                    if (IsDisposed)
+                    {
+                        return;
+                    }
 
                     SendAliveNotifications(device, true, CancellationToken.None);
                 }
@@ -547,7 +595,10 @@ namespace Rssdp.Infrastructure
 
         private void CommsServer_RequestReceived(object sender, RequestReceivedEventArgs e)
         {
-            if (this.IsDisposed) return;
+            if (this.IsDisposed)
+            {
+                return;
+            }
 
             if (string.Equals(e.Message.Method.Method, SsdpConstants.MSearchMethod, StringComparison.OrdinalIgnoreCase))
             {