The Free Software Media System - Server Backend & API
Enable nullable in more files
Bond_009501de7b6dcbe
diff --git a/Emby.Dlna/Configuration/DlnaOptions.cs b/Emby.Dlna/Configuration/DlnaOptions.csindex 5ceeb55300..91fac4bef5 100644--- a/Emby.Dlna/Configuration/DlnaOptions.cs+++ b/Emby.Dlna/Configuration/DlnaOptions.cs@@ -1,5 +1,3 @@-#nullable disable-#pragma warning disable CS1591namespace Emby.Dlna.Configuration@@ -74,7 +72,7 @@ namespace Emby.Dlna.Configuration/// <summary>/// Gets or sets the default user account that the dlna server uses./// </summary>- public string DefaultUserId { get; set; }+ public string? DefaultUserId { get; set; }/// <summary>/// Gets or sets a value indicating whether playTo device profiles should be created.diff --git a/Emby.Dlna/ContentDirectory/ContentDirectoryService.cs b/Emby.Dlna/ContentDirectory/ContentDirectoryService.csindex 7b8c504409..9020dea994 100644--- a/Emby.Dlna/ContentDirectory/ContentDirectoryService.cs+++ b/Emby.Dlna/ContentDirectory/ContentDirectoryService.cs@@ -1,5 +1,3 @@-#nullable disable-#pragma warning disable CS1591using System;@@ -140,7 +138,7 @@ namespace Emby.Dlna.ContentDirectory/// </summary>/// <param name="profile">The <see cref="DeviceProfile"/>.</param>/// <returns>The <see cref="User"/>.</returns>- private User GetUser(DeviceProfile profile)+ private User? GetUser(DeviceProfile profile){if (!string.IsNullOrEmpty(profile.UserId)){diff --git a/Emby.Dlna/ControlResponse.cs b/Emby.Dlna/ControlResponse.csindex a7f2d4a73b..8b09588424 100644--- a/Emby.Dlna/ControlResponse.cs+++ b/Emby.Dlna/ControlResponse.cs@@ -1,5 +1,3 @@-#nullable disable-#pragma warning disable CS1591using System.Collections.Generic;@@ -8,9 +6,11 @@ namespace Emby.Dlna{public class ControlResponse{- public ControlResponse()+ public ControlResponse(string xml, bool isSuccessful){Headers = new Dictionary<string, string>();+ Xml = xml;+ IsSuccessful = isSuccessful;}public IDictionary<string, string> Headers { get; }diff --git a/Emby.Dlna/EventSubscriptionResponse.cs b/Emby.Dlna/EventSubscriptionResponse.csindex 8c82dcbf68..635d2c47a1 100644--- a/Emby.Dlna/EventSubscriptionResponse.cs+++ b/Emby.Dlna/EventSubscriptionResponse.cs@@ -1,5 +1,3 @@-#nullable disable-#pragma warning disable CS1591using System.Collections.Generic;@@ -8,8 +6,10 @@ namespace Emby.Dlna{public class EventSubscriptionResponse{- public EventSubscriptionResponse()+ public EventSubscriptionResponse(string content, string contentType){+ Content = content;+ ContentType = contentType;Headers = new Dictionary<string, string>();}diff --git a/Emby.Dlna/Eventing/DlnaEventManager.cs b/Emby.Dlna/Eventing/DlnaEventManager.csindex 2e672b886b..3c91360904 100644--- a/Emby.Dlna/Eventing/DlnaEventManager.cs+++ b/Emby.Dlna/Eventing/DlnaEventManager.cs@@ -51,11 +51,7 @@ namespace Emby.Dlna.Eventingreturn GetEventSubscriptionResponse(subscriptionId, requestedTimeoutString, timeoutSeconds);}- return new EventSubscriptionResponse- {- Content = string.Empty,- ContentType = "text/plain"- };+ return new EventSubscriptionResponse(string.Empty, "text/plain");}public EventSubscriptionResponse CreateEventSubscription(string notificationType, string requestedTimeoutString, string callbackUrl)@@ -103,20 +99,12 @@ namespace Emby.Dlna.Eventing_subscriptions.TryRemove(subscriptionId, out _);- return new EventSubscriptionResponse- {- Content = string.Empty,- ContentType = "text/plain"- };+ return new EventSubscriptionResponse(string.Empty, "text/plain");}private EventSubscriptionResponse GetEventSubscriptionResponse(string subscriptionId, string requestedTimeoutString, int timeoutSeconds){- var response = new EventSubscriptionResponse- {- Content = string.Empty,- ContentType = "text/plain"- };+ var response = new EventSubscriptionResponse(string.Empty, "text/plain");response.Headers["SID"] = subscriptionId;response.Headers["TIMEOUT"] = string.IsNullOrEmpty(requestedTimeoutString) ? ("SECOND-" + timeoutSeconds.ToString(_usCulture)) : requestedTimeoutString;diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.csindex 6c580d15bd..11fcd81cff 100644--- a/Emby.Dlna/PlayTo/Device.cs+++ b/Emby.Dlna/PlayTo/Device.cs@@ -1260,10 +1260,7 @@ namespace Emby.Dlna.PlayToreturn;}- PlaybackStart?.Invoke(this, new PlaybackStartEventArgs- {- MediaInfo = mediaInfo- });+ PlaybackStart?.Invoke(this, new PlaybackStartEventArgs(mediaInfo));}private void OnPlaybackProgress(UBaseObject mediaInfo)@@ -1273,27 +1270,17 @@ namespace Emby.Dlna.PlayToreturn;}- PlaybackProgress?.Invoke(this, new PlaybackProgressEventArgs- {- MediaInfo = mediaInfo- });+ PlaybackProgress?.Invoke(this, new PlaybackProgressEventArgs(mediaInfo));}private void OnPlaybackStop(UBaseObject mediaInfo){- PlaybackStopped?.Invoke(this, new PlaybackStoppedEventArgs- {- MediaInfo = mediaInfo- });+ PlaybackStopped?.Invoke(this, new PlaybackStoppedEventArgs(mediaInfo));}private void OnMediaChanged(UBaseObject old, UBaseObject newMedia){- MediaChanged?.Invoke(this, new MediaChangedEventArgs- {- OldMediaInfo = old,- NewMediaInfo = newMedia- });+ MediaChanged?.Invoke(this, new MediaChangedEventArgs(old, newMedia));}/// <inheritdoc />diff --git a/Emby.Dlna/PlayTo/MediaChangedEventArgs.cs b/Emby.Dlna/PlayTo/MediaChangedEventArgs.csindex 2bc4d8cc24..0f7a524d62 100644--- a/Emby.Dlna/PlayTo/MediaChangedEventArgs.cs+++ b/Emby.Dlna/PlayTo/MediaChangedEventArgs.cs@@ -1,6 +1,4 @@-#nullable disable--#pragma warning disable CS1591+#pragma warning disable CS1591using System;@@ -8,6 +6,12 @@ namespace Emby.Dlna.PlayTo{public class MediaChangedEventArgs : EventArgs{+ public MediaChangedEventArgs(UBaseObject oldMediaInfo, UBaseObject newMediaInfo)+ {+ OldMediaInfo = oldMediaInfo;+ NewMediaInfo = newMediaInfo;+ }+public UBaseObject OldMediaInfo { get; set; }public UBaseObject NewMediaInfo { get; set; }diff --git a/Emby.Dlna/PlayTo/PlaybackProgressEventArgs.cs b/Emby.Dlna/PlayTo/PlaybackProgressEventArgs.csindex c7d2b28df8..c95d8b1e84 100644--- a/Emby.Dlna/PlayTo/PlaybackProgressEventArgs.cs+++ b/Emby.Dlna/PlayTo/PlaybackProgressEventArgs.cs@@ -1,5 +1,3 @@-#nullable disable-#pragma warning disable CS1591using System;@@ -8,6 +6,11 @@ namespace Emby.Dlna.PlayTo{public class PlaybackProgressEventArgs : EventArgs{+ public PlaybackProgressEventArgs(UBaseObject mediaInfo)+ {+ MediaInfo = mediaInfo;+ }+public UBaseObject MediaInfo { get; set; }}}diff --git a/Emby.Dlna/PlayTo/PlaybackStartEventArgs.cs b/Emby.Dlna/PlayTo/PlaybackStartEventArgs.csindex f8a14f411f..619c861ed9 100644--- a/Emby.Dlna/PlayTo/PlaybackStartEventArgs.cs+++ b/Emby.Dlna/PlayTo/PlaybackStartEventArgs.cs@@ -1,5 +1,3 @@-#nullable disable-#pragma warning disable CS1591using System;@@ -8,6 +6,11 @@ namespace Emby.Dlna.PlayTo{public class PlaybackStartEventArgs : EventArgs{+ public PlaybackStartEventArgs(UBaseObject mediaInfo)+ {+ MediaInfo = mediaInfo;+ }+public UBaseObject MediaInfo { get; set; }}}diff --git a/Emby.Dlna/PlayTo/PlaybackStoppedEventArgs.cs b/Emby.Dlna/PlayTo/PlaybackStoppedEventArgs.csindex 6661f92ac7..d0ec250591 100644--- a/Emby.Dlna/PlayTo/PlaybackStoppedEventArgs.cs+++ b/Emby.Dlna/PlayTo/PlaybackStoppedEventArgs.cs@@ -1,5 +1,3 @@-#nullable disable-#pragma warning disable CS1591using System;@@ -8,6 +6,11 @@ namespace Emby.Dlna.PlayTo{public class PlaybackStoppedEventArgs : EventArgs{+ public PlaybackStoppedEventArgs(UBaseObject mediaInfo)+ {+ MediaInfo = mediaInfo;+ }+public UBaseObject MediaInfo { get; set; }}}diff --git a/Emby.Dlna/Service/BaseControlHandler.cs b/Emby.Dlna/Service/BaseControlHandler.csindex b3ee860f4b..581e4a2861 100644--- a/Emby.Dlna/Service/BaseControlHandler.cs+++ b/Emby.Dlna/Service/BaseControlHandler.cs@@ -95,11 +95,7 @@ namespace Emby.Dlna.Servicevar xml = builder.ToString().Replace("xmlns:m=", "xmlns:u=", StringComparison.Ordinal);- var controlResponse = new ControlResponse- {- Xml = xml,- IsSuccessful = true- };+ var controlResponse = new ControlResponse(xml, true);controlResponse.Headers.Add("EXT", string.Empty);diff --git a/Emby.Dlna/Service/ControlErrorHandler.cs b/Emby.Dlna/Service/ControlErrorHandler.csindex f2b5dd9ca8..3e2cd6d2e4 100644--- a/Emby.Dlna/Service/ControlErrorHandler.cs+++ b/Emby.Dlna/Service/ControlErrorHandler.cs@@ -46,11 +46,7 @@ namespace Emby.Dlna.Servicewriter.WriteEndDocument();}- return new ControlResponse- {- Xml = builder.ToString(),- IsSuccessful = false- };+ return new ControlResponse(builder.ToString(), false);}}}diff --git a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs b/Jellyfin.Server.Implementations/Activity/ActivityManager.csindex 27360afb0a..a3a2a8baff 100644--- a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs+++ b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs@@ -86,15 +86,12 @@ namespace Jellyfin.Server.Implementations.Activityprivate static ActivityLogEntry ConvertToOldModel(ActivityLog entry){- return new ActivityLogEntry+ return new ActivityLogEntry(entry.Name, entry.Type, entry.UserId){Id = entry.Id,- Name = entry.Name,Overview = entry.Overview,ShortOverview = entry.ShortOverview,- Type = entry.Type,ItemId = entry.ItemId,- UserId = entry.UserId,Date = entry.DateCreated,Severity = entry.LogSeverity};diff --git a/MediaBrowser.Model/Activity/ActivityLogEntry.cs b/MediaBrowser.Model/Activity/ActivityLogEntry.csindex 1d47ef9f69..f83dde56d4 100644--- a/MediaBrowser.Model/Activity/ActivityLogEntry.cs+++ b/MediaBrowser.Model/Activity/ActivityLogEntry.cs@@ -1,13 +1,26 @@-#nullable disable-#pragma warning disable CS1591-using System;using Microsoft.Extensions.Logging;namespace MediaBrowser.Model.Activity{+ /// <summary>+ /// An activity log entry.+ /// </summary>public class ActivityLogEntry{+ /// <summary>+ /// Initializes a new instance of the <see cref="ActivityLogEntry"/> class.+ /// </summary>+ /// <param name="name">The name.</param>+ /// <param name="type">The type.</param>+ /// <param name="userId">The user id.</param>+ public ActivityLogEntry(string name, string type, Guid userId)+ {+ Name = name;+ Type = type;+ UserId = userId;+ }+/// <summary>/// Gets or sets the identifier./// </summary>@@ -24,13 +37,13 @@ namespace MediaBrowser.Model.Activity/// Gets or sets the overview./// </summary>/// <value>The overview.</value>- public string Overview { get; set; }+ public string? Overview { get; set; }/// <summary>/// Gets or sets the short overview./// </summary>/// <value>The short overview.</value>- public string ShortOverview { get; set; }+ public string? ShortOverview { get; set; }/// <summary>/// Gets or sets the type.@@ -42,7 +55,7 @@ namespace MediaBrowser.Model.Activity/// Gets or sets the item identifier./// </summary>/// <value>The item identifier.</value>- public string ItemId { get; set; }+ public string? ItemId { get; set; }/// <summary>/// Gets or sets the date.@@ -61,7 +74,7 @@ namespace MediaBrowser.Model.Activity/// </summary>/// <value>The user primary image tag.</value>[Obsolete("UserPrimaryImageTag is not used.")]- public string UserPrimaryImageTag { get; set; }+ public string? UserPrimaryImageTag { get; set; }/// <summary>/// Gets or sets the log severity.diff --git a/MediaBrowser.Model/Branding/BrandingOptions.cs b/MediaBrowser.Model/Branding/BrandingOptions.csindex 5ddf1e7e6e..7f19a5b852 100644--- a/MediaBrowser.Model/Branding/BrandingOptions.cs+++ b/MediaBrowser.Model/Branding/BrandingOptions.cs@@ -1,4 +1,3 @@-#nullable disable#pragma warning disable CS1591namespace MediaBrowser.Model.Branding@@ -9,12 +8,12 @@ namespace MediaBrowser.Model.Branding/// Gets or sets the login disclaimer./// </summary>/// <value>The login disclaimer.</value>- public string LoginDisclaimer { get; set; }+ public string? LoginDisclaimer { get; set; }/// <summary>/// Gets or sets the custom CSS./// </summary>/// <value>The custom CSS.</value>- public string CustomCss { get; set; }+ public string? CustomCss { get; set; }}}diff --git a/MediaBrowser.Model/Channels/ChannelInfo.cs b/MediaBrowser.Model/Channels/ChannelInfo.csdeleted file mode 100644index f2432aaeb2..0000000000--- a/MediaBrowser.Model/Channels/ChannelInfo.cs+++ /dev/null@@ -1,32 +0,0 @@-#nullable disable-#pragma warning disable CS1591--namespace MediaBrowser.Model.Channels-{- public class ChannelInfo- {- /// <summary>- /// Gets or sets the name.- /// </summary>- /// <value>The name.</value>- public string Name { get; set; }-- /// <summary>- /// Gets or sets the identifier.- /// </summary>- /// <value>The identifier.</value>- public string Id { get; set; }-- /// <summary>- /// Gets or sets the home page URL.- /// </summary>- /// <value>The home page URL.</value>- public string HomePageUrl { get; set; }-- /// <summary>- /// Gets or sets the features.- /// </summary>- /// <value>The features.</value>- public ChannelFeatures Features { get; set; }- }-}