浏览代码

Enable nullable for more files

Bond_009 3 年之前
父节点
当前提交
1b6eb2ff2d

+ 1 - 3
Emby.Server.Implementations/Channels/ChannelManager.cs

@@ -586,7 +586,7 @@ namespace Emby.Server.Implementations.Channels
         {
             var supportsLatest = provider is ISupportsLatestMedia;
 
-            return new ChannelFeatures
+            return new ChannelFeatures(channel.Name, channel.Id)
             {
                 CanFilter = !features.MaxPageSize.HasValue,
                 CanSearch = provider is ISearchableChannel,
@@ -596,8 +596,6 @@ namespace Emby.Server.Implementations.Channels
                 MediaTypes = features.MediaTypes.ToArray(),
                 SupportsSortOrderToggle = features.SupportsSortOrderToggle,
                 SupportsLatestMedia = supportsLatest,
-                Name = channel.Name,
-                Id = channel.Id.ToString("N", CultureInfo.InvariantCulture),
                 SupportsContentDownloading = features.SupportsContentDownloading,
                 AutoRefreshLevels = features.AutoRefreshLevels
             };

+ 1 - 5
Jellyfin.Server.Implementations/Users/UserManager.cs

@@ -530,11 +530,7 @@ namespace Jellyfin.Server.Implementations.Users
                 }
             }
 
-            return new PinRedeemResult
-            {
-                Success = false,
-                UsersReset = Array.Empty<string>()
-            };
+            return new PinRedeemResult();
         }
 
         /// <inheritdoc />

+ 5 - 3
MediaBrowser.Model/Channels/ChannelFeatures.cs

@@ -1,4 +1,3 @@
-#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -7,11 +6,14 @@ namespace MediaBrowser.Model.Channels
 {
     public class ChannelFeatures
     {
-        public ChannelFeatures()
+        public ChannelFeatures(string name, Guid id)
         {
             MediaTypes = Array.Empty<ChannelMediaType>();
             ContentTypes = Array.Empty<ChannelMediaContentType>();
             DefaultSortFields = Array.Empty<ChannelItemSortField>();
+
+            Name = name;
+            Id = id;
         }
 
         /// <summary>
@@ -24,7 +26,7 @@ namespace MediaBrowser.Model.Channels
         /// Gets or sets the identifier.
         /// </summary>
         /// <value>The identifier.</value>
-        public string Id { get; set; }
+        public Guid Id { get; set; }
 
         /// <summary>
         /// Gets or sets a value indicating whether this instance can search.

+ 2 - 3
MediaBrowser.Model/Channels/ChannelQuery.cs

@@ -1,4 +1,3 @@
-#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -13,13 +12,13 @@ namespace MediaBrowser.Model.Channels
         /// Gets or sets the fields to return within the items, in addition to basic information.
         /// </summary>
         /// <value>The fields.</value>
-        public ItemFields[] Fields { get; set; }
+        public ItemFields[]? Fields { get; set; }
 
         public bool? EnableImages { get; set; }
 
         public int? ImageTypeLimit { get; set; }
 
-        public ImageType[] EnableImageTypes { get; set; }
+        public ImageType[]? EnableImageTypes { get; set; }
 
         /// <summary>
         /// Gets or sets the user identifier.

+ 3 - 4
MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs

@@ -1,4 +1,3 @@
-#nullable disable
 using System;
 using System.Xml.Serialization;
 
@@ -35,21 +34,21 @@ namespace MediaBrowser.Model.Configuration
         /// Gets or sets the cache path.
         /// </summary>
         /// <value>The cache path.</value>
-        public string CachePath { get; set; }
+        public string? CachePath { get; set; }
 
         /// <summary>
         /// Gets or sets the last known version that was ran using the configuration.
         /// </summary>
         /// <value>The version from previous run.</value>
         [XmlIgnore]
-        public Version PreviousVersion { get; set; }
+        public Version? PreviousVersion { get; set; }
 
         /// <summary>
         /// Gets or sets the stringified PreviousVersion to be stored/loaded,
         /// because System.Version itself isn't xml-serializable.
         /// </summary>
         /// <value>String value of PreviousVersion.</value>
-        public string PreviousVersionStr
+        public string? PreviousVersionStr
         {
             get => PreviousVersion?.ToString();
             set

+ 6 - 7
MediaBrowser.Model/Configuration/LibraryOptions.cs

@@ -1,4 +1,3 @@
-#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -52,21 +51,21 @@ namespace MediaBrowser.Model.Configuration
         /// Gets or sets the preferred metadata language.
         /// </summary>
         /// <value>The preferred metadata language.</value>
-        public string PreferredMetadataLanguage { get; set; }
+        public string? PreferredMetadataLanguage { get; set; }
 
         /// <summary>
         /// Gets or sets the metadata country code.
         /// </summary>
         /// <value>The metadata country code.</value>
-        public string MetadataCountryCode { get; set; }
+        public string? MetadataCountryCode { get; set; }
 
         public string SeasonZeroDisplayName { get; set; }
 
-        public string[] MetadataSavers { get; set; }
+        public string[]? MetadataSavers { get; set; }
 
         public string[] DisabledLocalMetadataReaders { get; set; }
 
-        public string[] LocalMetadataReaderOrder { get; set; }
+        public string[]? LocalMetadataReaderOrder { get; set; }
 
         public string[] DisabledSubtitleFetchers { get; set; }
 
@@ -76,7 +75,7 @@ namespace MediaBrowser.Model.Configuration
 
         public bool SkipSubtitlesIfAudioTrackMatches { get; set; }
 
-        public string[] SubtitleDownloadLanguages { get; set; }
+        public string[]? SubtitleDownloadLanguages { get; set; }
 
         public bool RequirePerfectSubtitleMatch { get; set; }
 
@@ -84,7 +83,7 @@ namespace MediaBrowser.Model.Configuration
 
         public TypeOptions[] TypeOptions { get; set; }
 
-        public TypeOptions GetTypeOptions(string type)
+        public TypeOptions? GetTypeOptions(string type)
         {
             foreach (var options in TypeOptions)
             {

+ 2 - 3
MediaBrowser.Model/Configuration/UserConfiguration.cs

@@ -1,4 +1,3 @@
-#nullable disable
 #pragma warning disable CS1591
 
 using System;
@@ -33,7 +32,7 @@ namespace MediaBrowser.Model.Configuration
         /// Gets or sets the audio language preference.
         /// </summary>
         /// <value>The audio language preference.</value>
-        public string AudioLanguagePreference { get; set; }
+        public string? AudioLanguagePreference { get; set; }
 
         /// <summary>
         /// Gets or sets a value indicating whether [play default audio track].
@@ -45,7 +44,7 @@ namespace MediaBrowser.Model.Configuration
         /// Gets or sets the subtitle language preference.
         /// </summary>
         /// <value>The subtitle language preference.</value>
-        public string SubtitleLanguagePreference { get; set; }
+        public string? SubtitleLanguagePreference { get; set; }
 
         public bool DisplayMissingEpisodes { get; set; }
 

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

@@ -1,4 +1,3 @@
-#nullable disable
 #pragma warning disable CS1591
 
 namespace MediaBrowser.Model.Configuration
@@ -13,7 +12,7 @@ namespace MediaBrowser.Model.Configuration
             EnablePathSubstitution = true;
         }
 
-        public string UserId { get; set; }
+        public string? UserId { get; set; }
 
         public string ReleaseDateFormat { get; set; }
 

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

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

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

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

+ 3 - 2
MediaBrowser.Model/Users/PinRedeemResult.cs

@@ -1,6 +1,7 @@
-#nullable disable
 #pragma warning disable CS1591
 
+using System;
+
 namespace MediaBrowser.Model.Users
 {
     public class PinRedeemResult
@@ -15,6 +16,6 @@ namespace MediaBrowser.Model.Users
         /// Gets or sets the users reset.
         /// </summary>
         /// <value>The users reset.</value>
-        public string[] UsersReset { get; set; }
+        public string[] UsersReset { get; set; } = Array.Empty<string>();
     }
 }