瀏覽代碼

Enable nullabe reference types for MediaBrowser.Model

Bond_009 5 年之前
父節點
當前提交
30ce346f34
共有 100 個文件被更改,包括 321 次插入271 次删除
  1. 6 10
      Emby.Dlna/Ssdp/DeviceDiscovery.cs
  2. 1 1
      Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
  3. 2 2
      Emby.Server.Implementations/Cryptography/CryptographyProvider.cs
  4. 4 12
      Emby.Server.Implementations/Devices/DeviceManager.cs
  5. 2 1
      Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
  6. 1 5
      Emby.Server.Implementations/Library/MediaSourceManager.cs
  7. 5 5
      Emby.Server.Implementations/Library/UserManager.cs
  8. 2 2
      Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
  9. 15 42
      Emby.Server.Implementations/LiveTv/LiveTvManager.cs
  10. 1 4
      Emby.Server.Implementations/Playlists/PlaylistManager.cs
  11. 4 7
      Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
  12. 2 9
      Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
  13. 1 1
      Emby.Server.Implementations/Updates/InstallationManager.cs
  14. 2 13
      MediaBrowser.Api/EnvironmentService.cs
  15. 1 2
      MediaBrowser.Api/Images/RemoteImageService.cs
  16. 11 2
      MediaBrowser.Controller/LiveTv/TimerEventInfo.cs
  17. 1 0
      MediaBrowser.Model/Activity/ActivityLogEntry.cs
  18. 1 0
      MediaBrowser.Model/ApiClient/ServerDiscoveryInfo.cs
  19. 1 0
      MediaBrowser.Model/Branding/BrandingOptions.cs
  20. 1 0
      MediaBrowser.Model/Channels/ChannelFeatures.cs
  21. 1 0
      MediaBrowser.Model/Channels/ChannelInfo.cs
  22. 6 0
      MediaBrowser.Model/Channels/ChannelQuery.cs
  23. 1 0
      MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs
  24. 13 0
      MediaBrowser.Model/Configuration/EncodingOptions.cs
  25. 1 0
      MediaBrowser.Model/Configuration/LibraryOptions.cs
  26. 4 0
      MediaBrowser.Model/Configuration/MetadataOptions.cs
  27. 1 0
      MediaBrowser.Model/Configuration/MetadataPlugin.cs
  28. 1 0
      MediaBrowser.Model/Configuration/MetadataPluginSummary.cs
  29. 1 0
      MediaBrowser.Model/Configuration/ServerConfiguration.cs
  30. 1 0
      MediaBrowser.Model/Configuration/UserConfiguration.cs
  31. 1 0
      MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs
  32. 1 1
      MediaBrowser.Model/Cryptography/ICryptoProvider.cs
  33. 5 1
      MediaBrowser.Model/Devices/ContentUploadHistory.cs
  34. 1 0
      MediaBrowser.Model/Devices/DeviceInfo.cs
  35. 3 0
      MediaBrowser.Model/Devices/DevicesOptions.cs
  36. 4 0
      MediaBrowser.Model/Devices/LocalFileInfo.cs
  37. 8 0
      MediaBrowser.Model/Diagnostics/IProcess.cs
  38. 11 0
      MediaBrowser.Model/Diagnostics/IProcessFactory.cs
  39. 6 0
      MediaBrowser.Model/Dlna/AudioOptions.cs
  40. 1 0
      MediaBrowser.Model/Dlna/CodecProfile.cs
  41. 4 32
      MediaBrowser.Model/Dlna/ConditionProcessor.cs
  42. 3 1
      MediaBrowser.Model/Dlna/ContainerProfile.cs
  43. 5 1
      MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
  44. 1 0
      MediaBrowser.Model/Dlna/DeviceIdentification.cs
  45. 1 0
      MediaBrowser.Model/Dlna/DeviceProfile.cs
  46. 1 0
      MediaBrowser.Model/Dlna/DeviceProfileInfo.cs
  47. 1 0
      MediaBrowser.Model/Dlna/DirectPlayProfile.cs
  48. 1 0
      MediaBrowser.Model/Dlna/HttpHeaderInfo.cs
  49. 5 0
      MediaBrowser.Model/Dlna/ITranscoderSupport.cs
  50. 14 10
      MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs
  51. 13 12
      MediaBrowser.Model/Dlna/ProfileCondition.cs
  52. 1 0
      MediaBrowser.Model/Dlna/ResolutionConfiguration.cs
  53. 4 1
      MediaBrowser.Model/Dlna/ResolutionNormalizer.cs
  54. 1 0
      MediaBrowser.Model/Dlna/ResolutionOptions.cs
  55. 3 1
      MediaBrowser.Model/Dlna/ResponseProfile.cs
  56. 4 5
      MediaBrowser.Model/Dlna/SearchCriteria.cs
  57. 2 0
      MediaBrowser.Model/Dlna/StreamBuilder.cs
  58. 1 0
      MediaBrowser.Model/Dlna/StreamInfo.cs
  59. 1 0
      MediaBrowser.Model/Dlna/SubtitleProfile.cs
  60. 9 0
      MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs
  61. 1 0
      MediaBrowser.Model/Dlna/TranscodingProfile.cs
  62. 4 0
      MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs
  63. 1 0
      MediaBrowser.Model/Dlna/VideoOptions.cs
  64. 1 0
      MediaBrowser.Model/Dlna/XmlAttribute.cs
  65. 3 2
      MediaBrowser.Model/Drawing/DrawingUtils.cs
  66. 1 0
      MediaBrowser.Model/Dto/BaseItemDto.cs
  67. 1 0
      MediaBrowser.Model/Dto/BaseItemPerson.cs
  68. 1 0
      MediaBrowser.Model/Dto/IHasServerId.cs
  69. 1 0
      MediaBrowser.Model/Dto/ImageByNameInfo.cs
  70. 3 2
      MediaBrowser.Model/Dto/ImageInfo.cs
  71. 9 8
      MediaBrowser.Model/Dto/ImageOptions.cs
  72. 0 20
      MediaBrowser.Model/Dto/ItemIndex.cs
  73. 1 0
      MediaBrowser.Model/Dto/MediaSourceInfo.cs
  74. 1 0
      MediaBrowser.Model/Dto/MetadataEditorInfo.cs
  75. 1 0
      MediaBrowser.Model/Dto/NameIdPair.cs
  76. 1 1
      MediaBrowser.Model/Dto/NameValuePair.cs
  77. 1 0
      MediaBrowser.Model/Dto/RecommendationDto.cs
  78. 1 0
      MediaBrowser.Model/Dto/UserDto.cs
  79. 1 0
      MediaBrowser.Model/Dto/UserItemDataDto.cs
  80. 1 0
      MediaBrowser.Model/Entities/ChapterInfo.cs
  81. 1 0
      MediaBrowser.Model/Entities/DisplayPreferences.cs
  82. 1 1
      MediaBrowser.Model/Entities/IHasProviderIds.cs
  83. 15 14
      MediaBrowser.Model/Entities/LibraryUpdateInfo.cs
  84. 1 0
      MediaBrowser.Model/Entities/MediaAttachment.cs
  85. 1 0
      MediaBrowser.Model/Entities/MediaStream.cs
  86. 1 0
      MediaBrowser.Model/Entities/MediaUrl.cs
  87. 7 6
      MediaBrowser.Model/Entities/PackageReviewInfo.cs
  88. 12 12
      MediaBrowser.Model/Entities/ParentalRating.cs
  89. 6 6
      MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
  90. 1 0
      MediaBrowser.Model/Entities/VirtualFolderInfo.cs
  91. 0 7
      MediaBrowser.Model/Events/GenericEventArgs.cs
  92. 2 0
      MediaBrowser.Model/Extensions/ListHelper.cs
  93. 2 2
      MediaBrowser.Model/Extensions/StringHelper.cs
  94. 1 0
      MediaBrowser.Model/Globalization/CountryInfo.cs
  95. 1 0
      MediaBrowser.Model/Globalization/CultureDto.cs
  96. 1 0
      MediaBrowser.Model/Globalization/ILocalizationManager.cs
  97. 2 0
      MediaBrowser.Model/Globalization/LocalizationOption.cs
  98. 20 7
      MediaBrowser.Model/IO/FileSystemEntryInfo.cs
  99. 1 0
      MediaBrowser.Model/IO/FileSystemMetadata.cs
  100. 1 0
      MediaBrowser.Model/IO/IFileSystem.cs

+ 6 - 10
Emby.Dlna/Ssdp/DeviceDiscovery.cs

@@ -100,15 +100,13 @@ namespace Emby.Dlna.Ssdp
 
             var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
 
-            var args = new GenericEventArgs<UpnpDeviceInfo>
-            {
-                Argument = new UpnpDeviceInfo
+            var args = new GenericEventArgs<UpnpDeviceInfo>(
+                new UpnpDeviceInfo
                 {
                     Location = e.DiscoveredDevice.DescriptionLocation,
                     Headers = headers,
                     LocalIpAddress = e.LocalIpAddress
-                }
-            };
+                });
 
             DeviceDiscoveredInternal?.Invoke(this, args);
         }
@@ -121,14 +119,12 @@ namespace Emby.Dlna.Ssdp
 
             var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
 
-            var args = new GenericEventArgs<UpnpDeviceInfo>
-            {
-                Argument = new UpnpDeviceInfo
+            var args = new GenericEventArgs<UpnpDeviceInfo>(
+                new UpnpDeviceInfo
                 {
                     Location = e.DiscoveredDevice.DescriptionLocation,
                     Headers = headers
-                }
-            };
+                });
 
             DeviceLeft?.Invoke(this, args);
         }

+ 1 - 1
Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs

@@ -91,7 +91,7 @@ namespace Emby.Server.Implementations.Configuration
             ValidateMetadataPath(newConfig);
             ValidateSslCertificate(newConfig);
 
-            ConfigurationUpdating?.Invoke(this, new GenericEventArgs<ServerConfiguration> { Argument = newConfig });
+            ConfigurationUpdating?.Invoke(this, new GenericEventArgs<ServerConfiguration>(newConfig));
 
             base.ReplaceConfiguration(newConfiguration);
         }

+ 2 - 2
Emby.Server.Implementations/Cryptography/CryptographyProvider.cs

@@ -1,3 +1,5 @@
+#nullable enable
+
 using System;
 using System.Collections.Generic;
 using System.Security.Cryptography;
@@ -134,8 +136,6 @@ namespace Emby.Server.Implementations.Cryptography
                 _randomNumberGenerator.Dispose();
             }
 
-            _randomNumberGenerator = null;
-
             _disposed = true;
         }
     }

+ 4 - 12
Emby.Server.Implementations/Devices/DeviceManager.cs

@@ -86,13 +86,7 @@ namespace Emby.Server.Implementations.Devices
         {
             _authRepo.UpdateDeviceOptions(deviceId, options);
 
-            if (DeviceOptionsUpdated != null)
-            {
-                DeviceOptionsUpdated(this, new GenericEventArgs<Tuple<string, DeviceOptions>>()
-                {
-                    Argument = new Tuple<string, DeviceOptions>(deviceId, options)
-                });
-            }
+            DeviceOptionsUpdated?.Invoke(this, new GenericEventArgs<Tuple<string, DeviceOptions>>(new Tuple<string, DeviceOptions>(deviceId, options)));
         }
 
         public DeviceOptions GetDeviceOptions(string deviceId)
@@ -251,14 +245,12 @@ namespace Emby.Server.Implementations.Devices
 
             if (CameraImageUploaded != null)
             {
-                CameraImageUploaded?.Invoke(this, new GenericEventArgs<CameraImageUploadInfo>
-                {
-                    Argument = new CameraImageUploadInfo
+                CameraImageUploaded?.Invoke(this, new GenericEventArgs<CameraImageUploadInfo>(
+                    new CameraImageUploadInfo
                     {
                         Device = device,
                         FileInfo = file
-                    }
-                });
+                    }));
             }
         }
 

+ 2 - 1
Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs

@@ -44,10 +44,11 @@ namespace Emby.Server.Implementations.EntryPoints
         }
 
         /// <inheritdoc />
-        public async Task RunAsync()
+        public Task RunAsync()
         {
             _udpServer = new UdpServer(_logger, _appHost);
             _udpServer.Start(PortNumber, _cancellationTokenSource.Token);
+            return Task.CompletedTask;
         }
 
         /// <inheritdoc />

+ 1 - 5
Emby.Server.Implementations/Library/MediaSourceManager.cs

@@ -521,11 +521,7 @@ namespace Emby.Server.Implementations.Library
                 SetDefaultAudioAndSubtitleStreamIndexes(item, clone, user);
             }
 
-            return new Tuple<LiveStreamResponse, IDirectStreamProvider>(new LiveStreamResponse
-            {
-                MediaSource = clone
-
-            }, liveStream as IDirectStreamProvider);
+            return new Tuple<LiveStreamResponse, IDirectStreamProvider>(new LiveStreamResponse(clone), liveStream as IDirectStreamProvider);
         }
 
         private static void AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio)

+ 5 - 5
Emby.Server.Implementations/Library/UserManager.cs

@@ -131,7 +131,7 @@ namespace Emby.Server.Implementations.Library
         /// <param name="user">The user.</param>
         private void OnUserUpdated(User user)
         {
-            UserUpdated?.Invoke(this, new GenericEventArgs<User> { Argument = user });
+            UserUpdated?.Invoke(this, new GenericEventArgs<User>(user));
         }
 
         /// <summary>
@@ -140,7 +140,7 @@ namespace Emby.Server.Implementations.Library
         /// <param name="user">The user.</param>
         private void OnUserDeleted(User user)
         {
-            UserDeleted?.Invoke(this, new GenericEventArgs<User> { Argument = user });
+            UserDeleted?.Invoke(this, new GenericEventArgs<User>(user));
         }
 
         public NameIdPair[] GetAuthenticationProviders()
@@ -755,7 +755,7 @@ namespace Emby.Server.Implementations.Library
 
             _userRepository.CreateUser(user);
 
-            EventHelper.QueueEventIfNotNull(UserCreated, this, new GenericEventArgs<User> { Argument = user }, _logger);
+            EventHelper.QueueEventIfNotNull(UserCreated, this, new GenericEventArgs<User>(user), _logger);
 
             return user;
         }
@@ -980,7 +980,7 @@ namespace Emby.Server.Implementations.Library
 
             if (fireEvent)
             {
-                UserPolicyUpdated?.Invoke(this, new GenericEventArgs<User> { Argument = user });
+                UserPolicyUpdated?.Invoke(this, new GenericEventArgs<User>(user));
             }
         }
 
@@ -1050,7 +1050,7 @@ namespace Emby.Server.Implementations.Library
 
             if (fireEvent)
             {
-                UserConfigurationUpdated?.Invoke(this, new GenericEventArgs<User> { Argument = user });
+                UserConfigurationUpdated?.Invoke(this, new GenericEventArgs<User>(user));
             }
         }
     }

+ 2 - 2
Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs

@@ -109,7 +109,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
 
             if (startDate < now)
             {
-                TimerFired?.Invoke(this, new GenericEventArgs<TimerInfo> { Argument = item });
+                TimerFired?.Invoke(this, new GenericEventArgs<TimerInfo>(item));
                 return;
             }
 
@@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             var timer = GetAll().FirstOrDefault(i => string.Equals(i.Id, timerId, StringComparison.OrdinalIgnoreCase));
             if (timer != null)
             {
-                TimerFired?.Invoke(this, new GenericEventArgs<TimerInfo> { Argument = timer });
+                TimerFired?.Invoke(this, new GenericEventArgs<TimerInfo>(timer));
             }
         }
 

+ 15 - 42
Emby.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -149,27 +149,18 @@ namespace Emby.Server.Implementations.LiveTv
         {
             var timerId = e.Argument;
 
-            TimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>
-            {
-                Argument = new TimerEventInfo
-                {
-                    Id = timerId
-                }
-            });
+            TimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>(new TimerEventInfo(timerId)));
         }
 
         private void OnEmbyTvTimerCreated(object sender, GenericEventArgs<TimerInfo> e)
         {
             var timer = e.Argument;
 
-            TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>
-            {
-                Argument = new TimerEventInfo
+            TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>(
+                new TimerEventInfo(timer.Id)
                 {
-                    ProgramId = _tvDtoService.GetInternalProgramId(timer.ProgramId),
-                    Id = timer.Id
-                }
-            });
+                    ProgramId = _tvDtoService.GetInternalProgramId(timer.ProgramId)
+                }));
         }
 
         public List<NameIdPair> GetTunerHostTypes()
@@ -1725,13 +1716,7 @@ namespace Emby.Server.Implementations.LiveTv
 
             if (!(service is EmbyTV.EmbyTV))
             {
-                TimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>
-                {
-                    Argument = new TimerEventInfo
-                    {
-                        Id = id
-                    }
-                });
+                TimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>(new TimerEventInfo(id)));
             }
         }
 
@@ -1748,13 +1733,7 @@ namespace Emby.Server.Implementations.LiveTv
 
             await service.CancelSeriesTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false);
 
-            SeriesTimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>
-            {
-                Argument = new TimerEventInfo
-                {
-                    Id = id
-                }
-            });
+            SeriesTimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>(new TimerEventInfo(id)));
         }
 
         public async Task<TimerInfoDto> GetTimer(string id, CancellationToken cancellationToken)
@@ -2073,14 +2052,11 @@ namespace Emby.Server.Implementations.LiveTv
 
             if (!(service is EmbyTV.EmbyTV))
             {
-                TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>
-                {
-                    Argument = new TimerEventInfo
+                TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>(
+                    new TimerEventInfo(newTimerId)
                     {
-                        ProgramId = _tvDtoService.GetInternalProgramId(info.ProgramId),
-                        Id = newTimerId
-                    }
-                });
+                        ProgramId = _tvDtoService.GetInternalProgramId(info.ProgramId)
+                    }));
             }
         }
 
@@ -2105,14 +2081,11 @@ namespace Emby.Server.Implementations.LiveTv
                 await service.CreateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false);
             }
 
-            SeriesTimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>
-            {
-                Argument = new TimerEventInfo
+            SeriesTimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>(
+                new TimerEventInfo(newTimerId)
                 {
-                    ProgramId = _tvDtoService.GetInternalProgramId(info.ProgramId),
-                    Id = newTimerId
-                }
-            });
+                    ProgramId = _tvDtoService.GetInternalProgramId(info.ProgramId)
+                }));
         }
 
         public async Task UpdateTimer(TimerInfoDto timer, CancellationToken cancellationToken)

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

@@ -153,10 +153,7 @@ namespace Emby.Server.Implementations.Playlists
                     });
                 }
 
-                return new PlaylistCreationResult
-                {
-                    Id = playlist.Id.ToString("N", CultureInfo.InvariantCulture)
-                };
+                return new PlaylistCreationResult(playlist.Id.ToString("N", CultureInfo.InvariantCulture));
             }
             finally
             {

+ 4 - 7
Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs

@@ -392,7 +392,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
 
             ((TaskManager)TaskManager).OnTaskExecuting(this);
 
-            progress.ProgressChanged += progress_ProgressChanged;
+            progress.ProgressChanged += OnProgressChanged;
 
             TaskCompletionStatus status;
             CurrentExecutionStartTime = DateTime.UtcNow;
@@ -426,7 +426,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
             var startTime = CurrentExecutionStartTime;
             var endTime = DateTime.UtcNow;
 
-            progress.ProgressChanged -= progress_ProgressChanged;
+            progress.ProgressChanged -= OnProgressChanged;
             CurrentCancellationTokenSource.Dispose();
             CurrentCancellationTokenSource = null;
             CurrentProgress = null;
@@ -439,16 +439,13 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// </summary>
         /// <param name="sender">The sender.</param>
         /// <param name="e">The e.</param>
-        void progress_ProgressChanged(object sender, double e)
+        private void OnProgressChanged(object sender, double e)
         {
             e = Math.Min(e, 100);
 
             CurrentProgress = e;
 
-            TaskProgress?.Invoke(this, new GenericEventArgs<double>
-            {
-                Argument = e
-            });
+            TaskProgress?.Invoke(this, new GenericEventArgs<double>(e));
         }
 
         /// <summary>

+ 2 - 9
Emby.Server.Implementations/ScheduledTasks/TaskManager.cs

@@ -254,10 +254,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// <param name="task">The task.</param>
         internal void OnTaskExecuting(IScheduledTaskWorker task)
         {
-            TaskExecuting?.Invoke(this, new GenericEventArgs<IScheduledTaskWorker>
-            {
-                Argument = task
-            });
+            TaskExecuting?.Invoke(this, new GenericEventArgs<IScheduledTaskWorker>(task));
         }
 
         /// <summary>
@@ -267,11 +264,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// <param name="result">The result.</param>
         internal void OnTaskCompleted(IScheduledTaskWorker task, TaskResult result)
         {
-            TaskCompleted?.Invoke(task, new TaskCompletionEventArgs
-            {
-                Result = result,
-                Task = task
-            });
+            TaskCompleted?.Invoke(task, new TaskCompletionEventArgs(task, result));
 
             ExecuteQueuedTasks();
         }

+ 1 - 1
Emby.Server.Implementations/Updates/InstallationManager.cs

@@ -427,7 +427,7 @@ namespace Emby.Server.Implementations.Updates
                 _config.SaveConfiguration();
             }
 
-            PluginUninstalled?.Invoke(this, new GenericEventArgs<IPlugin> { Argument = plugin });
+            PluginUninstalled?.Invoke(this, new GenericEventArgs<IPlugin>(plugin));
 
             _applicationHost.NotifyPendingRestart();
         }

+ 2 - 13
MediaBrowser.Api/EnvironmentService.cs

@@ -226,12 +226,7 @@ namespace MediaBrowser.Api
         /// <returns>IEnumerable{FileSystemEntryInfo}.</returns>
         private IEnumerable<FileSystemEntryInfo> GetDrives()
         {
-            return _fileSystem.GetDrives().Select(d => new FileSystemEntryInfo
-            {
-                Name = d.Name,
-                Path = d.FullName,
-                Type = FileSystemEntryType.Directory
-            });
+            return _fileSystem.GetDrives().Select(d => new FileSystemEntryInfo(d.Name, d.FullName, FileSystemEntryType.Directory));
         }
 
         /// <summary>
@@ -266,13 +261,7 @@ namespace MediaBrowser.Api
                 return true;
             });
 
-            return entries.Select(f => new FileSystemEntryInfo
-            {
-                Name = f.Name,
-                Path = f.FullName,
-                Type = f.IsDirectory ? FileSystemEntryType.Directory : FileSystemEntryType.File
-
-            });
+            return entries.Select(f => new FileSystemEntryInfo(f.Name, f.FullName, f.IsDirectory ? FileSystemEntryType.Directory : FileSystemEntryType.File));
         }
 
         public object Get(GetParentPath request)

+ 1 - 2
MediaBrowser.Api/Images/RemoteImageService.cs

@@ -147,9 +147,8 @@ namespace MediaBrowser.Api.Images
         {
             var item = _libraryManager.GetItemById(request.Id);
 
-            var images = await _providerManager.GetAvailableRemoteImages(item, new RemoteImageQuery
+            var images = await _providerManager.GetAvailableRemoteImages(item, new RemoteImageQuery(request.ProviderName)
             {
-                ProviderName = request.ProviderName,
                 IncludeAllLanguages = request.IncludeAllLanguages,
                 IncludeDisabledProviders = true,
                 ImageType = request.Type

+ 11 - 2
MediaBrowser.Controller/LiveTv/TimerEventInfo.cs

@@ -1,10 +1,19 @@
+#nullable enable
+#pragma warning disable CS1591
+
 using System;
 
 namespace MediaBrowser.Controller.LiveTv
 {
     public class TimerEventInfo
     {
-        public string Id { get; set; }
-        public Guid ProgramId { get; set; }
+        public TimerEventInfo(string id)
+        {
+            Id = id;
+        }
+
+        public string Id { get; }
+
+        public Guid? ProgramId { get; set; }
     }
 }

+ 1 - 0
MediaBrowser.Model/Activity/ActivityLogEntry.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/ApiClient/ServerDiscoveryInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.ApiClient

+ 1 - 0
MediaBrowser.Model/Branding/BrandingOptions.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Branding

+ 1 - 0
MediaBrowser.Model/Channels/ChannelFeatures.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Channels/ChannelInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Channels

+ 6 - 0
MediaBrowser.Model/Channels/ChannelQuery.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -13,8 +14,11 @@ namespace MediaBrowser.Model.Channels
         /// </summary>
         /// <value>The fields.</value>
         public ItemFields[] Fields { get; set; }
+
         public bool? EnableImages { get; set; }
+
         public int? ImageTypeLimit { get; set; }
+
         public ImageType[] EnableImageTypes { get; set; }
 
         /// <summary>
@@ -48,7 +52,9 @@ namespace MediaBrowser.Model.Channels
         /// </summary>
         /// <value><c>null</c> if [is favorite] contains no value, <c>true</c> if [is favorite]; otherwise, <c>false</c>.</value>
         public bool? IsFavorite { get; set; }
+
         public bool? IsRecordingsFolder { get; set; }
+
         public bool RefreshLatestChannelItems { get; set; }
     }
 }

+ 1 - 0
MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs

@@ -1,3 +1,4 @@
+#nullable disable
 using System;
 using System.Xml.Serialization;
 

+ 13 - 0
MediaBrowser.Model/Configuration/EncodingOptions.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Configuration
@@ -5,10 +6,15 @@ namespace MediaBrowser.Model.Configuration
     public class EncodingOptions
     {
         public int EncodingThreadCount { get; set; }
+
         public string TranscodingTempPath { get; set; }
+
         public double DownMixAudioBoost { get; set; }
+
         public bool EnableThrottling { get; set; }
+
         public int ThrottleDelaySeconds { get; set; }
+
         public string HardwareAccelerationType { get; set; }
 
         /// <summary>
@@ -20,12 +26,19 @@ namespace MediaBrowser.Model.Configuration
         /// The current FFmpeg path being used by the system and displayed on the transcode page.
         /// </summary>
         public string EncoderAppPathDisplay { get; set; }
+
         public string VaapiDevice { get; set; }
+
         public int H264Crf { get; set; }
+
         public int H265Crf { get; set; }
+
         public string EncoderPreset { get; set; }
+
         public string DeinterlaceMethod { get; set; }
+
         public bool EnableHardwareEncoding { get; set; }
+
         public bool EnableSubtitleExtraction { get; set; }
 
         public string[] HardwareDecodingCodecs { get; set; }

+ 1 - 0
MediaBrowser.Model/Configuration/LibraryOptions.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 4 - 0
MediaBrowser.Model/Configuration/MetadataOptions.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -12,12 +13,15 @@ namespace MediaBrowser.Model.Configuration
         public string ItemType { get; set; }
 
         public string[] DisabledMetadataSavers { get; set; }
+
         public string[] LocalMetadataReaderOrder { get; set; }
 
         public string[] DisabledMetadataFetchers { get; set; }
+
         public string[] MetadataFetcherOrder { get; set; }
 
         public string[] DisabledImageFetchers { get; set; }
+
         public string[] ImageFetcherOrder { get; set; }
 
         public MetadataOptions()

+ 1 - 0
MediaBrowser.Model/Configuration/MetadataPlugin.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Configuration

+ 1 - 0
MediaBrowser.Model/Configuration/MetadataPluginSummary.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Configuration/ServerConfiguration.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Configuration/UserConfiguration.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Configuration

+ 1 - 1
MediaBrowser.Model/Cryptography/ICryptoProvider.cs

@@ -10,7 +10,7 @@ namespace MediaBrowser.Model.Cryptography
 
         IEnumerable<string> GetSupportedHashMethods();
 
-        byte[] ComputeHash(string HashMethod, byte[] bytes, byte[] salt);
+        byte[] ComputeHash(string hashMethod, byte[] bytes, byte[] salt);
 
         byte[] ComputeHashWithDefaultMethod(byte[] bytes, byte[] salt);
 

+ 5 - 1
MediaBrowser.Model/Devices/ContentUploadHistory.cs

@@ -1,15 +1,19 @@
+#nullable disable
 #pragma warning disable CS1591
 
+using System;
+
 namespace MediaBrowser.Model.Devices
 {
     public class ContentUploadHistory
     {
         public string DeviceId { get; set; }
+
         public LocalFileInfo[] FilesUploaded { get; set; }
 
         public ContentUploadHistory()
         {
-            FilesUploaded = new LocalFileInfo[] { };
+            FilesUploaded = Array.Empty<LocalFileInfo>();
         }
     }
 }

+ 1 - 0
MediaBrowser.Model/Devices/DeviceInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 3 - 0
MediaBrowser.Model/Devices/DevicesOptions.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -7,7 +8,9 @@ namespace MediaBrowser.Model.Devices
     public class DevicesOptions
     {
         public string[] EnabledCameraUploadDevices { get; set; }
+
         public string CameraUploadPath { get; set; }
+
         public bool EnableCameraUploadSubfolders { get; set; }
 
         public DevicesOptions()

+ 4 - 0
MediaBrowser.Model/Devices/LocalFileInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Devices
@@ -5,8 +6,11 @@ namespace MediaBrowser.Model.Devices
     public class LocalFileInfo
     {
         public string Name { get; set; }
+
         public string Id { get; set; }
+
         public string Album { get; set; }
+
         public string MimeType { get; set; }
     }
 }

+ 8 - 0
MediaBrowser.Model/Diagnostics/IProcess.cs

@@ -11,13 +11,21 @@ namespace MediaBrowser.Model.Diagnostics
         event EventHandler Exited;
 
         void Kill();
+
         bool WaitForExit(int timeMs);
+
         Task<bool> WaitForExitAsync(int timeMs);
+
         int ExitCode { get; }
+
         void Start();
+
         StreamWriter StandardInput { get; }
+
         StreamReader StandardError { get; }
+
         StreamReader StandardOutput { get; }
+
         ProcessOptions StartInfo { get; }
     }
 }

+ 11 - 0
MediaBrowser.Model/Diagnostics/IProcessFactory.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Diagnostics
@@ -10,15 +11,25 @@ namespace MediaBrowser.Model.Diagnostics
     public class ProcessOptions
     {
         public string FileName { get; set; }
+
         public string Arguments { get; set; }
+
         public string WorkingDirectory { get; set; }
+
         public bool CreateNoWindow { get; set; }
+
         public bool UseShellExecute { get; set; }
+
         public bool EnableRaisingEvents { get; set; }
+
         public bool ErrorDialog { get; set; }
+
         public bool RedirectStandardError { get; set; }
+
         public bool RedirectStandardInput { get; set; }
+
         public bool RedirectStandardOutput { get; set; }
+
         public bool IsHidden { get; set; }
     }
 }

+ 6 - 0
MediaBrowser.Model/Dlna/AudioOptions.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -19,12 +20,17 @@ namespace MediaBrowser.Model.Dlna
         }
 
         public bool EnableDirectPlay { get; set; }
+
         public bool EnableDirectStream { get; set; }
+
         public bool ForceDirectPlay { get; set; }
+
         public bool ForceDirectStream { get; set; }
 
         public Guid ItemId { get; set; }
+
         public MediaSourceInfo[] MediaSources { get; set; }
+
         public DeviceProfile Profile { get; set; }
 
         /// <summary>

+ 1 - 0
MediaBrowser.Model/Dlna/CodecProfile.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 4 - 32
MediaBrowser.Model/Dlna/ConditionProcessor.cs

@@ -15,7 +15,7 @@ namespace MediaBrowser.Model.Dlna
             int? height,
             int? videoBitDepth,
             int? videoBitrate,
-            string videoProfile,
+            string? videoProfile,
             double? videoLevel,
             float? videoFramerate,
             int? packetLength,
@@ -25,7 +25,7 @@ namespace MediaBrowser.Model.Dlna
             int? refFrames,
             int? numVideoStreams,
             int? numAudioStreams,
-            string videoCodecTag,
+            string? videoCodecTag,
             bool? isAvc)
         {
             switch (condition.Property)
@@ -103,7 +103,7 @@ namespace MediaBrowser.Model.Dlna
             int? audioBitrate,
             int? audioSampleRate,
             int? audioBitDepth,
-            string audioProfile,
+            string? audioProfile,
             bool? isSecondaryTrack)
         {
             switch (condition.Property)
@@ -154,7 +154,7 @@ namespace MediaBrowser.Model.Dlna
             return false;
         }
 
-        private static bool IsConditionSatisfied(ProfileCondition condition, string currentValue)
+        private static bool IsConditionSatisfied(ProfileCondition condition, string? currentValue)
         {
             if (string.IsNullOrEmpty(currentValue))
             {
@@ -203,34 +203,6 @@ namespace MediaBrowser.Model.Dlna
             return false;
         }
 
-        private static bool IsConditionSatisfied(ProfileCondition condition, float currentValue)
-        {
-            if (currentValue <= 0)
-            {
-                // If the value is unknown, it satisfies if not marked as required
-                return !condition.IsRequired;
-            }
-
-            if (float.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var expected))
-            {
-                switch (condition.Condition)
-                {
-                    case ProfileConditionType.Equals:
-                        return currentValue.Equals(expected);
-                    case ProfileConditionType.GreaterThanEqual:
-                        return currentValue >= expected;
-                    case ProfileConditionType.LessThanEqual:
-                        return currentValue <= expected;
-                    case ProfileConditionType.NotEquals:
-                        return !currentValue.Equals(expected);
-                    default:
-                        throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
-                }
-            }
-
-            return false;
-        }
-
         private static bool IsConditionSatisfied(ProfileCondition condition, double? currentValue)
         {
             if (!currentValue.HasValue)

+ 3 - 1
MediaBrowser.Model/Dlna/ContainerProfile.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -10,6 +11,7 @@ namespace MediaBrowser.Model.Dlna
     {
         [XmlAttribute("type")]
         public DlnaProfileType Type { get; set; }
+
         public ProfileCondition[] Conditions { get; set; }
 
         [XmlAttribute("container")]
@@ -45,7 +47,7 @@ namespace MediaBrowser.Model.Dlna
         public static bool ContainsContainer(string profileContainers, string inputContainer)
         {
             var isNegativeList = false;
-            if (profileContainers != null && profileContainers.StartsWith("-"))
+            if (profileContainers != null && profileContainers.StartsWith("-", StringComparison.Ordinal))
             {
                 isNegativeList = true;
                 profileContainers = profileContainers.Substring(1);

+ 5 - 1
MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -32,7 +33,10 @@ namespace MediaBrowser.Model.Dlna
                             DlnaFlags.InteractiveTransferMode |
                             DlnaFlags.DlnaV15;
 
-            string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", DlnaMaps.FlagsToString(flagValue));
+            string dlnaflags = string.Format(
+                CultureInfo.InvariantCulture,
+                ";DLNA.ORG_FLAGS={0}",
+                DlnaMaps.FlagsToString(flagValue));
 
             ResponseProfile mediaProfile = _profile.GetImageMediaProfile(container,
                 width,

+ 1 - 0
MediaBrowser.Model/Dlna/DeviceIdentification.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Dlna/DeviceProfile.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Dlna/DeviceProfileInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Dlna

+ 1 - 0
MediaBrowser.Model/Dlna/DirectPlayProfile.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System.Xml.Serialization;

+ 1 - 0
MediaBrowser.Model/Dlna/HttpHeaderInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System.Xml.Serialization;

+ 5 - 0
MediaBrowser.Model/Dlna/ITranscoderSupport.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Dlna
@@ -5,7 +6,9 @@ namespace MediaBrowser.Model.Dlna
     public interface ITranscoderSupport
     {
         bool CanEncodeToAudioCodec(string codec);
+
         bool CanEncodeToSubtitleCodec(string codec);
+
         bool CanExtractSubtitles(string codec);
     }
 
@@ -15,10 +18,12 @@ namespace MediaBrowser.Model.Dlna
         {
             return true;
         }
+
         public bool CanEncodeToSubtitleCodec(string codec)
         {
             return true;
         }
+
         public bool CanExtractSubtitles(string codec)
         {
             return true;

+ 14 - 10
MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -21,13 +22,13 @@ namespace MediaBrowser.Model.Dlna
             if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase))
             {
                 MediaFormatProfile? val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height);
-                return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
+                return val.HasValue ? new MediaFormatProfile[] { val.Value } : Array.Empty<MediaFormatProfile>();
             }
 
             if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase))
             {
                 MediaFormatProfile? val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height);
-                return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
+                return val.HasValue ? new MediaFormatProfile[] { val.Value } : Array.Empty<MediaFormatProfile>();
             }
 
             if (string.Equals(container, "avi", StringComparison.OrdinalIgnoreCase))
@@ -61,18 +62,18 @@ namespace MediaBrowser.Model.Dlna
             if (string.Equals(container, "3gp", StringComparison.OrdinalIgnoreCase))
             {
                 MediaFormatProfile? val = ResolveVideo3GPFormat(videoCodec, audioCodec);
-                return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
+                return val.HasValue ? new MediaFormatProfile[] { val.Value } : Array.Empty<MediaFormatProfile>();
             }
 
             if (string.Equals(container, "ogv", StringComparison.OrdinalIgnoreCase) || string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase))
                 return new MediaFormatProfile[] { MediaFormatProfile.OGV };
 
-            return new MediaFormatProfile[] { };
+            return Array.Empty<MediaFormatProfile>();
         }
 
         private MediaFormatProfile[] ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
         {
-            string suffix = "";
+            string suffix = string.Empty;
 
             switch (timestampType)
             {
@@ -92,16 +93,18 @@ namespace MediaBrowser.Model.Dlna
 
             if (string.Equals(videoCodec, "mpeg2video", StringComparison.OrdinalIgnoreCase))
             {
-                var list = new List<MediaFormatProfile>();
-
-                list.Add(ValueOf("MPEG_TS_SD_NA" + suffix));
-                list.Add(ValueOf("MPEG_TS_SD_EU" + suffix));
-                list.Add(ValueOf("MPEG_TS_SD_KO" + suffix));
+                var list = new List<MediaFormatProfile>
+                {
+                    ValueOf("MPEG_TS_SD_NA" + suffix),
+                    ValueOf("MPEG_TS_SD_EU" + suffix),
+                    ValueOf("MPEG_TS_SD_KO" + suffix)
+                };
 
                 if ((timestampType == TransportStreamTimestamp.Valid) && string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
                 {
                     list.Add(MediaFormatProfile.MPEG_TS_JP_T);
                 }
+
                 return list.ToArray();
             }
             if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
@@ -115,6 +118,7 @@ namespace MediaBrowser.Model.Dlna
                     {
                         return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_ISO };
                     }
+
                     return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_T };
                 }
 

+ 13 - 12
MediaBrowser.Model/Dlna/ProfileCondition.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System.Xml.Serialization;
@@ -6,18 +7,6 @@ namespace MediaBrowser.Model.Dlna
 {
     public class ProfileCondition
     {
-        [XmlAttribute("condition")]
-        public ProfileConditionType Condition { get; set; }
-
-        [XmlAttribute("property")]
-        public ProfileConditionValue Property { get; set; }
-
-        [XmlAttribute("value")]
-        public string Value { get; set; }
-
-        [XmlAttribute("isRequired")]
-        public bool IsRequired { get; set; }
-
         public ProfileCondition()
         {
             IsRequired = true;
@@ -36,5 +25,17 @@ namespace MediaBrowser.Model.Dlna
             Value = value;
             IsRequired = isRequired;
         }
+
+        [XmlAttribute("condition")]
+        public ProfileConditionType Condition { get; set; }
+
+        [XmlAttribute("property")]
+        public ProfileConditionValue Property { get; set; }
+
+        [XmlAttribute("value")]
+        public string Value { get; set; }
+
+        [XmlAttribute("isRequired")]
+        public bool IsRequired { get; set; }
     }
 }

+ 1 - 0
MediaBrowser.Model/Dlna/ResolutionConfiguration.cs

@@ -5,6 +5,7 @@ namespace MediaBrowser.Model.Dlna
     public class ResolutionConfiguration
     {
         public int MaxWidth { get; set; }
+
         public int MaxBitrate { get; set; }
 
         public ResolutionConfiguration(int maxWidth, int maxBitrate)

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

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -17,7 +18,8 @@ namespace MediaBrowser.Model.Dlna
                 new ResolutionConfiguration(3840, 35000000)
             };
 
-        public static ResolutionOptions Normalize(int? inputBitrate,
+        public static ResolutionOptions Normalize(
+            int? inputBitrate,
             int? unused1,
             int? unused2,
             int outputBitrate,
@@ -83,6 +85,7 @@ namespace MediaBrowser.Model.Dlna
             {
                 return .5;
             }
+
             return 1;
         }
 

+ 1 - 0
MediaBrowser.Model/Dlna/ResolutionOptions.cs

@@ -5,6 +5,7 @@ namespace MediaBrowser.Model.Dlna
     public class ResolutionOptions
     {
         public int? MaxWidth { get; set; }
+
         public int? MaxHeight { get; set; }
     }
 }

+ 3 - 1
MediaBrowser.Model/Dlna/ResponseProfile.cs

@@ -1,5 +1,7 @@
+#nullable disable
 #pragma warning disable CS1591
 
+using System;
 using System.Xml.Serialization;
 
 namespace MediaBrowser.Model.Dlna
@@ -28,7 +30,7 @@ namespace MediaBrowser.Model.Dlna
 
         public ResponseProfile()
         {
-            Conditions = new ProfileCondition[] { };
+            Conditions = Array.Empty<ProfileCondition>();
         }
 
         public string[] GetContainers()

+ 4 - 5
MediaBrowser.Model/Dlna/SearchCriteria.cs

@@ -34,9 +34,9 @@ namespace MediaBrowser.Model.Dlna
 
         public SearchCriteria(string search)
         {
-            if (string.IsNullOrEmpty(search))
+            if (search.Length == 0)
             {
-                throw new ArgumentNullException(nameof(search));
+                throw new ArgumentException("String can't be empty.", nameof(search));
             }
 
             SearchType = SearchType.Unknown;
@@ -48,11 +48,10 @@ namespace MediaBrowser.Model.Dlna
 
                 if (subFactors.Length == 3)
                 {
-
                     if (string.Equals("upnp:class", subFactors[0], StringComparison.OrdinalIgnoreCase) &&
-                        (string.Equals("=", subFactors[1]) || string.Equals("derivedfrom", subFactors[1], StringComparison.OrdinalIgnoreCase)))
+                        (string.Equals("=", subFactors[1], StringComparison.Ordinal) || string.Equals("derivedfrom", subFactors[1], StringComparison.OrdinalIgnoreCase)))
                     {
-                        if (string.Equals("\"object.item.imageItem\"", subFactors[2]) || string.Equals("\"object.item.imageItem.photo\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
+                        if (string.Equals("\"object.item.imageItem\"", subFactors[2], StringComparison.Ordinal) || string.Equals("\"object.item.imageItem.photo\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
                         {
                             SearchType = SearchType.Image;
                         }

+ 2 - 0
MediaBrowser.Model/Dlna/StreamBuilder.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -339,6 +340,7 @@ namespace MediaBrowser.Model.Dlna
                         {
                             transcodeReasons.Add(transcodeReason.Value);
                         }
+
                         all = false;
                         break;
                     }

+ 1 - 0
MediaBrowser.Model/Dlna/StreamInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Dlna/SubtitleProfile.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System.Xml.Serialization;

+ 9 - 0
MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Dlna
@@ -5,13 +6,21 @@ namespace MediaBrowser.Model.Dlna
     public class SubtitleStreamInfo
     {
         public string Url { get; set; }
+
         public string Language { get; set; }
+
         public string Name { get; set; }
+
         public bool IsForced { get; set; }
+
         public string Format { get; set; }
+
         public string DisplayTitle { get; set; }
+
         public int Index { get; set; }
+
         public SubtitleDeliveryMethod DeliveryMethod { get; set; }
+
         public bool IsExternalUrl { get; set; }
     }
 }

+ 1 - 0
MediaBrowser.Model/Dlna/TranscodingProfile.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System.Xml.Serialization;

+ 4 - 0
MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -9,8 +10,11 @@ namespace MediaBrowser.Model.Dlna
     public class UpnpDeviceInfo
     {
         public Uri Location { get; set; }
+
         public Dictionary<string, string> Headers { get; set; }
+
         public IPAddress LocalIpAddress { get; set; }
+
         public int LocalPort { get; set; }
     }
 }

+ 1 - 0
MediaBrowser.Model/Dlna/VideoOptions.cs

@@ -8,6 +8,7 @@ namespace MediaBrowser.Model.Dlna
     public class VideoOptions : AudioOptions
     {
         public int? AudioStreamIndex { get; set; }
+
         public int? SubtitleStreamIndex { get; set; }
     }
 }

+ 1 - 0
MediaBrowser.Model/Dlna/XmlAttribute.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System.Xml.Serialization;

+ 3 - 2
MediaBrowser.Model/Drawing/DrawingUtils.cs

@@ -16,7 +16,8 @@ namespace MediaBrowser.Model.Drawing
         /// <param name="maxWidth">A max fixed width, if desired.</param>
         /// <param name="maxHeight">A max fixed height, if desired.</param>
         /// <returns>A new size object.</returns>
-        public static ImageDimensions Resize(ImageDimensions size,
+        public static ImageDimensions Resize(
+            ImageDimensions size,
             int width,
             int height,
             int maxWidth,
@@ -62,7 +63,7 @@ namespace MediaBrowser.Model.Drawing
         /// <param name="currentHeight">Height of the current.</param>
         /// <param name="currentWidth">Width of the current.</param>
         /// <param name="newHeight">The new height.</param>
-        /// <returns>the new width</returns>
+        /// <returns>The new width.</returns>
         private static int GetNewWidth(int currentHeight, int currentWidth, int newHeight)
             => Convert.ToInt32((double)newHeight / currentHeight * currentWidth);
 

+ 1 - 0
MediaBrowser.Model/Dto/BaseItemDto.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Dto/BaseItemPerson.cs

@@ -1,3 +1,4 @@
+#nullable disable
 using System.Text.Json.Serialization;
 
 namespace MediaBrowser.Model.Dto

+ 1 - 0
MediaBrowser.Model/Dto/IHasServerId.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Dto

+ 1 - 0
MediaBrowser.Model/Dto/ImageByNameInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Dto

+ 3 - 2
MediaBrowser.Model/Dto/ImageInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 using MediaBrowser.Model.Entities;
 
 namespace MediaBrowser.Model.Dto
@@ -20,9 +21,9 @@ namespace MediaBrowser.Model.Dto
         public int? ImageIndex { get; set; }
 
         /// <summary>
-        /// The image tag
+        /// Gets or sets the image tag.
         /// </summary>
-        public string ImageTag;
+        public string ImageTag { get; set; }
 
         /// <summary>
         /// Gets or sets the path.

+ 9 - 8
MediaBrowser.Model/Dto/ImageOptions.cs

@@ -1,3 +1,4 @@
+#nullable disable
 using MediaBrowser.Model.Drawing;
 using MediaBrowser.Model.Entities;
 
@@ -8,6 +9,14 @@ namespace MediaBrowser.Model.Dto
     /// </summary>
     public class ImageOptions
     {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImageOptions" /> class.
+        /// </summary>
+        public ImageOptions()
+        {
+            EnableImageEnhancers = true;
+        }
+
         /// <summary>
         /// Gets or sets the type of the image.
         /// </summary>
@@ -98,13 +107,5 @@ namespace MediaBrowser.Model.Dto
         /// </summary>
         /// <value>The color of the background.</value>
         public string BackgroundColor { get; set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ImageOptions" /> class.
-        /// </summary>
-        public ImageOptions()
-        {
-            EnableImageEnhancers = true;
-        }
     }
 }

+ 0 - 20
MediaBrowser.Model/Dto/ItemIndex.cs

@@ -1,20 +0,0 @@
-namespace MediaBrowser.Model.Dto
-{
-    /// <summary>
-    /// Class ItemIndex.
-    /// </summary>
-    public class ItemIndex
-    {
-        /// <summary>
-        /// Gets or sets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name { get; set; }
-
-        /// <summary>
-        /// Gets or sets the item count.
-        /// </summary>
-        /// <value>The item count.</value>
-        public int ItemCount { get; set; }
-    }
-}

+ 1 - 0
MediaBrowser.Model/Dto/MediaSourceInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Dto/MetadataEditorInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Dto/NameIdPair.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 1
MediaBrowser.Model/Dto/NameValuePair.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Dto
@@ -6,7 +7,6 @@ namespace MediaBrowser.Model.Dto
     {
         public NameValuePair()
         {
-
         }
 
         public NameValuePair(string name, string value)

+ 1 - 0
MediaBrowser.Model/Dto/RecommendationDto.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Dto/UserDto.cs

@@ -1,3 +1,4 @@
+#nullable disable
 using System;
 using MediaBrowser.Model.Configuration;
 using MediaBrowser.Model.Users;

+ 1 - 0
MediaBrowser.Model/Dto/UserItemDataDto.cs

@@ -1,3 +1,4 @@
+#nullable disable
 using System;
 
 namespace MediaBrowser.Model.Dto

+ 1 - 0
MediaBrowser.Model/Entities/ChapterInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Entities/DisplayPreferences.cs

@@ -1,3 +1,4 @@
+#nullable disable
 using System.Collections.Generic;
 
 namespace MediaBrowser.Model.Entities

+ 1 - 1
MediaBrowser.Model/Entities/IHasProviderIds.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 namespace MediaBrowser.Model.Entities
 {
     /// <summary>
-    /// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repition by using extension methods.
+    /// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repetition by using extension methods.
     /// </summary>
     public interface IHasProviderIds
     {

+ 15 - 14
MediaBrowser.Model/Entities/LibraryUpdateInfo.cs

@@ -5,15 +5,29 @@ using System;
 namespace MediaBrowser.Model.Entities
 {
     /// <summary>
-    /// Class LibraryUpdateInfo
+    /// Class LibraryUpdateInfo.
     /// </summary>
     public class LibraryUpdateInfo
     {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class.
+        /// </summary>
+        public LibraryUpdateInfo()
+        {
+            FoldersAddedTo = Array.Empty<string>();
+            FoldersRemovedFrom = Array.Empty<string>();
+            ItemsAdded = Array.Empty<string>();
+            ItemsRemoved = Array.Empty<string>();
+            ItemsUpdated = Array.Empty<string>();
+            CollectionFolders = Array.Empty<string>();
+        }
+
         /// <summary>
         /// Gets or sets the folders added to.
         /// </summary>
         /// <value>The folders added to.</value>
         public string[] FoldersAddedTo { get; set; }
+
         /// <summary>
         /// Gets or sets the folders removed from.
         /// </summary>
@@ -41,18 +55,5 @@ namespace MediaBrowser.Model.Entities
         public string[] CollectionFolders { get; set; }
 
         public bool IsEmpty => FoldersAddedTo.Length == 0 && FoldersRemovedFrom.Length == 0 && ItemsAdded.Length == 0 && ItemsRemoved.Length == 0 && ItemsUpdated.Length == 0 && CollectionFolders.Length == 0;
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class.
-        /// </summary>
-        public LibraryUpdateInfo()
-        {
-            FoldersAddedTo = Array.Empty<string>();
-            FoldersRemovedFrom = Array.Empty<string>();
-            ItemsAdded = Array.Empty<string>();
-            ItemsRemoved = Array.Empty<string>();
-            ItemsUpdated = Array.Empty<string>();
-            CollectionFolders = Array.Empty<string>();
-        }
     }
 }

+ 1 - 0
MediaBrowser.Model/Entities/MediaAttachment.cs

@@ -1,3 +1,4 @@
+#nullable disable
 namespace MediaBrowser.Model.Entities
 {
     /// <summary>

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

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Entities/MediaUrl.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Entities

+ 7 - 6
MediaBrowser.Model/Entities/PackageReviewInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -7,32 +8,32 @@ namespace MediaBrowser.Model.Entities
     public class PackageReviewInfo
     {
         /// <summary>
-        /// The package id (database key) for this review
+        /// Gets or sets the package id (database key) for this review.
         /// </summary>
         public int id { get; set; }
 
         /// <summary>
-        /// The rating value
+        /// Gets or sets the rating value.
         /// </summary>
         public int rating { get; set; }
 
         /// <summary>
-        /// Whether or not this review recommends this item
+        /// Gets or sets whether or not this review recommends this item.
         /// </summary>
         public bool recommend { get; set; }
 
         /// <summary>
-        /// A short description of the review
+        /// Gets or sets a short description of the review.
         /// </summary>
         public string title { get; set; }
 
         /// <summary>
-        /// A full review
+        /// Gets or sets the full review.
         /// </summary>
         public string review { get; set; }
 
         /// <summary>
-        /// Time of review
+        /// Gets or sets the time of review.
         /// </summary>
         public DateTime timestamp { get; set; }
 

+ 12 - 12
MediaBrowser.Model/Entities/ParentalRating.cs

@@ -1,12 +1,23 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Entities
 {
     /// <summary>
-    /// Class ParentalRating
+    /// Class ParentalRating.
     /// </summary>
     public class ParentalRating
     {
+        public ParentalRating()
+        {
+        }
+
+        public ParentalRating(string name, int value)
+        {
+            Name = name;
+            Value = value;
+        }
+
         /// <summary>
         /// Gets or sets the name.
         /// </summary>
@@ -18,16 +29,5 @@ namespace MediaBrowser.Model.Entities
         /// </summary>
         /// <value>The value.</value>
         public int Value { get; set; }
-
-        public ParentalRating()
-        {
-
-        }
-
-        public ParentalRating(string name, int value)
-        {
-            Name = name;
-            Value = value;
-        }
     }
 }

+ 6 - 6
MediaBrowser.Model/Entities/ProviderIdsExtensions.cs

@@ -20,23 +20,23 @@ namespace MediaBrowser.Model.Entities
         }
 
         /// <summary>
-        /// Gets a provider id
+        /// Gets a provider id.
         /// </summary>
         /// <param name="instance">The instance.</param>
         /// <param name="provider">The provider.</param>
         /// <returns>System.String.</returns>
-        public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider)
+        public static string? GetProviderId(this IHasProviderIds instance, MetadataProviders provider)
         {
             return instance.GetProviderId(provider.ToString());
         }
 
         /// <summary>
-        /// Gets a provider id
+        /// Gets a provider id.
         /// </summary>
         /// <param name="instance">The instance.</param>
         /// <param name="name">The name.</param>
         /// <returns>System.String.</returns>
-        public static string GetProviderId(this IHasProviderIds instance, string name)
+        public static string? GetProviderId(this IHasProviderIds instance, string name)
         {
             if (instance == null)
             {
@@ -53,7 +53,7 @@ namespace MediaBrowser.Model.Entities
         }
 
         /// <summary>
-        /// Sets a provider id
+        /// Sets a provider id.
         /// </summary>
         /// <param name="instance">The instance.</param>
         /// <param name="name">The name.</param>
@@ -89,7 +89,7 @@ namespace MediaBrowser.Model.Entities
         }
 
         /// <summary>
-        /// Sets a provider id
+        /// Sets a provider id.
         /// </summary>
         /// <param name="instance">The instance.</param>
         /// <param name="provider">The provider.</param>

+ 1 - 0
MediaBrowser.Model/Entities/VirtualFolderInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 0 - 7
MediaBrowser.Model/Events/GenericEventArgs.cs

@@ -22,12 +22,5 @@ namespace MediaBrowser.Model.Events
         {
             Argument = arg;
         }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="GenericEventArgs{T}"/> class.
-        /// </summary>
-        public GenericEventArgs()
-        {
-        }
     }
 }

+ 2 - 0
MediaBrowser.Model/Extensions/ListHelper.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -21,6 +22,7 @@ namespace MediaBrowser.Model.Extensions
                     return true;
                 }
             }
+
             return false;
         }
     }

+ 2 - 2
MediaBrowser.Model/Extensions/StringHelper.cs

@@ -12,9 +12,9 @@ namespace MediaBrowser.Model.Extensions
         /// <returns>The string with the first character as uppercase.</returns>
         public static string FirstToUpper(string str)
         {
-            if (string.IsNullOrEmpty(str))
+            if (str.Length == 0)
             {
-                return string.Empty;
+                return str;
             }
 
             if (char.IsUpper(str[0]))

+ 1 - 0
MediaBrowser.Model/Globalization/CountryInfo.cs

@@ -1,3 +1,4 @@
+#nullable disable
 namespace MediaBrowser.Model.Globalization
 {
     /// <summary>

+ 1 - 0
MediaBrowser.Model/Globalization/CultureDto.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/Globalization/ILocalizationManager.cs

@@ -1,3 +1,4 @@
+#nullable disable
 using System.Collections.Generic;
 using System.Globalization;
 using MediaBrowser.Model.Entities;

+ 2 - 0
MediaBrowser.Model/Globalization/LocalizationOption.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Globalization
@@ -11,6 +12,7 @@ namespace MediaBrowser.Model.Globalization
         }
 
         public string Name { get; set; }
+
         public string Value { get; set; }
     }
 }

+ 20 - 7
MediaBrowser.Model/IO/FileSystemEntryInfo.cs

@@ -1,26 +1,39 @@
 namespace MediaBrowser.Model.IO
 {
     /// <summary>
-    /// Class FileSystemEntryInfo
+    /// Class FileSystemEntryInfo.
     /// </summary>
     public class FileSystemEntryInfo
     {
         /// <summary>
-        /// Gets or sets the name.
+        /// Initializes a new instance of the <see cref="FileSystemEntryInfo" /> class.
+        /// </summary>
+        /// <param name="name">The filename.</param>
+        /// <param name="path">The file path.</param>
+        /// <param name="type">The file type.</param>
+        public FileSystemEntryInfo(string name, string path, FileSystemEntryType type)
+        {
+            Name = name;
+            Path = path;
+            Type = type;
+        }
+
+        /// <summary>
+        /// Gets the name.
         /// </summary>
         /// <value>The name.</value>
-        public string Name { get; set; }
+        public string Name { get; }
 
         /// <summary>
-        /// Gets or sets the path.
+        /// Gets the path.
         /// </summary>
         /// <value>The path.</value>
-        public string Path { get; set; }
+        public string Path { get; }
 
         /// <summary>
-        /// Gets or sets the type.
+        /// Gets the type.
         /// </summary>
         /// <value>The type.</value>
-        public FileSystemEntryType Type { get; set; }
+        public FileSystemEntryType Type { get; }
     }
 }

+ 1 - 0
MediaBrowser.Model/IO/FileSystemMetadata.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

+ 1 - 0
MediaBrowser.Model/IO/IFileSystem.cs

@@ -1,3 +1,4 @@
+#nullable disable
 #pragma warning disable CS1591
 
 using System;

Some files were not shown because too many files changed in this diff