2
0
Эх сурвалжийг харах

Merge branch 'master' into feature/ffmpeg-version-check

Max Git 5 жил өмнө
parent
commit
5df00cb2b8
100 өөрчлөгдсөн 496 нэмэгдсэн , 674 устгасан
  1. 1 1
      DvdLib/Ifo/Program.cs
  2. 2 6
      Emby.Dlna/ContentDirectory/ContentDirectory.cs
  3. 5 5
      Emby.Dlna/Main/DlnaEntryPoint.cs
  4. 10 10
      Emby.Dlna/PlayTo/Device.cs
  5. 12 7
      Emby.Dlna/PlayTo/PlayToController.cs
  6. 6 10
      Emby.Dlna/Ssdp/DeviceDiscovery.cs
  7. 4 10
      Emby.Dlna/Ssdp/Extensions.cs
  8. 2 2
      Emby.Drawing/ImageProcessor.cs
  9. 2 2
      Emby.Server.Implementations/Channels/ChannelManager.cs
  10. 1 1
      Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
  11. 2 2
      Emby.Server.Implementations/Cryptography/CryptographyProvider.cs
  12. 4 1
      Emby.Server.Implementations/Data/SqliteItemRepository.cs
  13. 1 7
      Emby.Server.Implementations/Devices/DeviceManager.cs
  14. 1 0
      Emby.Server.Implementations/Emby.Server.Implementations.csproj
  15. 2 2
      Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
  16. 9 9
      Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
  17. 24 24
      Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
  18. 2 1
      Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
  19. 9 4
      Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
  20. 2 0
      Emby.Server.Implementations/IStartupOptions.cs
  21. 0 38
      Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
  22. 7 1
      Emby.Server.Implementations/Library/LibraryManager.cs
  23. 1 5
      Emby.Server.Implementations/Library/MediaSourceManager.cs
  24. 5 5
      Emby.Server.Implementations/Library/UserManager.cs
  25. 4 9
      Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
  26. 2 2
      Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
  27. 2 2
      Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
  28. 20 59
      Emby.Server.Implementations/LiveTv/LiveTvManager.cs
  29. 2 0
      Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs
  30. 2 0
      Emby.Server.Implementations/MediaEncoder/EncodingManager.cs
  31. 2 0
      Emby.Server.Implementations/Net/SocketFactory.cs
  32. 2 0
      Emby.Server.Implementations/Net/UdpSocket.cs
  33. 2 0
      Emby.Server.Implementations/Networking/NetworkManager.cs
  34. 2 0
      Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs
  35. 3 3
      Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs
  36. 3 4
      Emby.Server.Implementations/Playlists/PlaylistManager.cs
  37. 2 0
      Emby.Server.Implementations/ResourceFileManager.cs
  38. 12 10
      Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
  39. 5 10
      Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
  40. 7 0
      Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
  41. 7 0
      Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
  42. 9 0
      Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
  43. 7 0
      Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteTranscodeFileTask.cs
  44. 4 6
      Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
  45. 2 0
      Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
  46. 12 5
      Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs
  47. 3 4
      Emby.Server.Implementations/ScheduledTasks/Triggers/DailyTrigger.cs
  48. 2 0
      Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs
  49. 5 1
      Emby.Server.Implementations/ScheduledTasks/Triggers/StartupTrigger.cs
  50. 2 0
      Emby.Server.Implementations/ScheduledTasks/Triggers/WeeklyTrigger.cs
  51. 2 0
      Emby.Server.Implementations/Security/AuthenticationRepository.cs
  52. 5 0
      Emby.Server.Implementations/Serialization/JsonSerializer.cs
  53. 2 0
      Emby.Server.Implementations/Services/HttpResult.cs
  54. 3 4
      Emby.Server.Implementations/Services/RequestHelper.cs
  55. 3 2
      Emby.Server.Implementations/Services/ResponseHelper.cs
  56. 2 0
      Emby.Server.Implementations/Services/ServiceController.cs
  57. 2 0
      Emby.Server.Implementations/Services/ServiceExec.cs
  58. 2 0
      Emby.Server.Implementations/Services/ServiceHandler.cs
  59. 2 0
      Emby.Server.Implementations/Services/ServiceMethod.cs
  60. 2 0
      Emby.Server.Implementations/Services/ServicePath.cs
  61. 2 0
      Emby.Server.Implementations/Services/StringMapTypeDeserializer.cs
  62. 2 0
      Emby.Server.Implementations/Services/SwaggerService.cs
  63. 2 0
      Emby.Server.Implementations/Services/UrlExtensions.cs
  64. 2 0
      Emby.Server.Implementations/Session/SessionManager.cs
  65. 0 18
      Emby.Server.Implementations/SocketSharp/HttpFile.cs
  66. 0 198
      Emby.Server.Implementations/SocketSharp/HttpPostedFile.cs
  67. 3 1
      Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs
  68. 2 0
      Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs
  69. 12 6
      Emby.Server.Implementations/Sorting/CommunityRatingComparer.cs
  70. 9 9
      Emby.Server.Implementations/Sorting/DateLastMediaAddedComparer.cs
  71. 20 18
      Emby.Server.Implementations/Sorting/IsFavoriteOrLikeComparer.cs
  72. 8 6
      Emby.Server.Implementations/Sorting/IsFolderComparer.cs
  73. 20 18
      Emby.Server.Implementations/Sorting/IsPlayedComparer.cs
  74. 20 18
      Emby.Server.Implementations/Sorting/IsUnplayedComparer.cs
  75. 8 6
      Emby.Server.Implementations/Sorting/OfficialRatingComparer.cs
  76. 8 6
      Emby.Server.Implementations/Sorting/SeriesSortNameComparer.cs
  77. 10 9
      Emby.Server.Implementations/Sorting/StartDateComparer.cs
  78. 2 0
      Emby.Server.Implementations/Sorting/StudioComparer.cs
  79. 5 0
      Emby.Server.Implementations/SyncPlay/SyncPlayController.cs
  80. 7 0
      Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs
  81. 3 4
      Emby.Server.Implementations/TV/TVSeriesManager.cs
  82. 3 3
      Emby.Server.Implementations/Updates/InstallationManager.cs
  83. 2 0
      Emby.Server.Implementations/UserViews/CollectionFolderImageProvider.cs
  84. 3 3
      Emby.Server.Implementations/UserViews/DynamicImageProvider.cs
  85. 4 2
      Emby.Server.Implementations/UserViews/FolderImageProvider.cs
  86. 0 1
      Jellyfin.Server/Migrations/IMigrationRoutine.cs
  87. 0 1
      Jellyfin.Server/Migrations/Routines/CreateUserLoggingConfigFile.cs
  88. 2 2
      Jellyfin.Server/Program.cs
  89. 2 2
      MediaBrowser.Api/ApiEntryPoint.cs
  90. 2 13
      MediaBrowser.Api/EnvironmentService.cs
  91. 1 2
      MediaBrowser.Api/Images/ImageService.cs
  92. 1 2
      MediaBrowser.Api/Images/RemoteImageService.cs
  93. 5 5
      MediaBrowser.Api/Playback/BaseStreamingService.cs
  94. 7 7
      MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
  95. 1 1
      MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
  96. 1 1
      MediaBrowser.Api/Playback/StreamState.cs
  97. 14 14
      MediaBrowser.Api/Sessions/SessionInfoWebSocketListener.cs
  98. 11 2
      MediaBrowser.Controller/LiveTv/TimerEventInfo.cs
  99. 13 7
      MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
  100. 15 15
      MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs

+ 1 - 1
DvdLib/Ifo/Program.cs

@@ -6,7 +6,7 @@ namespace DvdLib.Ifo
 {
     public class Program
     {
-        public readonly List<Cell> Cells;
+        public IReadOnlyList<Cell> Cells { get; }
 
         public Program(List<Cell> cells)
         {

+ 2 - 6
Emby.Dlna/ContentDirectory/ContentDirectory.cs

@@ -1,6 +1,7 @@
 #pragma warning disable CS1591
 
 using System;
+using System.Linq;
 using System.Threading.Tasks;
 using Emby.Dlna.Service;
 using MediaBrowser.Common.Net;
@@ -136,12 +137,7 @@ namespace Emby.Dlna.ContentDirectory
                 }
             }
 
-            foreach (var user in _userManager.Users)
-            {
-                return user;
-            }
-
-            return null;
+            return _userManager.Users.FirstOrDefault();
         }
     }
 }

+ 5 - 5
Emby.Dlna/Main/DlnaEntryPoint.cs

@@ -133,20 +133,20 @@ namespace Emby.Dlna.Main
         {
             await ((DlnaManager)_dlnaManager).InitProfilesAsync().ConfigureAwait(false);
 
-            ReloadComponents();
+            await ReloadComponents().ConfigureAwait(false);
 
-            _config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated;
+            _config.NamedConfigurationUpdated += OnNamedConfigurationUpdated;
         }
 
-        void _config_NamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
+        private async void OnNamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
         {
             if (string.Equals(e.Key, "dlna", StringComparison.OrdinalIgnoreCase))
             {
-                ReloadComponents();
+                await ReloadComponents().ConfigureAwait(false);
             }
         }
 
-        private async void ReloadComponents()
+        private async Task ReloadComponents()
         {
             var options = _config.GetDlnaConfiguration();
 

+ 10 - 10
Emby.Dlna/PlayTo/Device.cs

@@ -34,7 +34,7 @@ namespace Emby.Dlna.PlayTo
         {
             get
             {
-                RefreshVolumeIfNeeded();
+                RefreshVolumeIfNeeded().GetAwaiter().GetResult();
                 return _volume;
             }
             set => _volume = value;
@@ -76,24 +76,24 @@ namespace Emby.Dlna.PlayTo
 
         private DateTime _lastVolumeRefresh;
         private bool _volumeRefreshActive;
-        private void RefreshVolumeIfNeeded()
+        private Task RefreshVolumeIfNeeded()
         {
-            if (!_volumeRefreshActive)
-            {
-                return;
-            }
-
-            if (DateTime.UtcNow >= _lastVolumeRefresh.AddSeconds(5))
+            if (_volumeRefreshActive
+                && DateTime.UtcNow >= _lastVolumeRefresh.AddSeconds(5))
             {
                 _lastVolumeRefresh = DateTime.UtcNow;
-                RefreshVolume(CancellationToken.None);
+                return RefreshVolume();
             }
+
+            return Task.CompletedTask;
         }
 
-        private async void RefreshVolume(CancellationToken cancellationToken)
+        private async Task RefreshVolume(CancellationToken cancellationToken = default)
         {
             if (_disposed)
+            {
                 return;
+            }
 
             try
             {

+ 12 - 7
Emby.Dlna/PlayTo/PlayToController.cs

@@ -146,11 +146,14 @@ namespace Emby.Dlna.PlayTo
                 {
                     var positionTicks = GetProgressPositionTicks(streamInfo);
 
-                    ReportPlaybackStopped(streamInfo, positionTicks);
+                    await ReportPlaybackStopped(streamInfo, positionTicks).ConfigureAwait(false);
                 }
 
                 streamInfo = StreamParams.ParseFromUrl(e.NewMediaInfo.Url, _libraryManager, _mediaSourceManager);
-                if (streamInfo.Item == null) return;
+                if (streamInfo.Item == null)
+                {
+                    return;
+                }
 
                 var newItemProgress = GetProgressInfo(streamInfo);
 
@@ -173,11 +176,14 @@ namespace Emby.Dlna.PlayTo
             {
                 var streamInfo = StreamParams.ParseFromUrl(e.MediaInfo.Url, _libraryManager, _mediaSourceManager);
 
-                if (streamInfo.Item == null) return;
+                if (streamInfo.Item == null)
+                {
+                    return;
+                }
 
                 var positionTicks = GetProgressPositionTicks(streamInfo);
 
-                ReportPlaybackStopped(streamInfo, positionTicks);
+                await ReportPlaybackStopped(streamInfo, positionTicks).ConfigureAwait(false);
 
                 var mediaSource = await streamInfo.GetMediaSource(CancellationToken.None).ConfigureAwait(false);
 
@@ -185,7 +191,7 @@ namespace Emby.Dlna.PlayTo
                     (_device.Duration == null ? (long?)null : _device.Duration.Value.Ticks) :
                     mediaSource.RunTimeTicks;
 
-                var playedToCompletion = (positionTicks.HasValue && positionTicks.Value == 0);
+                var playedToCompletion = positionTicks.HasValue && positionTicks.Value == 0;
 
                 if (!playedToCompletion && duration.HasValue && positionTicks.HasValue)
                 {
@@ -210,7 +216,7 @@ namespace Emby.Dlna.PlayTo
             }
         }
 
-        private async void ReportPlaybackStopped(StreamParams streamInfo, long? positionTicks)
+        private async Task ReportPlaybackStopped(StreamParams streamInfo, long? positionTicks)
         {
             try
             {
@@ -220,7 +226,6 @@ namespace Emby.Dlna.PlayTo
                     SessionId = _session.Id,
                     PositionTicks = positionTicks,
                     MediaSourceId = streamInfo.MediaSourceId
-
                 }).ConfigureAwait(false);
             }
             catch (Exception ex)

+ 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);
         }

+ 4 - 10
Emby.Dlna/Ssdp/Extensions.cs

@@ -1,5 +1,6 @@
 #pragma warning disable CS1591
 
+using System.Linq;
 using System.Xml.Linq;
 
 namespace Emby.Dlna.Ssdp
@@ -10,24 +11,17 @@ namespace Emby.Dlna.Ssdp
         {
             var node = container.Element(name);
 
-            return node == null ? null : node.Value;
+            return node?.Value;
         }
 
         public static string GetAttributeValue(this XElement container, XName name)
         {
             var node = container.Attribute(name);
 
-            return node == null ? null : node.Value;
+            return node?.Value;
         }
 
         public static string GetDescendantValue(this XElement container, XName name)
-        {
-            foreach (var node in container.Descendants(name))
-            {
-                return node.Value;
-            }
-
-            return null;
-        }
+            => container.Descendants(name).FirstOrDefault()?.Value;
     }
 }

+ 2 - 2
Emby.Drawing/ImageProcessor.cs

@@ -114,7 +114,7 @@ namespace Emby.Drawing
             => _transparentImageTypes.Contains(Path.GetExtension(path));
 
         /// <inheritdoc />
-        public async Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options)
+        public async Task<(string path, string? mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options)
         {
             ItemImageInfo originalImage = options.Image;
             BaseItem item = options.Item;
@@ -230,7 +230,7 @@ namespace Emby.Drawing
             return ImageFormat.Jpg;
         }
 
-        private string GetMimeType(ImageFormat format, string path)
+        private string? GetMimeType(ImageFormat format, string path)
             => format switch
             {
                 ImageFormat.Bmp => MimeTypes.GetMimeType("i.bmp"),

+ 2 - 2
Emby.Server.Implementations/Channels/ChannelManager.cs

@@ -46,14 +46,14 @@ namespace Emby.Server.Implementations.Channels
             new ConcurrentDictionary<string, Tuple<DateTime, List<MediaSourceInfo>>>();
 
         private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(1, 1);
-        
+
         /// <summary>
         /// Initializes a new instance of the <see cref="ChannelManager"/> class.
         /// </summary>
         /// <param name="userManager">The user manager.</param>
         /// <param name="dtoService">The dto service.</param>
         /// <param name="libraryManager">The library manager.</param>
-        /// <param name="loggerFactory">The logger factory.</param>
+        /// <param name="logger">The logger.</param>
         /// <param name="config">The server configuration manager.</param>
         /// <param name="fileSystem">The filesystem.</param>
         /// <param name="userDataManager">The user data manager.</param>

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

@@ -90,7 +90,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;
@@ -129,8 +131,6 @@ namespace Emby.Server.Implementations.Cryptography
                 _randomNumberGenerator.Dispose();
             }
 
-            _randomNumberGenerator = null;
-
             _disposed = true;
         }
     }

+ 4 - 1
Emby.Server.Implementations/Data/SqliteItemRepository.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Globalization;
@@ -33,7 +35,7 @@ using SQLitePCL.pretty;
 namespace Emby.Server.Implementations.Data
 {
     /// <summary>
-    /// Class SQLiteItemRepository
+    /// Class SQLiteItemRepository.
     /// </summary>
     public class SqliteItemRepository : BaseSqliteRepository, IItemRepository
     {
@@ -1976,6 +1978,7 @@ namespace Emby.Server.Implementations.Data
         /// Gets the chapter.
         /// </summary>
         /// <param name="reader">The reader.</param>
+        /// <param name="item">The item.</param>
         /// <returns>ChapterInfo.</returns>
         private ChapterInfo GetChapter(IReadOnlyList<IResultSetValue> reader, BaseItem item)
         {

+ 1 - 7
Emby.Server.Implementations/Devices/DeviceManager.cs

@@ -62,13 +62,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)

+ 1 - 0
Emby.Server.Implementations/Emby.Server.Implementations.csproj

@@ -54,6 +54,7 @@
     <TargetFramework>netstandard2.1</TargetFramework>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <GenerateDocumentationFile>true</GenerateDocumentationFile>
+    <TreatWarningsAsErrors Condition=" '$(Configuration)' == 'Release'" >true</TreatWarningsAsErrors>
   </PropertyGroup>
 
   <!-- Code Analyzers-->

+ 2 - 2
Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs

@@ -302,7 +302,7 @@ namespace Emby.Server.Implementations.EntryPoints
                                     .Select(x => x.First())
                                     .ToList();
 
-                SendChangeNotifications(_itemsAdded.ToList(), itemsUpdated, _itemsRemoved.ToList(), foldersAddedTo, foldersRemovedFrom, CancellationToken.None);
+                SendChangeNotifications(_itemsAdded.ToList(), itemsUpdated, _itemsRemoved.ToList(), foldersAddedTo, foldersRemovedFrom, CancellationToken.None).GetAwaiter().GetResult();
 
                 if (LibraryUpdateTimer != null)
                 {
@@ -327,7 +327,7 @@ namespace Emby.Server.Implementations.EntryPoints
         /// <param name="foldersAddedTo">The folders added to.</param>
         /// <param name="foldersRemovedFrom">The folders removed from.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
-        private async void SendChangeNotifications(List<BaseItem> itemsAdded, List<BaseItem> itemsUpdated, List<BaseItem> itemsRemoved, List<Folder> foldersAddedTo, List<Folder> foldersRemovedFrom, CancellationToken cancellationToken)
+        private async Task SendChangeNotifications(List<BaseItem> itemsAdded, List<BaseItem> itemsUpdated, List<BaseItem> itemsRemoved, List<Folder> foldersAddedTo, List<Folder> foldersRemovedFrom, CancellationToken cancellationToken)
         {
             var userIds = _sessionManager.Sessions
                 .Select(i => i.UserId)

+ 9 - 9
Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs

@@ -42,27 +42,27 @@ namespace Emby.Server.Implementations.EntryPoints
             return Task.CompletedTask;
         }
 
-        private void OnLiveTvManagerSeriesTimerCreated(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
+        private async void OnLiveTvManagerSeriesTimerCreated(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
         {
-            SendMessage("SeriesTimerCreated", e.Argument);
+            await SendMessage("SeriesTimerCreated", e.Argument).ConfigureAwait(false);
         }
 
-        private void OnLiveTvManagerTimerCreated(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
+        private async void OnLiveTvManagerTimerCreated(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
         {
-            SendMessage("TimerCreated", e.Argument);
+            await SendMessage("TimerCreated", e.Argument).ConfigureAwait(false);
         }
 
-        private void OnLiveTvManagerSeriesTimerCancelled(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
+        private async void OnLiveTvManagerSeriesTimerCancelled(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
         {
-            SendMessage("SeriesTimerCancelled", e.Argument);
+            await SendMessage("SeriesTimerCancelled", e.Argument).ConfigureAwait(false);
         }
 
-        private void OnLiveTvManagerTimerCancelled(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
+        private async void OnLiveTvManagerTimerCancelled(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
         {
-            SendMessage("TimerCancelled", e.Argument);
+            await SendMessage("TimerCancelled", e.Argument).ConfigureAwait(false);
         }
 
-        private async void SendMessage(string name, TimerEventInfo info)
+        private async Task SendMessage(string name, TimerEventInfo info)
         {
             var users = _userManager.Users.Where(i => i.Policy.EnableLiveTvAccess).Select(i => i.Id).ToList();
 

+ 24 - 24
Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs

@@ -85,29 +85,29 @@ namespace Emby.Server.Implementations.EntryPoints
             return Task.CompletedTask;
         }
 
-        private void OnPackageInstalling(object sender, InstallationEventArgs e)
+        private async void OnPackageInstalling(object sender, InstallationEventArgs e)
         {
-            SendMessageToAdminSessions("PackageInstalling", e.InstallationInfo);
+            await SendMessageToAdminSessions("PackageInstalling", e.InstallationInfo).ConfigureAwait(false);
         }
 
-        private void OnPackageInstallationCancelled(object sender, InstallationEventArgs e)
+        private async void OnPackageInstallationCancelled(object sender, InstallationEventArgs e)
         {
-            SendMessageToAdminSessions("PackageInstallationCancelled", e.InstallationInfo);
+            await SendMessageToAdminSessions("PackageInstallationCancelled", e.InstallationInfo).ConfigureAwait(false);
         }
 
-        private void OnPackageInstallationCompleted(object sender, InstallationEventArgs e)
+        private async void OnPackageInstallationCompleted(object sender, InstallationEventArgs e)
         {
-            SendMessageToAdminSessions("PackageInstallationCompleted", e.InstallationInfo);
+            await SendMessageToAdminSessions("PackageInstallationCompleted", e.InstallationInfo).ConfigureAwait(false);
         }
 
-        private void OnPackageInstallationFailed(object sender, InstallationFailedEventArgs e)
+        private async void OnPackageInstallationFailed(object sender, InstallationFailedEventArgs e)
         {
-            SendMessageToAdminSessions("PackageInstallationFailed", e.InstallationInfo);
+            await SendMessageToAdminSessions("PackageInstallationFailed", e.InstallationInfo).ConfigureAwait(false);
         }
 
-        private void OnTaskCompleted(object sender, TaskCompletionEventArgs e)
+        private async void OnTaskCompleted(object sender, TaskCompletionEventArgs e)
         {
-            SendMessageToAdminSessions("ScheduledTaskEnded", e.Result);
+            await SendMessageToAdminSessions("ScheduledTaskEnded", e.Result).ConfigureAwait(false);
         }
 
         /// <summary>
@@ -115,9 +115,9 @@ namespace Emby.Server.Implementations.EntryPoints
         /// </summary>
         /// <param name="sender">The sender.</param>
         /// <param name="e">The e.</param>
-        private void OnPluginUninstalled(object sender, GenericEventArgs<IPlugin> e)
+        private async void OnPluginUninstalled(object sender, GenericEventArgs<IPlugin> e)
         {
-            SendMessageToAdminSessions("PluginUninstalled", e.Argument.GetPluginInfo());
+            await SendMessageToAdminSessions("PluginUninstalled", e.Argument.GetPluginInfo()).ConfigureAwait(false);
         }
 
         /// <summary>
@@ -125,9 +125,9 @@ namespace Emby.Server.Implementations.EntryPoints
         /// </summary>
         /// <param name="sender">The source of the event.</param>
         /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
-        private void OnHasPendingRestartChanged(object sender, EventArgs e)
+        private async void OnHasPendingRestartChanged(object sender, EventArgs e)
         {
-            _sessionManager.SendRestartRequiredNotification(CancellationToken.None);
+            await _sessionManager.SendRestartRequiredNotification(CancellationToken.None).ConfigureAwait(false);
         }
 
         /// <summary>
@@ -135,11 +135,11 @@ namespace Emby.Server.Implementations.EntryPoints
         /// </summary>
         /// <param name="sender">The sender.</param>
         /// <param name="e">The e.</param>
-        private void OnUserUpdated(object sender, GenericEventArgs<User> e)
+        private async void OnUserUpdated(object sender, GenericEventArgs<User> e)
         {
             var dto = _userManager.GetUserDto(e.Argument);
 
-            SendMessageToUserSession(e.Argument, "UserUpdated", dto);
+            await SendMessageToUserSession(e.Argument, "UserUpdated", dto).ConfigureAwait(false);
         }
 
         /// <summary>
@@ -147,26 +147,26 @@ namespace Emby.Server.Implementations.EntryPoints
         /// </summary>
         /// <param name="sender">The sender.</param>
         /// <param name="e">The e.</param>
-        private void OnUserDeleted(object sender, GenericEventArgs<User> e)
+        private async void OnUserDeleted(object sender, GenericEventArgs<User> e)
         {
-            SendMessageToUserSession(e.Argument, "UserDeleted", e.Argument.Id.ToString("N", CultureInfo.InvariantCulture));
+            await SendMessageToUserSession(e.Argument, "UserDeleted", e.Argument.Id.ToString("N", CultureInfo.InvariantCulture)).ConfigureAwait(false);
         }
 
-        private void OnUserPolicyUpdated(object sender, GenericEventArgs<User> e)
+        private async void OnUserPolicyUpdated(object sender, GenericEventArgs<User> e)
         {
             var dto = _userManager.GetUserDto(e.Argument);
 
-            SendMessageToUserSession(e.Argument, "UserPolicyUpdated", dto);
+            await SendMessageToUserSession(e.Argument, "UserPolicyUpdated", dto).ConfigureAwait(false);
         }
 
-        private void OnUserConfigurationUpdated(object sender, GenericEventArgs<User> e)
+        private async void OnUserConfigurationUpdated(object sender, GenericEventArgs<User> e)
         {
             var dto = _userManager.GetUserDto(e.Argument);
 
-            SendMessageToUserSession(e.Argument, "UserConfigurationUpdated", dto);
+            await SendMessageToUserSession(e.Argument, "UserConfigurationUpdated", dto).ConfigureAwait(false);
         }
 
-        private async void SendMessageToAdminSessions<T>(string name, T data)
+        private async Task SendMessageToAdminSessions<T>(string name, T data)
         {
             try
             {
@@ -178,7 +178,7 @@ namespace Emby.Server.Implementations.EntryPoints
             }
         }
 
-        private async void SendMessageToUserSession<T>(User user, string name, T data)
+        private async Task SendMessageToUserSession<T>(User user, string name, T data)
         {
             try
             {

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

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

+ 9 - 4
Emby.Server.Implementations/HttpServer/HttpResultFactory.cs

@@ -56,6 +56,7 @@ namespace Emby.Server.Implementations.HttpServer
         /// <summary>
         /// Gets the result.
         /// </summary>
+        /// <param name="requestContext">The request context.</param>
         /// <param name="content">The content.</param>
         /// <param name="contentType">Type of the content.</param>
         /// <param name="responseHeaders">The response headers.</param>
@@ -255,16 +256,20 @@ namespace Emby.Server.Implementations.HttpServer
         {
             var acceptEncoding = request.Headers[HeaderNames.AcceptEncoding].ToString();
 
-            if (string.IsNullOrEmpty(acceptEncoding))
+            if (!string.IsNullOrEmpty(acceptEncoding))
             {
-                //if (_brotliCompressor != null && acceptEncoding.IndexOf("br", StringComparison.OrdinalIgnoreCase) != -1)
+                // if (_brotliCompressor != null && acceptEncoding.IndexOf("br", StringComparison.OrdinalIgnoreCase) != -1)
                 //    return "br";
 
-                if (acceptEncoding.IndexOf("deflate", StringComparison.OrdinalIgnoreCase) != -1)
+                if (acceptEncoding.Contains("deflate", StringComparison.OrdinalIgnoreCase))
+                {
                     return "deflate";
+                }
 
-                if (acceptEncoding.IndexOf("gzip", StringComparison.OrdinalIgnoreCase) != -1)
+                if (acceptEncoding.Contains("gzip", StringComparison.OrdinalIgnoreCase))
+                {
                     return "gzip";
+                }
             }
 
             return null;

+ 2 - 0
Emby.Server.Implementations/IStartupOptions.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 
 namespace Emby.Server.Implementations

+ 0 - 38
Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs

@@ -135,43 +135,5 @@ namespace Emby.Server.Implementations.Library
                 ? null
                 : Hex.Encode(PasswordHash.Parse(user.EasyPassword).Hash);
         }
-
-        /// <summary>
-        /// Gets the hashed string.
-        /// </summary>
-        public string GetHashedString(User user, string str)
-        {
-            if (string.IsNullOrEmpty(user.Password))
-            {
-                return _cryptographyProvider.CreatePasswordHash(str).ToString();
-            }
-
-            // TODO: make use of iterations parameter?
-            PasswordHash passwordHash = PasswordHash.Parse(user.Password);
-            var salt = passwordHash.Salt.ToArray();
-            return new PasswordHash(
-                passwordHash.Id,
-                _cryptographyProvider.ComputeHash(
-                    passwordHash.Id,
-                    Encoding.UTF8.GetBytes(str),
-                    salt),
-                salt,
-                passwordHash.Parameters.ToDictionary(x => x.Key, y => y.Value)).ToString();
-        }
-
-        public ReadOnlySpan<byte> GetHashed(User user, string str)
-        {
-            if (string.IsNullOrEmpty(user.Password))
-            {
-                return _cryptographyProvider.CreatePasswordHash(str).Hash;
-            }
-
-            // TODO: make use of iterations parameter?
-            PasswordHash passwordHash = PasswordHash.Parse(user.Password);
-            return _cryptographyProvider.ComputeHash(
-                    passwordHash.Id,
-                    Encoding.UTF8.GetBytes(str),
-                    passwordHash.Salt.ToArray());
-        }
     }
 }

+ 7 - 1
Emby.Server.Implementations/Library/LibraryManager.cs

@@ -52,7 +52,7 @@ using VideoResolver = Emby.Naming.Video.VideoResolver;
 namespace Emby.Server.Implementations.Library
 {
     /// <summary>
-    /// Class LibraryManager
+    /// Class LibraryManager.
     /// </summary>
     public class LibraryManager : ILibraryManager
     {
@@ -138,6 +138,12 @@ namespace Emby.Server.Implementations.Library
         /// <param name="userManager">The user manager.</param>
         /// <param name="configurationManager">The configuration manager.</param>
         /// <param name="userDataRepository">The user data repository.</param>
+        /// <param name="libraryMonitorFactory">The library monitor.</param>
+        /// <param name="fileSystem">The file system.</param>
+        /// <param name="providerManagerFactory">The provider manager.</param>
+        /// <param name="userviewManagerFactory">The userview manager.</param>
+        /// <param name="mediaEncoder">The media encoder.</param>
+        /// <param name="itemRepository">The item repository.</param>
         public LibraryManager(
             IServerApplicationHost appHost,
             ILogger<LibraryManager> logger,

+ 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

@@ -126,7 +126,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>
@@ -135,7 +135,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()
@@ -751,7 +751,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;
         }
@@ -976,7 +976,7 @@ namespace Emby.Server.Implementations.Library
 
             if (fireEvent)
             {
-                UserPolicyUpdated?.Invoke(this, new GenericEventArgs<User> { Argument = user });
+                UserPolicyUpdated?.Invoke(this, new GenericEventArgs<User>(user));
             }
         }
 
@@ -1046,7 +1046,7 @@ namespace Emby.Server.Implementations.Library
 
             if (fireEvent)
             {
-                UserConfigurationUpdated?.Invoke(this, new GenericEventArgs<User> { Argument = user });
+                UserConfigurationUpdated?.Invoke(this, new GenericEventArgs<User>(user));
             }
         }
     }

+ 4 - 9
Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs

@@ -140,11 +140,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             }
         }
 
-        private void OnNamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
+        private async void OnNamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
         {
             if (string.Equals(e.Key, "livetv", StringComparison.OrdinalIgnoreCase))
             {
-                OnRecordingFoldersChanged();
+                await CreateRecordingFolders().ConfigureAwait(false);
             }
         }
 
@@ -155,11 +155,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             return CreateRecordingFolders();
         }
 
-        private async void OnRecordingFoldersChanged()
-        {
-            await CreateRecordingFolders().ConfigureAwait(false);
-        }
-
         internal async Task CreateRecordingFolders()
         {
             try
@@ -1334,7 +1329,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
                     await CreateRecordingFolders().ConfigureAwait(false);
 
                     TriggerRefresh(recordPath);
-                    EnforceKeepUpTo(timer, seriesPath);
+                    await EnforceKeepUpTo(timer, seriesPath).ConfigureAwait(false);
                 };
 
                 await recorder.Record(directStreamProvider, mediaStreamInfo, recordPath, duration, onStarted, activeRecordingInfo.CancellationTokenSource.Token).ConfigureAwait(false);
@@ -1494,7 +1489,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             return item;
         }
 
-        private async void EnforceKeepUpTo(TimerInfo timer, string seriesPath)
+        private async Task EnforceKeepUpTo(TimerInfo timer, string seriesPath)
         {
             if (string.IsNullOrWhiteSpace(timer.SeriesTimerId))
             {

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

@@ -117,7 +117,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             onStarted();
 
             // Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
-            StartStreamingLog(_process.StandardError.BaseStream, _logFileStream);
+            _ = StartStreamingLog(_process.StandardError.BaseStream, _logFileStream);
 
             _logger.LogInformation("ffmpeg recording process started for {0}", _targetPath);
 
@@ -321,7 +321,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             }
         }
 
-        private async void StartStreamingLog(Stream source, Stream target)
+        private async Task StartStreamingLog(Stream source, Stream target)
         {
             try
             {

+ 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));
             }
         }
 

+ 20 - 59
Emby.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -10,10 +10,8 @@ using Emby.Server.Implementations.Library;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Extensions;
 using MediaBrowser.Common.Progress;
-using MediaBrowser.Controller;
 using MediaBrowser.Controller.Channels;
 using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.Drawing;
 using MediaBrowser.Controller.Dto;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.Movies;
@@ -148,27 +146,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()
@@ -788,22 +777,12 @@ namespace Emby.Server.Implementations.LiveTv
 
             if (query.OrderBy.Count == 0)
             {
-                if (query.IsAiring ?? false)
-                {
-                    // Unless something else was specified, order by start date to take advantage of a specialized index
-                    query.OrderBy = new[]
-                    {
-                        (ItemSortBy.StartDate, SortOrder.Ascending)
-                    };
-                }
-                else
+
+                // Unless something else was specified, order by start date to take advantage of a specialized index
+                query.OrderBy = new[]
                 {
-                    // Unless something else was specified, order by start date to take advantage of a specialized index
-                    query.OrderBy = new[]
-                    {
-                        (ItemSortBy.StartDate, SortOrder.Ascending)
-                    };
-                }
+                    (ItemSortBy.StartDate, SortOrder.Ascending)
+                };
             }
 
             RemoveFields(options);
@@ -1734,13 +1713,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)));
             }
         }
 
@@ -1757,13 +1730,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)
@@ -2082,14 +2049,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)
+                    }));
             }
         }
 
@@ -2114,14 +2078,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)

+ 2 - 0
Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Threading.Tasks;

+ 2 - 0
Emby.Server.Implementations/MediaEncoder/EncodingManager.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Globalization;

+ 2 - 0
Emby.Server.Implementations/Net/SocketFactory.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Net;
 using System.Net.Sockets;

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

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Net;
 using System.Net.Sockets;

+ 2 - 0
Emby.Server.Implementations/Networking/NetworkManager.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Globalization;

+ 2 - 0
Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System.Collections.Generic;
 using System.Linq;
 using System.Text.Json.Serialization;

+ 3 - 3
Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System.Collections.Generic;
 using System.Linq;
 using Emby.Server.Implementations.Images;
@@ -32,9 +34,7 @@ namespace Emby.Server.Implementations.Playlists
                 {
                     var subItem = i.Item2;
 
-                    var episode = subItem as Episode;
-
-                    if (episode != null)
+                    if (subItem is Episode episode)
                     {
                         var series = episode.Series;
                         if (series != null && series.HasImage(ImageType.Primary))

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

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Globalization;
@@ -153,10 +155,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
             {

+ 2 - 0
Emby.Server.Implementations/ResourceFileManager.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.IO;
 using MediaBrowser.Controller;

+ 12 - 10
Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Globalization;
 using System.IO;
@@ -51,7 +53,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// </summary>
         /// <value>The task manager.</value>
         private ITaskManager TaskManager { get; set; }
-        private readonly IFileSystem _fileSystem;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ScheduledTaskWorker" /> class.
@@ -72,24 +73,28 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// or
         /// logger
         /// </exception>
-        public ScheduledTaskWorker(IScheduledTask scheduledTask, IApplicationPaths applicationPaths, ITaskManager taskManager, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem)
+        public ScheduledTaskWorker(IScheduledTask scheduledTask, IApplicationPaths applicationPaths, ITaskManager taskManager, IJsonSerializer jsonSerializer, ILogger logger)
         {
             if (scheduledTask == null)
             {
                 throw new ArgumentNullException(nameof(scheduledTask));
             }
+
             if (applicationPaths == null)
             {
                 throw new ArgumentNullException(nameof(applicationPaths));
             }
+
             if (taskManager == null)
             {
                 throw new ArgumentNullException(nameof(taskManager));
             }
+
             if (jsonSerializer == null)
             {
                 throw new ArgumentNullException(nameof(jsonSerializer));
             }
+
             if (logger == null)
             {
                 throw new ArgumentNullException(nameof(logger));
@@ -100,7 +105,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
             TaskManager = taskManager;
             JsonSerializer = jsonSerializer;
             Logger = logger;
-            _fileSystem = fileSystem;
 
             InitTriggerEvents();
         }
@@ -392,7 +396,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
 
             ((TaskManager)TaskManager).OnTaskExecuting(this);
 
-            progress.ProgressChanged += progress_ProgressChanged;
+            progress.ProgressChanged += OnProgressChanged;
 
             TaskCompletionStatus status;
             CurrentExecutionStartTime = DateTime.UtcNow;
@@ -426,7 +430,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 +443,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>
@@ -576,6 +577,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// <param name="startTime">The start time.</param>
         /// <param name="endTime">The end time.</param>
         /// <param name="status">The status.</param>
+        /// <param name="ex">The exception.</param>
         private void OnTaskCompleted(DateTime startTime, DateTime endTime, TaskCompletionStatus status, Exception ex)
         {
             var elapsedTime = endTime - startTime;

+ 5 - 10
Emby.Server.Implementations/ScheduledTasks/TaskManager.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
@@ -199,7 +201,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// <param name="tasks">The tasks.</param>
         public void AddTasks(IEnumerable<IScheduledTask> tasks)
         {
-            var list = tasks.Select(t => new ScheduledTaskWorker(t, _applicationPaths, this, _jsonSerializer, _logger, _fileSystem));
+            var list = tasks.Select(t => new ScheduledTaskWorker(t, _applicationPaths, this, _jsonSerializer, _logger));
 
             ScheduledTasks = ScheduledTasks.Concat(list).ToArray();
         }
@@ -240,10 +242,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>
@@ -253,11 +252,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();
         }

+ 7 - 0
Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs

@@ -169,18 +169,25 @@ namespace Emby.Server.Implementations.ScheduledTasks
             }
         }
 
+        /// <inheritdoc />
         public string Name => _localization.GetLocalizedString("TaskRefreshChapterImages");
 
+        /// <inheritdoc />
         public string Description => _localization.GetLocalizedString("TaskRefreshChapterImagesDescription");
 
+        /// <inheritdoc />
         public string Category => _localization.GetLocalizedString("TasksLibraryCategory");
 
+        /// <inheritdoc />
         public string Key => "RefreshChapterImages";
 
+        /// <inheritdoc />
         public bool IsHidden => false;
 
+        /// <inheritdoc />
         public bool IsEnabled => true;
 
+        /// <inheritdoc />
         public bool IsLogged => true;
     }
 }

+ 7 - 0
Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs

@@ -165,18 +165,25 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
             }
         }
 
+        /// <inheritdoc />
         public string Name => _localization.GetLocalizedString("TaskCleanCache");
 
+        /// <inheritdoc />
         public string Description => _localization.GetLocalizedString("TaskCleanCacheDescription");
 
+        /// <inheritdoc />
         public string Category => _localization.GetLocalizedString("TasksMaintenanceCategory");
 
+        /// <inheritdoc />
         public string Key => "DeleteCacheFiles";
 
+        /// <inheritdoc />
         public bool IsHidden => false;
 
+        /// <inheritdoc />
         public bool IsEnabled => true;
 
+        /// <inheritdoc />
         public bool IsLogged => true;
     }
 }

+ 9 - 0
Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs

@@ -28,6 +28,8 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
         /// Initializes a new instance of the <see cref="DeleteLogFileTask" /> class.
         /// </summary>
         /// <param name="configurationManager">The configuration manager.</param>
+        /// <param name="fileSystem">The file system.</param>
+        /// <param name="localization">The localization manager.</param>
         public DeleteLogFileTask(IConfigurationManager configurationManager, IFileSystem fileSystem, ILocalizationManager localization)
         {
             ConfigurationManager = configurationManager;
@@ -82,18 +84,25 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
             return Task.CompletedTask;
         }
 
+        /// <inheritdoc />
         public string Name => _localization.GetLocalizedString("TaskCleanLogs");
 
+        /// <inheritdoc />
         public string Description => string.Format(_localization.GetLocalizedString("TaskCleanLogsDescription"), ConfigurationManager.CommonConfiguration.LogFileRetentionDays);
 
+        /// <inheritdoc />
         public string Category => _localization.GetLocalizedString("TasksMaintenanceCategory");
 
+        /// <inheritdoc />
         public string Key => "CleanLogFiles";
 
+        /// <inheritdoc />
         public bool IsHidden => false;
 
+        /// <inheritdoc />
         public bool IsEnabled => true;
 
+        /// <inheritdoc />
         public bool IsLogged => true;
     }
 }

+ 7 - 0
Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteTranscodeFileTask.cs

@@ -132,18 +132,25 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
             }
         }
 
+        /// <inheritdoc />
         public string Name => _localization.GetLocalizedString("TaskCleanTranscode");
 
+        /// <inheritdoc />
         public string Description => _localization.GetLocalizedString("TaskCleanTranscodeDescription");
 
+        /// <inheritdoc />
         public string Category => _localization.GetLocalizedString("TasksMaintenanceCategory");
 
+        /// <inheritdoc />
         public string Key => "DeleteTranscodeFiles";
 
+        /// <inheritdoc />
         public bool IsHidden => false;
 
+        /// <inheritdoc />
         public bool IsEnabled => false;
 
+        /// <inheritdoc />
         public bool IsLogged => true;
     }
 }

+ 4 - 6
Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs

@@ -1,8 +1,9 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Threading;
 using System.Threading.Tasks;
-using MediaBrowser.Controller;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Model.Tasks;
 using MediaBrowser.Model.Globalization;
@@ -18,19 +19,16 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// The library manager.
         /// </summary>
         private readonly ILibraryManager _libraryManager;
-
-        private readonly IServerApplicationHost _appHost;
         private readonly ILocalizationManager _localization;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="PeopleValidationTask" /> class.
         /// </summary>
         /// <param name="libraryManager">The library manager.</param>
-        /// <param name="appHost">The server application host</param>
-        public PeopleValidationTask(ILibraryManager libraryManager, IServerApplicationHost appHost, ILocalizationManager localization)
+        /// <param name="localization">The localization manager.</param>
+        public PeopleValidationTask(ILibraryManager libraryManager, ILocalizationManager localization)
         {
             _libraryManager = libraryManager;
-            _appHost = appHost;
             _localization = localization;
         }
 

+ 2 - 0
Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.IO;

+ 12 - 5
Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs

@@ -1,9 +1,10 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Threading;
 using System.Threading.Tasks;
 using Emby.Server.Implementations.Library;
-using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Model.Tasks;
 using MediaBrowser.Model.Globalization;
@@ -16,20 +17,19 @@ namespace Emby.Server.Implementations.ScheduledTasks
     public class RefreshMediaLibraryTask : IScheduledTask
     {
         /// <summary>
-        /// The _library manager
+        /// The _library manager.
         /// </summary>
         private readonly ILibraryManager _libraryManager;
-        private readonly IServerConfigurationManager _config;
         private readonly ILocalizationManager _localization;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="RefreshMediaLibraryTask" /> class.
         /// </summary>
         /// <param name="libraryManager">The library manager.</param>
-        public RefreshMediaLibraryTask(ILibraryManager libraryManager, IServerConfigurationManager config, ILocalizationManager localization)
+        /// <param name="localization">The localization manager.</param>
+        public RefreshMediaLibraryTask(ILibraryManager libraryManager, ILocalizationManager localization)
         {
             _libraryManager = libraryManager;
-            _config = config;
             _localization = localization;
         }
 
@@ -61,18 +61,25 @@ namespace Emby.Server.Implementations.ScheduledTasks
             return ((LibraryManager)_libraryManager).ValidateMediaLibraryInternal(progress, cancellationToken);
         }
 
+        /// <inheritdoc />
         public string Name => _localization.GetLocalizedString("TaskRefreshLibrary");
 
+        /// <inheritdoc />
         public string Description => _localization.GetLocalizedString("TaskRefreshLibraryDescription");
 
+        /// <inheritdoc />
         public string Category => _localization.GetLocalizedString("TasksLibraryCategory");
 
+        /// <inheritdoc />
         public string Key => "RefreshLibrary";
 
+        /// <inheritdoc />
         public bool IsHidden => false;
 
+        /// <inheritdoc />
         public bool IsEnabled => true;
 
+        /// <inheritdoc />
         public bool IsLogged => true;
     }
 }

+ 3 - 4
Emby.Server.Implementations/ScheduledTasks/Triggers/DailyTrigger.cs

@@ -31,6 +31,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// Stars waiting for the trigger action
         /// </summary>
         /// <param name="lastResult">The last result.</param>
+        /// <param name="logger">The logger.</param>
+        /// <param name="taskName">The name of the task.</param>
         /// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
         public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)
         {
@@ -77,10 +79,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// </summary>
         private void OnTriggered()
         {
-            if (Triggered != null)
-            {
-                Triggered(this, EventArgs.Empty);
-            }
+            Triggered?.Invoke(this, EventArgs.Empty);
         }
     }
 }

+ 2 - 0
Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs

@@ -34,6 +34,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// Stars waiting for the trigger action
         /// </summary>
         /// <param name="lastResult">The last result.</param>
+        /// <param name="logger">The logger.</param>
+        /// <param name="taskName">The name of the task.</param>
         /// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
         public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)
         {

+ 5 - 1
Emby.Server.Implementations/ScheduledTasks/Triggers/StartupTrigger.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Threading.Tasks;
 using MediaBrowser.Model.Tasks;
@@ -6,7 +8,7 @@ using Microsoft.Extensions.Logging;
 namespace Emby.Server.Implementations.ScheduledTasks
 {
     /// <summary>
-    /// Class StartupTaskTrigger
+    /// Class StartupTaskTrigger.
     /// </summary>
     public class StartupTrigger : ITaskTrigger
     {
@@ -26,6 +28,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// Stars waiting for the trigger action
         /// </summary>
         /// <param name="lastResult">The last result.</param>
+        /// <param name="logger">The logger.</param>
+        /// <param name="taskName">The name of the task.</param>
         /// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
         public async void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)
         {

+ 2 - 0
Emby.Server.Implementations/ScheduledTasks/Triggers/WeeklyTrigger.cs

@@ -37,6 +37,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// Stars waiting for the trigger action
         /// </summary>
         /// <param name="lastResult">The last result.</param>
+        /// <param name="logger">The logger.</param>
+        /// <param name="taskName">The name of the task.</param>
         /// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
         public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)
         {

+ 2 - 0
Emby.Server.Implementations/Security/AuthenticationRepository.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Globalization;

+ 5 - 0
Emby.Server.Implementations/Serialization/JsonSerializer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Globalization;
 using System.IO;
@@ -11,6 +13,9 @@ namespace Emby.Server.Implementations.Serialization
     /// </summary>
     public class JsonSerializer : IJsonSerializer
     {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="JsonSerializer" /> class.
+        /// </summary>
         public JsonSerializer()
         {
             ServiceStack.Text.JsConfig.DateHandler = ServiceStack.Text.DateHandler.ISO8601;

+ 2 - 0
Emby.Server.Implementations/Services/HttpResult.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System.Collections.Generic;
 using System.IO;
 using System.Net;

+ 3 - 4
Emby.Server.Implementations/Services/RequestHelper.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.IO;
 using System.Threading.Tasks;
@@ -43,10 +45,7 @@ namespace Emby.Server.Implementations.Services
 
         private static string GetContentTypeWithoutEncoding(string contentType)
         {
-            return contentType == null
-                       ? null
-                       : contentType.Split(';')[0].ToLowerInvariant().Trim();
+            return contentType?.Split(';')[0].ToLowerInvariant().Trim();
         }
-
     }
 }

+ 3 - 2
Emby.Server.Implementations/Services/ResponseHelper.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Globalization;
 using System.IO;
@@ -43,8 +45,7 @@ namespace Emby.Server.Implementations.Services
                 response.StatusCode = httpResult.Status;
             }
 
-            var responseOptions = result as IHasHeaders;
-            if (responseOptions != null)
+            if (result is IHasHeaders responseOptions)
             {
                 foreach (var responseHeaders in responseOptions.Headers)
                 {

+ 2 - 0
Emby.Server.Implementations/Services/ServiceController.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Threading.Tasks;

+ 2 - 0
Emby.Server.Implementations/Services/ServiceExec.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Linq;

+ 2 - 0
Emby.Server.Implementations/Services/ServiceHandler.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Reflection;

+ 2 - 0
Emby.Server.Implementations/Services/ServiceMethod.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 
 namespace Emby.Server.Implementations.Services

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

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Globalization;

+ 2 - 0
Emby.Server.Implementations/Services/StringMapTypeDeserializer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Reflection;

+ 2 - 0
Emby.Server.Implementations/Services/SwaggerService.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Linq;

+ 2 - 0
Emby.Server.Implementations/Services/UrlExtensions.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using MediaBrowser.Common.Extensions;
 

+ 2 - 0
Emby.Server.Implementations/Session/SessionManager.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;

+ 0 - 18
Emby.Server.Implementations/SocketSharp/HttpFile.cs

@@ -1,18 +0,0 @@
-using System.IO;
-using MediaBrowser.Model.Services;
-
-namespace Emby.Server.Implementations.SocketSharp
-{
-    public class HttpFile : IHttpFile
-    {
-        public string Name { get; set; }
-
-        public string FileName { get; set; }
-
-        public long ContentLength { get; set; }
-
-        public string ContentType { get; set; }
-
-        public Stream InputStream { get; set; }
-    }
-}

+ 0 - 198
Emby.Server.Implementations/SocketSharp/HttpPostedFile.cs

@@ -1,198 +0,0 @@
-using System;
-using System.IO;
-
-public sealed class HttpPostedFile : IDisposable
-{
-    private string _name;
-    private string _contentType;
-    private Stream _stream;
-    private bool _disposed = false;
-
-    internal HttpPostedFile(string name, string content_type, Stream base_stream, long offset, long length)
-    {
-        _name = name;
-        _contentType = content_type;
-        _stream = new ReadSubStream(base_stream, offset, length);
-    }
-
-    public string ContentType => _contentType;
-
-    public int ContentLength => (int)_stream.Length;
-
-    public string FileName => _name;
-
-    public Stream InputStream => _stream;
-
-    /// <summary>
-    /// Releases the unmanaged resources and disposes of the managed resources used.
-    /// </summary>
-    public void Dispose()
-    {
-        if (_disposed)
-        {
-            return;
-        }
-
-        _stream.Dispose();
-        _stream = null;
-
-        _name = null;
-        _contentType = null;
-
-        _disposed = true;
-    }
-
-    private class ReadSubStream : Stream
-    {
-        private Stream _stream;
-        private long _offset;
-        private long _end;
-        private long _position;
-
-        public ReadSubStream(Stream s, long offset, long length)
-        {
-            _stream = s;
-            _offset = offset;
-            _end = offset + length;
-            _position = offset;
-        }
-
-        public override bool CanRead => true;
-
-        public override bool CanSeek => true;
-
-        public override bool CanWrite => false;
-
-        public override long Length => _end - _offset;
-
-        public override long Position
-        {
-            get => _position - _offset;
-            set
-            {
-                if (value > Length)
-                {
-                    throw new ArgumentOutOfRangeException(nameof(value));
-                }
-
-                _position = Seek(value, SeekOrigin.Begin);
-            }
-        }
-
-        public override void Flush()
-        {
-        }
-
-        public override int Read(byte[] buffer, int dest_offset, int count)
-        {
-            if (buffer == null)
-            {
-                throw new ArgumentNullException(nameof(buffer));
-            }
-
-            if (dest_offset < 0)
-            {
-                throw new ArgumentOutOfRangeException(nameof(dest_offset), "< 0");
-            }
-
-            if (count < 0)
-            {
-                throw new ArgumentOutOfRangeException(nameof(count), "< 0");
-            }
-
-            int len = buffer.Length;
-            if (dest_offset > len)
-            {
-                throw new ArgumentException("destination offset is beyond array size", nameof(dest_offset));
-            }
-
-            // reordered to avoid possible integer overflow
-            if (dest_offset > len - count)
-            {
-                throw new ArgumentException("Reading would overrun buffer", nameof(count));
-            }
-
-            if (count > _end - _position)
-            {
-                count = (int)(_end - _position);
-            }
-
-            if (count <= 0)
-            {
-                return 0;
-            }
-
-            _stream.Position = _position;
-            int result = _stream.Read(buffer, dest_offset, count);
-            if (result > 0)
-            {
-                _position += result;
-            }
-            else
-            {
-                _position = _end;
-            }
-
-            return result;
-        }
-
-        public override int ReadByte()
-        {
-            if (_position >= _end)
-            {
-                return -1;
-            }
-
-            _stream.Position = _position;
-            int result = _stream.ReadByte();
-            if (result < 0)
-            {
-                _position = _end;
-            }
-            else
-            {
-                _position++;
-            }
-
-            return result;
-        }
-
-        public override long Seek(long d, SeekOrigin origin)
-        {
-            long real;
-            switch (origin)
-            {
-                case SeekOrigin.Begin:
-                    real = _offset + d;
-                    break;
-                case SeekOrigin.End:
-                    real = _end + d;
-                    break;
-                case SeekOrigin.Current:
-                    real = _position + d;
-                    break;
-                default:
-                    throw new ArgumentException("Unknown SeekOrigin value", nameof(origin));
-            }
-
-            long virt = real - _offset;
-            if (virt < 0 || virt > Length)
-            {
-                throw new ArgumentException("Invalid position", nameof(d));
-            }
-
-            _position = _stream.Seek(real, SeekOrigin.Begin);
-            return _position;
-        }
-
-        public override void SetLength(long value)
-        {
-            throw new NotSupportedException();
-        }
-
-        public override void Write(byte[] buffer, int offset, int count)
-        {
-            throw new NotSupportedException();
-        }
-    }
-}

+ 3 - 1
Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.IO;
@@ -209,7 +211,7 @@ namespace Emby.Server.Implementations.SocketSharp
         private static string GetQueryStringContentType(HttpRequest httpReq)
         {
             ReadOnlySpan<char> format = httpReq.Query["format"].ToString();
-            if (format == null)
+            if (format == ReadOnlySpan<char>.Empty)
             {
                 const int FormatMaxLength = 4;
                 ReadOnlySpan<char> pi = httpReq.Path.ToString();

+ 2 - 0
Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.TV;

+ 12 - 6
Emby.Server.Implementations/Sorting/CommunityRatingComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Sorting;
@@ -7,6 +9,12 @@ namespace Emby.Server.Implementations.Sorting
 {
     public class CommunityRatingComparer : IBaseItemComparer
     {
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name => ItemSortBy.CommunityRating;
+
         /// <summary>
         /// Compares the specified x.
         /// </summary>
@@ -16,18 +24,16 @@ namespace Emby.Server.Implementations.Sorting
         public int Compare(BaseItem x, BaseItem y)
         {
             if (x == null)
+            {
                 throw new ArgumentNullException(nameof(x));
+            }
 
             if (y == null)
+            {
                 throw new ArgumentNullException(nameof(y));
+            }
 
             return (x.CommunityRating ?? 0).CompareTo(y.CommunityRating ?? 0);
         }
-
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name => ItemSortBy.CommunityRating;
     }
 }

+ 9 - 9
Emby.Server.Implementations/Sorting/DateLastMediaAddedComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Library;
@@ -26,6 +28,12 @@ namespace Emby.Server.Implementations.Sorting
         /// <value>The user data repository.</value>
         public IUserDataManager UserDataRepository { get; set; }
 
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name => ItemSortBy.DateLastContentAdded;
+
         /// <summary>
         /// Compares the specified x.
         /// </summary>
@@ -44,9 +52,7 @@ namespace Emby.Server.Implementations.Sorting
         /// <returns>DateTime.</returns>
         private static DateTime GetDate(BaseItem x)
         {
-            var folder = x as Folder;
-
-            if (folder != null)
+            if (x is Folder folder)
             {
                 if (folder.DateLastMediaAdded.HasValue)
                 {
@@ -56,11 +62,5 @@ namespace Emby.Server.Implementations.Sorting
 
             return DateTime.MinValue;
         }
-
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name => ItemSortBy.DateLastContentAdded;
     }
 }

+ 20 - 18
Emby.Server.Implementations/Sorting/IsFavoriteOrLikeComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Sorting;
@@ -13,6 +15,24 @@ namespace Emby.Server.Implementations.Sorting
         /// <value>The user.</value>
         public User User { get; set; }
 
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name => ItemSortBy.IsFavoriteOrLiked;
+
+        /// <summary>
+        /// Gets or sets the user data repository.
+        /// </summary>
+        /// <value>The user data repository.</value>
+        public IUserDataManager UserDataRepository { get; set; }
+
+        /// <summary>
+        /// Gets or sets the user manager.
+        /// </summary>
+        /// <value>The user manager.</value>
+        public IUserManager UserManager { get; set; }
+
         /// <summary>
         /// Compares the specified x.
         /// </summary>
@@ -33,23 +53,5 @@ namespace Emby.Server.Implementations.Sorting
         {
             return x.IsFavoriteOrLiked(User) ? 0 : 1;
         }
-
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name => ItemSortBy.IsFavoriteOrLiked;
-
-        /// <summary>
-        /// Gets or sets the user data repository.
-        /// </summary>
-        /// <value>The user data repository.</value>
-        public IUserDataManager UserDataRepository { get; set; }
-
-        /// <summary>
-        /// Gets or sets the user manager.
-        /// </summary>
-        /// <value>The user manager.</value>
-        public IUserManager UserManager { get; set; }
     }
 }

+ 8 - 6
Emby.Server.Implementations/Sorting/IsFolderComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Sorting;
 using MediaBrowser.Model.Querying;
@@ -6,6 +8,12 @@ namespace Emby.Server.Implementations.Sorting
 {
     public class IsFolderComparer : IBaseItemComparer
     {
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name => ItemSortBy.IsFolder;
+
         /// <summary>
         /// Compares the specified x.
         /// </summary>
@@ -26,11 +34,5 @@ namespace Emby.Server.Implementations.Sorting
         {
             return x.IsFolder ? 0 : 1;
         }
-
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name => ItemSortBy.IsFolder;
     }
 }

+ 20 - 18
Emby.Server.Implementations/Sorting/IsPlayedComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Sorting;
@@ -13,6 +15,24 @@ namespace Emby.Server.Implementations.Sorting
         /// <value>The user.</value>
         public User User { get; set; }
 
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name => ItemSortBy.IsUnplayed;
+
+        /// <summary>
+        /// Gets or sets the user data repository.
+        /// </summary>
+        /// <value>The user data repository.</value>
+        public IUserDataManager UserDataRepository { get; set; }
+
+        /// <summary>
+        /// Gets or sets the user manager.
+        /// </summary>
+        /// <value>The user manager.</value>
+        public IUserManager UserManager { get; set; }
+
         /// <summary>
         /// Compares the specified x.
         /// </summary>
@@ -33,23 +53,5 @@ namespace Emby.Server.Implementations.Sorting
         {
             return x.IsPlayed(User) ? 0 : 1;
         }
-
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name => ItemSortBy.IsUnplayed;
-
-        /// <summary>
-        /// Gets or sets the user data repository.
-        /// </summary>
-        /// <value>The user data repository.</value>
-        public IUserDataManager UserDataRepository { get; set; }
-
-        /// <summary>
-        /// Gets or sets the user manager.
-        /// </summary>
-        /// <value>The user manager.</value>
-        public IUserManager UserManager { get; set; }
     }
 }

+ 20 - 18
Emby.Server.Implementations/Sorting/IsUnplayedComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Sorting;
@@ -13,6 +15,24 @@ namespace Emby.Server.Implementations.Sorting
         /// <value>The user.</value>
         public User User { get; set; }
 
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name => ItemSortBy.IsUnplayed;
+
+        /// <summary>
+        /// Gets or sets the user data repository.
+        /// </summary>
+        /// <value>The user data repository.</value>
+        public IUserDataManager UserDataRepository { get; set; }
+
+        /// <summary>
+        /// Gets or sets the user manager.
+        /// </summary>
+        /// <value>The user manager.</value>
+        public IUserManager UserManager { get; set; }
+
         /// <summary>
         /// Compares the specified x.
         /// </summary>
@@ -33,23 +53,5 @@ namespace Emby.Server.Implementations.Sorting
         {
             return x.IsUnplayed(User) ? 0 : 1;
         }
-
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name => ItemSortBy.IsUnplayed;
-
-        /// <summary>
-        /// Gets or sets the user data repository.
-        /// </summary>
-        /// <value>The user data repository.</value>
-        public IUserDataManager UserDataRepository { get; set; }
-
-        /// <summary>
-        /// Gets or sets the user manager.
-        /// </summary>
-        /// <value>The user manager.</value>
-        public IUserManager UserManager { get; set; }
     }
 }

+ 8 - 6
Emby.Server.Implementations/Sorting/OfficialRatingComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Sorting;
@@ -15,6 +17,12 @@ namespace Emby.Server.Implementations.Sorting
             _localization = localization;
         }
 
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name => ItemSortBy.OfficialRating;
+
         /// <summary>
         /// Compares the specified x.
         /// </summary>
@@ -38,11 +46,5 @@ namespace Emby.Server.Implementations.Sorting
 
             return levelX.CompareTo(levelY);
         }
-
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name => ItemSortBy.OfficialRating;
     }
 }

+ 8 - 6
Emby.Server.Implementations/Sorting/SeriesSortNameComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Sorting;
@@ -7,6 +9,12 @@ namespace Emby.Server.Implementations.Sorting
 {
     public class SeriesSortNameComparer : IBaseItemComparer
     {
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name => ItemSortBy.SeriesSortName;
+
         /// <summary>
         /// Compares the specified x.
         /// </summary>
@@ -18,12 +26,6 @@ namespace Emby.Server.Implementations.Sorting
             return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
         }
 
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name => ItemSortBy.SeriesSortName;
-
         private static string GetValue(BaseItem item)
         {
             var hasSeries = item as IHasSeries;

+ 10 - 9
Emby.Server.Implementations/Sorting/StartDateComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.LiveTv;
@@ -8,6 +10,12 @@ namespace Emby.Server.Implementations.Sorting
 {
     public class StartDateComparer : IBaseItemComparer
     {
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name => ItemSortBy.StartDate;
+
         /// <summary>
         /// Compares the specified x.
         /// </summary>
@@ -26,19 +34,12 @@ namespace Emby.Server.Implementations.Sorting
         /// <returns>DateTime.</returns>
         private static DateTime GetDate(BaseItem x)
         {
-            var hasStartDate = x as LiveTvProgram;
-
-            if (hasStartDate != null)
+            if (x is LiveTvProgram hasStartDate)
             {
                 return hasStartDate.StartDate;
             }
+
             return DateTime.MinValue;
         }
-
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name => ItemSortBy.StartDate;
     }
 }

+ 2 - 0
Emby.Server.Implementations/Sorting/StudioComparer.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Linq;
 using MediaBrowser.Controller.Entities;

+ 5 - 0
Emby.Server.Implementations/SyncPlay/SyncPlayController.cs

@@ -65,6 +65,11 @@ namespace Emby.Server.Implementations.SyncPlay
         /// <inheritdoc />
         public bool IsGroupEmpty() => _group.IsEmpty();
 
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SyncPlayController" /> class.
+        /// </summary>
+        /// <param name="sessionManager">The session manager.</param>
+        /// <param name="syncPlayManager">The SyncPlay manager.</param>
         public SyncPlayController(
             ISessionManager sessionManager,
             ISyncPlayManager syncPlayManager)

+ 7 - 0
Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs

@@ -57,6 +57,13 @@ namespace Emby.Server.Implementations.SyncPlay
 
         private bool _disposed = false;
 
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SyncPlayManager" /> class.
+        /// </summary>
+        /// <param name="logger">The logger.</param>
+        /// <param name="userManager">The user manager.</param>
+        /// <param name="sessionManager">The session manager.</param>
+        /// <param name="libraryManager">The library manager.</param>
         public SyncPlayManager(
             ILogger<SyncPlayManager> logger,
             IUserManager userManager,

+ 3 - 4
Emby.Server.Implementations/TV/TVSeriesManager.cs

@@ -1,8 +1,9 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.Globalization;
 using System.Linq;
-using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Dto;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.TV;
@@ -18,14 +19,12 @@ namespace Emby.Server.Implementations.TV
         private readonly IUserManager _userManager;
         private readonly IUserDataManager _userDataManager;
         private readonly ILibraryManager _libraryManager;
-        private readonly IServerConfigurationManager _config;
 
-        public TVSeriesManager(IUserManager userManager, IUserDataManager userDataManager, ILibraryManager libraryManager, IServerConfigurationManager config)
+        public TVSeriesManager(IUserManager userManager, IUserDataManager userDataManager, ILibraryManager libraryManager)
         {
             _userManager = userManager;
             _userDataManager = userDataManager;
             _libraryManager = libraryManager;
-            _config = config;
         }
 
         public QueryResult<BaseItem> GetNextUp(NextUpQuery request, DtoOptions dtoOptions)

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

@@ -1,11 +1,11 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-using System.Net;
 using System.Net.Http;
-using System.Runtime.CompilerServices;
 using System.Runtime.Serialization;
 using System.Security.Cryptography;
 using System.Threading;
@@ -456,7 +456,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 - 0
Emby.Server.Implementations/UserViews/CollectionFolderImageProvider.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.IO;

+ 3 - 3
Emby.Server.Implementations/UserViews/DynamicImageProvider.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System;
 using System.Collections.Generic;
 using System.IO;
@@ -19,13 +21,11 @@ namespace Emby.Server.Implementations.UserViews
     public class DynamicImageProvider : BaseDynamicImageProvider<UserView>
     {
         private readonly IUserManager _userManager;
-        private readonly ILibraryManager _libraryManager;
 
-        public DynamicImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, IUserManager userManager, ILibraryManager libraryManager)
+        public DynamicImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, IUserManager userManager)
             : base(fileSystem, providerManager, applicationPaths, imageProcessor)
         {
             _userManager = userManager;
-            _libraryManager = libraryManager;
         }
 
         protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)

+ 4 - 2
Emby.Server.Implementations/UserViews/FolderImageProvider.cs

@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
 using System.Collections.Generic;
 using Emby.Server.Implementations.Images;
 using MediaBrowser.Common.Configuration;
@@ -75,14 +77,14 @@ namespace Emby.Server.Implementations.UserViews
                 return false;
             }
 
-            var folder = item as Folder;
-            if (folder != null)
+            if (item is Folder folder)
             {
                 if (folder.IsTopParent)
                 {
                     return false;
                 }
             }
+
             return true;
             //return item.SourceType == SourceType.Library;
         }

+ 0 - 1
Jellyfin.Server/Migrations/IMigrationRoutine.cs

@@ -1,5 +1,4 @@
 using System;
-using Microsoft.Extensions.Logging;
 
 namespace Jellyfin.Server.Migrations
 {

+ 0 - 1
Jellyfin.Server/Migrations/Routines/CreateUserLoggingConfigFile.cs

@@ -3,7 +3,6 @@ using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using MediaBrowser.Common.Configuration;
-using Microsoft.Extensions.Logging;
 using Newtonsoft.Json.Linq;
 
 namespace Jellyfin.Server.Migrations.Routines

+ 2 - 2
Jellyfin.Server/Program.cs

@@ -40,12 +40,12 @@ namespace Jellyfin.Server
         /// <summary>
         /// The name of logging configuration file containing application defaults.
         /// </summary>
-        public static readonly string LoggingConfigFileDefault = "logging.default.json";
+        public const string LoggingConfigFileDefault = "logging.default.json";
 
         /// <summary>
         /// The name of the logging configuration file containing the system-specific override settings.
         /// </summary>
-        public static readonly string LoggingConfigFileSystem = "logging.json";
+        public const string LoggingConfigFileSystem = "logging.json";
 
         private static readonly CancellationTokenSource _tokenSource = new CancellationTokenSource();
         private static readonly ILoggerFactory _loggerFactory = new SerilogLoggerFactory();

+ 2 - 2
MediaBrowser.Api/ApiEntryPoint.cs

@@ -284,8 +284,8 @@ namespace MediaBrowser.Api
                     Width = state.OutputWidth,
                     Height = state.OutputHeight,
                     AudioChannels = state.OutputAudioChannels,
-                    IsAudioDirect = string.Equals(state.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase),
-                    IsVideoDirect = string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase),
+                    IsAudioDirect = EncodingHelper.IsCopyCodec(state.OutputAudioCodec),
+                    IsVideoDirect = EncodingHelper.IsCopyCodec(state.OutputVideoCodec),
                     TranscodeReasons = state.TranscodeReasons
                 });
             }

+ 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>
@@ -261,13 +256,7 @@ namespace MediaBrowser.Api
                 return request.IncludeDirectories || !isDirectory;
             });
 
-            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/ImageService.cs

@@ -564,8 +564,7 @@ namespace MediaBrowser.Api.Images
             var imageInfo = GetImageInfo(request, item);
             if (imageInfo == null)
             {
-                var displayText = item == null ? itemId.ToString() : item.Name;
-                throw new ResourceNotFoundException(string.Format("{0} does not have an image of type {1}", displayText, request.Type));
+                throw new ResourceNotFoundException(string.Format("{0} does not have an image of type {1}", item.Name, request.Type));
             }
 
             bool cropwhitespace;

+ 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

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

@@ -193,7 +193,7 @@ namespace MediaBrowser.Api.Playback
 
             await AcquireResources(state, cancellationTokenSource).ConfigureAwait(false);
 
-            if (state.VideoRequest != null && !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (state.VideoRequest != null && !EncodingHelper.IsCopyCodec(state.OutputVideoCodec))
             {
                 var auth = AuthorizationContext.GetAuthorizationInfo(Request);
                 if (auth.User != null && !auth.User.Policy.EnableVideoPlaybackTranscoding)
@@ -243,9 +243,9 @@ namespace MediaBrowser.Api.Playback
 
             var logFilePrefix = "ffmpeg-transcode";
             if (state.VideoRequest != null
-                && string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                && EncodingHelper.IsCopyCodec(state.OutputVideoCodec))
             {
-                logFilePrefix = string.Equals(state.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase)
+                logFilePrefix = EncodingHelper.IsCopyCodec(state.OutputAudioCodec)
                     ? "ffmpeg-remux" : "ffmpeg-directstream";
             }
 
@@ -328,7 +328,7 @@ namespace MediaBrowser.Api.Playback
                        state.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks &&
                        state.IsInputVideo &&
                        state.VideoType == VideoType.VideoFile &&
-                       !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase);
+                       !EncodingHelper.IsCopyCodec(state.OutputVideoCodec);
             }
 
             return false;
@@ -791,7 +791,7 @@ namespace MediaBrowser.Api.Playback
                     EncodingHelper.TryStreamCopy(state);
                 }
 
-                if (state.OutputVideoBitrate.HasValue && !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                if (state.OutputVideoBitrate.HasValue && !EncodingHelper.IsCopyCodec(state.OutputVideoCodec))
                 {
                     var resolution = ResolutionNormalizer.Normalize(
                         state.VideoStream?.BitRate,

+ 7 - 7
MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs

@@ -700,12 +700,12 @@ namespace MediaBrowser.Api.Playback.Hls
                 return false;
             }
 
-            if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec))
             {
                 return false;
             }
 
-            if (string.Equals(state.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (EncodingHelper.IsCopyCodec(state.OutputAudioCodec))
             {
                 return false;
             }
@@ -728,7 +728,7 @@ namespace MediaBrowser.Api.Playback.Hls
         private int? GetOutputVideoCodecLevel(StreamState state)
         {
             string levelString;
-            if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase)
+            if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec)
                 && state.VideoStream.Level.HasValue)
             {
                 levelString = state.VideoStream?.Level.ToString();
@@ -1008,7 +1008,7 @@ namespace MediaBrowser.Api.Playback.Hls
 
             if (!state.IsOutputVideo)
             {
-                if (string.Equals(audioCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                if (EncodingHelper.IsCopyCodec(audioCodec))
                 {
                     return "-acodec copy";
                 }
@@ -1036,11 +1036,11 @@ namespace MediaBrowser.Api.Playback.Hls
                 return string.Join(" ", audioTranscodeParams.ToArray());
             }
 
-            if (string.Equals(audioCodec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (EncodingHelper.IsCopyCodec(audioCodec))
             {
                 var videoCodec = EncodingHelper.GetVideoEncoder(state, encodingOptions);
 
-                if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase) && state.EnableBreakOnNonKeyFrames(videoCodec))
+                if (EncodingHelper.IsCopyCodec(videoCodec) && state.EnableBreakOnNonKeyFrames(videoCodec))
                 {
                     return "-codec:a:0 copy -copypriorss:a:0 0";
                 }
@@ -1091,7 +1091,7 @@ namespace MediaBrowser.Api.Playback.Hls
             // }
 
             // See if we can save come cpu cycles by avoiding encoding
-            if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (EncodingHelper.IsCopyCodec(codec))
             {
                 if (state.VideoStream != null && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
                 {

+ 1 - 1
MediaBrowser.Api/Playback/Hls/VideoHlsService.cs

@@ -72,7 +72,7 @@ namespace MediaBrowser.Api.Playback.Hls
         {
             var codec = EncodingHelper.GetAudioEncoder(state);
 
-            if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (EncodingHelper.IsCopyCodec(codec))
             {
                 return "-codec:a:0 copy";
             }

+ 1 - 1
MediaBrowser.Api/Playback/StreamState.cs

@@ -42,7 +42,7 @@ namespace MediaBrowser.Api.Playback
                     return Request.SegmentLength.Value;
                 }
 
-                if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                if (EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     var userAgent = UserAgent ?? string.Empty;
 

+ 14 - 14
MediaBrowser.Api/Sessions/SessionInfoWebSocketListener.cs

@@ -40,39 +40,39 @@ namespace MediaBrowser.Api.Sessions
             _sessionManager.SessionActivity += OnSessionManagerSessionActivity;
         }
 
-        private void OnSessionManagerSessionActivity(object sender, SessionEventArgs e)
+        private async void OnSessionManagerSessionActivity(object sender, SessionEventArgs e)
         {
-            SendData(false);
+            await SendData(false).ConfigureAwait(false);
         }
 
-        private void OnSessionManagerCapabilitiesChanged(object sender, SessionEventArgs e)
+        private async void OnSessionManagerCapabilitiesChanged(object sender, SessionEventArgs e)
         {
-            SendData(true);
+            await SendData(true).ConfigureAwait(false);
         }
 
-        private void OnSessionManagerPlaybackProgress(object sender, PlaybackProgressEventArgs e)
+        private async void OnSessionManagerPlaybackProgress(object sender, PlaybackProgressEventArgs e)
         {
-            SendData(!e.IsAutomated);
+            await SendData(!e.IsAutomated).ConfigureAwait(false);
         }
 
-        private void OnSessionManagerPlaybackStopped(object sender, PlaybackStopEventArgs e)
+        private async void OnSessionManagerPlaybackStopped(object sender, PlaybackStopEventArgs e)
         {
-            SendData(true);
+            await SendData(true).ConfigureAwait(false);
         }
 
-        private void OnSessionManagerPlaybackStart(object sender, PlaybackProgressEventArgs e)
+        private async void OnSessionManagerPlaybackStart(object sender, PlaybackProgressEventArgs e)
         {
-            SendData(true);
+            await SendData(true).ConfigureAwait(false);
         }
 
-        private void OnSessionManagerSessionEnded(object sender, SessionEventArgs e)
+        private async void OnSessionManagerSessionEnded(object sender, SessionEventArgs e)
         {
-            SendData(true);
+            await SendData(true).ConfigureAwait(false);
         }
 
-        private void OnSessionManagerSessionStarted(object sender, SessionEventArgs e)
+        private async void OnSessionManagerSessionStarted(object sender, SessionEventArgs e)
         {
-            SendData(true);
+            await SendData(true).ConfigureAwait(false);
         }
 
         /// <summary>

+ 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; }
     }
 }

+ 13 - 7
MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs

@@ -1338,7 +1338,7 @@ namespace MediaBrowser.Controller.MediaEncoding
                 transcoderChannelLimit = 6;
             }
 
-            var isTranscodingAudio = !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase);
+            var isTranscodingAudio = !EncodingHelper.IsCopyCodec(codec);
 
             int? resultChannels = state.GetRequestedAudioChannels(codec);
             if (isTranscodingAudio)
@@ -1734,7 +1734,8 @@ namespace MediaBrowser.Controller.MediaEncoding
 
             var hasTextSubs = state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
 
-            if (string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase) || (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) && !hasTextSubs)
+            if ((string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase)
+                || (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) && !hasTextSubs))
                 && width.HasValue
                 && height.HasValue)
             {
@@ -1991,7 +1992,7 @@ namespace MediaBrowser.Controller.MediaEncoding
                 filters.Add("hwupload");
             }
 
-            // When the input may or may not be hardware QSV decodable            
+            // When the input may or may not be hardware QSV decodable
             else if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
             {
                 if (!hasTextSubs)
@@ -2248,7 +2249,7 @@ namespace MediaBrowser.Controller.MediaEncoding
                 flags.Add("+ignidx");
             }
 
-            if (state.GenPtsInput || string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (state.GenPtsInput || EncodingHelper.IsCopyCodec(state.OutputVideoCodec))
             {
                 flags.Add("+genpts");
             }
@@ -2511,7 +2512,7 @@ namespace MediaBrowser.Controller.MediaEncoding
         /// </summary>
         protected string GetHardwareAcceleratedVideoDecoder(EncodingJobInfo state, EncodingOptions encodingOptions)
         {
-            if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec))
             {
                 return null;
             }
@@ -2799,7 +2800,7 @@ namespace MediaBrowser.Controller.MediaEncoding
                 args += " -mpegts_m2ts_mode 1";
             }
 
-            if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (EncodingHelper.IsCopyCodec(videoCodec))
             {
                 if (state.VideoStream != null
                     && string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase)
@@ -2901,7 +2902,7 @@ namespace MediaBrowser.Controller.MediaEncoding
 
             var args = "-codec:a:0 " + codec;
 
-            if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (EncodingHelper.IsCopyCodec(codec))
             {
                 return args;
             }
@@ -2973,5 +2974,10 @@ namespace MediaBrowser.Controller.MediaEncoding
                 string.Empty,
                 string.Empty).Trim();
         }
+
+        public static bool IsCopyCodec(string codec)
+        {
+            return string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase);
+        }
     }
 }

+ 15 - 15
MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs

@@ -302,7 +302,7 @@ namespace MediaBrowser.Controller.MediaEncoding
                     return false;
                 }
 
-                return BaseRequest.BreakOnNonKeyFrames && string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase);
+                return BaseRequest.BreakOnNonKeyFrames && EncodingHelper.IsCopyCodec(videoCodec);
             }
 
             return false;
@@ -367,7 +367,7 @@ namespace MediaBrowser.Controller.MediaEncoding
             get
             {
                 if (BaseRequest.Static
-                    || string.Equals(OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                    || EncodingHelper.IsCopyCodec(OutputAudioCodec))
                 {
                     if (AudioStream != null)
                     {
@@ -390,7 +390,7 @@ namespace MediaBrowser.Controller.MediaEncoding
             get
             {
                 if (BaseRequest.Static
-                    || string.Equals(OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                    || EncodingHelper.IsCopyCodec(OutputAudioCodec))
                 {
                     if (AudioStream != null)
                     {
@@ -409,7 +409,7 @@ namespace MediaBrowser.Controller.MediaEncoding
         {
             get
             {
-                if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                if (BaseRequest.Static || EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream?.Level;
                 }
@@ -433,7 +433,7 @@ namespace MediaBrowser.Controller.MediaEncoding
             get
             {
                 if (BaseRequest.Static
-                    || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                    || EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream?.BitDepth;
                 }
@@ -451,7 +451,7 @@ namespace MediaBrowser.Controller.MediaEncoding
             get
             {
                 if (BaseRequest.Static
-                    || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                    || EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream?.RefFrames;
                 }
@@ -468,7 +468,7 @@ namespace MediaBrowser.Controller.MediaEncoding
             get
             {
                 if (BaseRequest.Static
-                    || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                    || EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream == null ? null : (VideoStream.AverageFrameRate ?? VideoStream.RealFrameRate);
                 }
@@ -499,7 +499,7 @@ namespace MediaBrowser.Controller.MediaEncoding
         {
             get
             {
-                if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                if (BaseRequest.Static || EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream?.PacketLength;
                 }
@@ -515,7 +515,7 @@ namespace MediaBrowser.Controller.MediaEncoding
         {
             get
             {
-                if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                if (BaseRequest.Static || EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream?.Profile;
                 }
@@ -535,7 +535,7 @@ namespace MediaBrowser.Controller.MediaEncoding
             get
             {
                 if (BaseRequest.Static
-                    || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                    || EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream?.CodecTag;
                 }
@@ -549,7 +549,7 @@ namespace MediaBrowser.Controller.MediaEncoding
             get
             {
                 if (BaseRequest.Static
-                    || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                    || EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream?.IsAnamorphic;
                 }
@@ -562,7 +562,7 @@ namespace MediaBrowser.Controller.MediaEncoding
         {
             get
             {
-                if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                if (EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream?.Codec;
                 }
@@ -575,7 +575,7 @@ namespace MediaBrowser.Controller.MediaEncoding
         {
             get
             {
-                if (string.Equals(OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                if (EncodingHelper.IsCopyCodec(OutputAudioCodec))
                 {
                     return AudioStream?.Codec;
                 }
@@ -589,7 +589,7 @@ namespace MediaBrowser.Controller.MediaEncoding
             get
             {
                 if (BaseRequest.Static
-                    || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                    || EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream?.IsInterlaced;
                 }
@@ -607,7 +607,7 @@ namespace MediaBrowser.Controller.MediaEncoding
         {
             get
             {
-                if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+                if (BaseRequest.Static || EncodingHelper.IsCopyCodec(OutputVideoCodec))
                 {
                     return VideoStream?.IsAVC;
                 }

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно