diff options
Diffstat (limited to 'MediaBrowser.Model')
| -rw-r--r-- | MediaBrowser.Model/Dlna/ContainerProfile.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/DeviceIdentification.cs | 23 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/DeviceProfile.cs | 217 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/StreamBuilder.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/XmlAttribute.cs | 9 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStream.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/ProviderIdsExtensions.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Model/Extensions/StringHelper.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/MediaBrowser.Model.csproj | 8 | ||||
| -rw-r--r-- | MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs | 3 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/HttpException.cs | 42 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/MimeTypes.cs | 8 |
13 files changed, 228 insertions, 101 deletions
diff --git a/MediaBrowser.Model/Dlna/ContainerProfile.cs b/MediaBrowser.Model/Dlna/ContainerProfile.cs index f77d9b267..09afa64bb 100644 --- a/MediaBrowser.Model/Dlna/ContainerProfile.cs +++ b/MediaBrowser.Model/Dlna/ContainerProfile.cs @@ -34,7 +34,7 @@ namespace MediaBrowser.Model.Dlna return Array.Empty<string>(); } - return value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + return value.Split(',', StringSplitOptions.RemoveEmptyEntries); } public bool ContainsContainer(string container) diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs index 8b73ecbd4..50e3374f7 100644 --- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs +++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs @@ -186,7 +186,7 @@ namespace MediaBrowser.Model.Dlna if (mediaProfile != null && !string.IsNullOrEmpty(mediaProfile.OrgPn)) { - orgPnValues.AddRange(mediaProfile.OrgPn.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)); + orgPnValues.AddRange(mediaProfile.OrgPn.Split(',', StringSplitOptions.RemoveEmptyEntries)); } else { diff --git a/MediaBrowser.Model/Dlna/DeviceIdentification.cs b/MediaBrowser.Model/Dlna/DeviceIdentification.cs index 43407383a..c511801f4 100644 --- a/MediaBrowser.Model/Dlna/DeviceIdentification.cs +++ b/MediaBrowser.Model/Dlna/DeviceIdentification.cs @@ -11,59 +11,54 @@ namespace MediaBrowser.Model.Dlna /// Gets or sets the name of the friendly. /// </summary> /// <value>The name of the friendly.</value> - public string FriendlyName { get; set; } + public string FriendlyName { get; set; } = string.Empty; /// <summary> /// Gets or sets the model number. /// </summary> /// <value>The model number.</value> - public string ModelNumber { get; set; } + public string ModelNumber { get; set; } = string.Empty; /// <summary> /// Gets or sets the serial number. /// </summary> /// <value>The serial number.</value> - public string SerialNumber { get; set; } + public string SerialNumber { get; set; } = string.Empty; /// <summary> /// Gets or sets the name of the model. /// </summary> /// <value>The name of the model.</value> - public string ModelName { get; set; } + public string ModelName { get; set; } = string.Empty; /// <summary> /// Gets or sets the model description. /// </summary> /// <value>The model description.</value> - public string ModelDescription { get; set; } + public string ModelDescription { get; set; } = string.Empty; /// <summary> /// Gets or sets the model URL. /// </summary> /// <value>The model URL.</value> - public string ModelUrl { get; set; } + public string ModelUrl { get; set; } = string.Empty; /// <summary> /// Gets or sets the manufacturer. /// </summary> /// <value>The manufacturer.</value> - public string Manufacturer { get; set; } + public string Manufacturer { get; set; } = string.Empty; /// <summary> /// Gets or sets the manufacturer URL. /// </summary> /// <value>The manufacturer URL.</value> - public string ManufacturerUrl { get; set; } + public string ManufacturerUrl { get; set; } = string.Empty; /// <summary> /// Gets or sets the headers. /// </summary> /// <value>The headers.</value> - public HttpHeaderInfo[] Headers { get; set; } - - public DeviceIdentification() - { - Headers = Array.Empty<HttpHeaderInfo>(); - } + public HttpHeaderInfo[] Headers { get; set; } = Array.Empty<HttpHeaderInfo>(); } } diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index e842efead..ff5186658 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -1,6 +1,5 @@ #nullable disable -#pragma warning disable CS1591 - +#pragma warning disable CA1819 // Properties should not return arrays using System; using System.Linq; using System.Xml.Serialization; @@ -8,129 +7,243 @@ using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Model.Dlna { + /// <summary> + /// Defines the <see cref="DeviceProfile" />. + /// </summary> [XmlRoot("Profile")] public class DeviceProfile { /// <summary> - /// Gets or sets the name. + /// Initializes a new instance of the <see cref="DeviceProfile"/> class. + /// </summary> + public DeviceProfile() + { + DirectPlayProfiles = Array.Empty<DirectPlayProfile>(); + TranscodingProfiles = Array.Empty<TranscodingProfile>(); + ResponseProfiles = Array.Empty<ResponseProfile>(); + CodecProfiles = Array.Empty<CodecProfile>(); + ContainerProfiles = Array.Empty<ContainerProfile>(); + SubtitleProfiles = Array.Empty<SubtitleProfile>(); + + XmlRootAttributes = Array.Empty<XmlAttribute>(); + + SupportedMediaTypes = "Audio,Photo,Video"; + MaxStreamingBitrate = 8000000; + MaxStaticBitrate = 8000000; + MusicStreamingTranscodingBitrate = 128000; + } + + /// <summary> + /// Gets or sets the Name. /// </summary> - /// <value>The name.</value> public string Name { get; set; } + /// <summary> + /// Gets or sets the Id. + /// </summary> [XmlIgnore] public string Id { get; set; } /// <summary> - /// Gets or sets the identification. + /// Gets or sets the Identification. /// </summary> - /// <value>The identification.</value> public DeviceIdentification Identification { get; set; } + /// <summary> + /// Gets or sets the FriendlyName. + /// </summary> public string FriendlyName { get; set; } + /// <summary> + /// Gets or sets the Manufacturer. + /// </summary> public string Manufacturer { get; set; } + /// <summary> + /// Gets or sets the ManufacturerUrl. + /// </summary> public string ManufacturerUrl { get; set; } + /// <summary> + /// Gets or sets the ModelName. + /// </summary> public string ModelName { get; set; } + /// <summary> + /// Gets or sets the ModelDescription. + /// </summary> public string ModelDescription { get; set; } + /// <summary> + /// Gets or sets the ModelNumber. + /// </summary> public string ModelNumber { get; set; } + /// <summary> + /// Gets or sets the ModelUrl. + /// </summary> public string ModelUrl { get; set; } + /// <summary> + /// Gets or sets the SerialNumber. + /// </summary> public string SerialNumber { get; set; } + /// <summary> + /// Gets or sets a value indicating whether EnableAlbumArtInDidl. + /// </summary> public bool EnableAlbumArtInDidl { get; set; } + /// <summary> + /// Gets or sets a value indicating whether EnableSingleAlbumArtLimit. + /// </summary> public bool EnableSingleAlbumArtLimit { get; set; } + /// <summary> + /// Gets or sets a value indicating whether EnableSingleSubtitleLimit. + /// </summary> public bool EnableSingleSubtitleLimit { get; set; } + /// <summary> + /// Gets or sets the SupportedMediaTypes. + /// </summary> public string SupportedMediaTypes { get; set; } + /// <summary> + /// Gets or sets the UserId. + /// </summary> public string UserId { get; set; } + /// <summary> + /// Gets or sets the AlbumArtPn. + /// </summary> public string AlbumArtPn { get; set; } + /// <summary> + /// Gets or sets the MaxAlbumArtWidth. + /// </summary> public int MaxAlbumArtWidth { get; set; } + /// <summary> + /// Gets or sets the MaxAlbumArtHeight. + /// </summary> public int MaxAlbumArtHeight { get; set; } + /// <summary> + /// Gets or sets the MaxIconWidth. + /// </summary> public int? MaxIconWidth { get; set; } + /// <summary> + /// Gets or sets the MaxIconHeight. + /// </summary> public int? MaxIconHeight { get; set; } + /// <summary> + /// Gets or sets the MaxStreamingBitrate. + /// </summary> public int? MaxStreamingBitrate { get; set; } + /// <summary> + /// Gets or sets the MaxStaticBitrate. + /// </summary> public int? MaxStaticBitrate { get; set; } + /// <summary> + /// Gets or sets the MusicStreamingTranscodingBitrate. + /// </summary> public int? MusicStreamingTranscodingBitrate { get; set; } + /// <summary> + /// Gets or sets the MaxStaticMusicBitrate. + /// </summary> public int? MaxStaticMusicBitrate { get; set; } /// <summary> - /// Controls the content of the aggregationFlags element in the urn:schemas-sonycom:av namespace. + /// Gets or sets the content of the aggregationFlags element in the urn:schemas-sonycom:av namespace. /// </summary> public string SonyAggregationFlags { get; set; } + /// <summary> + /// Gets or sets the ProtocolInfo. + /// </summary> public string ProtocolInfo { get; set; } + /// <summary> + /// Gets or sets the TimelineOffsetSeconds. + /// </summary> public int TimelineOffsetSeconds { get; set; } + /// <summary> + /// Gets or sets a value indicating whether RequiresPlainVideoItems. + /// </summary> public bool RequiresPlainVideoItems { get; set; } + /// <summary> + /// Gets or sets a value indicating whether RequiresPlainFolders. + /// </summary> public bool RequiresPlainFolders { get; set; } + /// <summary> + /// Gets or sets a value indicating whether EnableMSMediaReceiverRegistrar. + /// </summary> public bool EnableMSMediaReceiverRegistrar { get; set; } + /// <summary> + /// Gets or sets a value indicating whether IgnoreTranscodeByteRangeRequests. + /// </summary> public bool IgnoreTranscodeByteRangeRequests { get; set; } + /// <summary> + /// Gets or sets the XmlRootAttributes. + /// </summary> public XmlAttribute[] XmlRootAttributes { get; set; } /// <summary> /// Gets or sets the direct play profiles. /// </summary> - /// <value>The direct play profiles.</value> public DirectPlayProfile[] DirectPlayProfiles { get; set; } /// <summary> /// Gets or sets the transcoding profiles. /// </summary> - /// <value>The transcoding profiles.</value> public TranscodingProfile[] TranscodingProfiles { get; set; } + /// <summary> + /// Gets or sets the ContainerProfiles. + /// </summary> public ContainerProfile[] ContainerProfiles { get; set; } + /// <summary> + /// Gets or sets the CodecProfiles. + /// </summary> public CodecProfile[] CodecProfiles { get; set; } + /// <summary> + /// Gets or sets the ResponseProfiles. + /// </summary> public ResponseProfile[] ResponseProfiles { get; set; } + /// <summary> + /// Gets or sets the SubtitleProfiles. + /// </summary> public SubtitleProfile[] SubtitleProfiles { get; set; } - public DeviceProfile() - { - DirectPlayProfiles = Array.Empty<DirectPlayProfile>(); - TranscodingProfiles = Array.Empty<TranscodingProfile>(); - ResponseProfiles = Array.Empty<ResponseProfile>(); - CodecProfiles = Array.Empty<CodecProfile>(); - ContainerProfiles = Array.Empty<ContainerProfile>(); - SubtitleProfiles = Array.Empty<SubtitleProfile>(); - - XmlRootAttributes = Array.Empty<XmlAttribute>(); - - SupportedMediaTypes = "Audio,Photo,Video"; - MaxStreamingBitrate = 8000000; - MaxStaticBitrate = 8000000; - MusicStreamingTranscodingBitrate = 128000; - } - + /// <summary> + /// The GetSupportedMediaTypes. + /// </summary> + /// <returns>The .</returns> public string[] GetSupportedMediaTypes() { return ContainerProfile.SplitValue(SupportedMediaTypes); } + /// <summary> + /// Gets the audio transcoding profile. + /// </summary> + /// <param name="container">The container.</param> + /// <param name="audioCodec">The audio Codec.</param> + /// <returns>A <see cref="TranscodingProfile"/>.</returns> public TranscodingProfile GetAudioTranscodingProfile(string container, string audioCodec) { container = (container ?? string.Empty).TrimStart('.'); @@ -158,6 +271,13 @@ namespace MediaBrowser.Model.Dlna return null; } + /// <summary> + /// Gets the video transcoding profile. + /// </summary> + /// <param name="container">The container.</param> + /// <param name="audioCodec">The audio Codec.</param> + /// <param name="videoCodec">The video Codec.</param> + /// <returns>The <see cref="TranscodingProfile"/>.</returns> public TranscodingProfile GetVideoTranscodingProfile(string container, string audioCodec, string videoCodec) { container = (container ?? string.Empty).TrimStart('.'); @@ -190,6 +310,16 @@ namespace MediaBrowser.Model.Dlna return null; } + /// <summary> + /// Gets the audio media profile. + /// </summary> + /// <param name="container">The container.</param> + /// <param name="audioCodec">The audio codec.</param> + /// <param name="audioChannels">The audio channels.</param> + /// <param name="audioBitrate">The audio bitrate.</param> + /// <param name="audioSampleRate">The audio sample rate.</param> + /// <param name="audioBitDepth">The audio bit depth.</param> + /// <returns>The <see cref="ResponseProfile"/>.</returns> public ResponseProfile GetAudioMediaProfile(string container, string audioCodec, int? audioChannels, int? audioBitrate, int? audioSampleRate, int? audioBitDepth) { foreach (var i in ResponseProfiles) @@ -231,6 +361,11 @@ namespace MediaBrowser.Model.Dlna return null; } + /// <summary> + /// Gets the model profile condition. + /// </summary> + /// <param name="c">The c<see cref="ProfileCondition"/>.</param> + /// <returns>The <see cref="ProfileCondition"/>.</returns> private ProfileCondition GetModelProfileCondition(ProfileCondition c) { return new ProfileCondition @@ -242,6 +377,13 @@ namespace MediaBrowser.Model.Dlna }; } + /// <summary> + /// Gets the image media profile. + /// </summary> + /// <param name="container">The container.</param> + /// <param name="width">The width.</param> + /// <param name="height">The height.</param> + /// <returns>The <see cref="ResponseProfile"/>.</returns> public ResponseProfile GetImageMediaProfile(string container, int? width, int? height) { foreach (var i in ResponseProfiles) @@ -277,6 +419,29 @@ namespace MediaBrowser.Model.Dlna return null; } + /// <summary> + /// Gets the video media profile. + /// </summary> + /// <param name="container">The container.</param> + /// <param name="audioCodec">The audio codec.</param> + /// <param name="videoCodec">The video codec.</param> + /// <param name="width">The width.</param> + /// <param name="height">The height.</param> + /// <param name="bitDepth">The bit depth.</param> + /// <param name="videoBitrate">The video bitrate.</param> + /// <param name="videoProfile">The video profile.</param> + /// <param name="videoLevel">The video level.</param> + /// <param name="videoFramerate">The video framerate.</param> + /// <param name="packetLength">The packet length.</param> + /// <param name="timestamp">The timestamp<see cref="TransportStreamTimestamp"/>.</param> + /// <param name="isAnamorphic">True if anamorphic.</param> + /// <param name="isInterlaced">True if interlaced.</param> + /// <param name="refFrames">The ref frames.</param> + /// <param name="numVideoStreams">The number of video streams.</param> + /// <param name="numAudioStreams">The number of audio streams.</param> + /// <param name="videoCodecTag">The video Codec tag.</param> + /// <param name="isAvc">True if Avc.</param> + /// <returns>The <see cref="ResponseProfile"/>.</returns> public ResponseProfile GetVideoMediaProfile( string container, string audioCodec, diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 4959a9b92..13234c381 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -1647,7 +1647,7 @@ namespace MediaBrowser.Model.Dlna // strip spaces to avoid having to encode var values = value - .Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); + .Split('|', StringSplitOptions.RemoveEmptyEntries); if (condition.Condition == ProfileConditionType.Equals || condition.Condition == ProfileConditionType.EqualsAny) { diff --git a/MediaBrowser.Model/Dlna/XmlAttribute.cs b/MediaBrowser.Model/Dlna/XmlAttribute.cs index 3a8939a79..03bb2e4b1 100644 --- a/MediaBrowser.Model/Dlna/XmlAttribute.cs +++ b/MediaBrowser.Model/Dlna/XmlAttribute.cs @@ -5,11 +5,20 @@ using System.Xml.Serialization; namespace MediaBrowser.Model.Dlna { + /// <summary> + /// Defines the <see cref="XmlAttribute" />. + /// </summary> public class XmlAttribute { + /// <summary> + /// Gets or sets the name of the attribute. + /// </summary> [XmlAttribute("name")] public string Name { get; set; } + /// <summary> + /// Gets or sets the value of the attribute. + /// </summary> [XmlAttribute("value")] public string Value { get; set; } } diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index fa3c9aaa2..ca0b93c30 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -191,6 +191,11 @@ namespace MediaBrowser.Model.Entities attributes.Add(Codec.ToUpperInvariant()); } + if (!string.IsNullOrEmpty(VideoRange)) + { + attributes.Add(VideoRange.ToUpperInvariant()); + } + if (!string.IsNullOrEmpty(Title)) { var result = new StringBuilder(Title); diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs index 9c11fe0ad..1782b42e2 100644 --- a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs +++ b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs @@ -48,7 +48,7 @@ namespace MediaBrowser.Model.Entities return null; } - instance.ProviderIds.TryGetValue(name, out string id); + instance.ProviderIds.TryGetValue(name, out string? id); return id; } diff --git a/MediaBrowser.Model/Extensions/StringHelper.cs b/MediaBrowser.Model/Extensions/StringHelper.cs index 8ffa3c4ba..2d9a6c4db 100644 --- a/MediaBrowser.Model/Extensions/StringHelper.cs +++ b/MediaBrowser.Model/Extensions/StringHelper.cs @@ -22,11 +22,6 @@ namespace MediaBrowser.Model.Extensions return str; } -#if NETSTANDARD2_0 - char[] a = str.ToCharArray(); - a[0] = char.ToUpperInvariant(a[0]); - return new string(a); -#else return string.Create( str.Length, str, @@ -38,7 +33,6 @@ namespace MediaBrowser.Model.Extensions chars[i] = buf[i]; } }); -#endif } } } diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 253ee7e79..b86187f9b 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -14,7 +14,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks> + <TargetFramework>net5.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> <TreatWarningsAsErrors Condition=" '$(Configuration)' == 'Release' ">true</TreatWarningsAsErrors> @@ -32,11 +32,11 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> + <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" /> <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" /> - <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.9" /> + <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" /> <PackageReference Include="System.Globalization" Version="4.3.0" /> - <PackageReference Include="System.Text.Json" Version="5.0.0-preview.8.20407.11" /> + <PackageReference Include="System.Text.Json" Version="5.0.0" /> </ItemGroup> <ItemGroup> diff --git a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs index a8ea405e2..36a240706 100644 --- a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs +++ b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs @@ -2,6 +2,7 @@ #pragma warning disable CS1591 using System; +using System.Collections.Generic; using MediaBrowser.Model.Dlna; namespace MediaBrowser.Model.MediaInfo @@ -55,6 +56,6 @@ namespace MediaBrowser.Model.MediaInfo public bool EnableDirectStream { get; set; } - public MediaProtocol[] DirectPlayProtocols { get; set; } + public IReadOnlyList<MediaProtocol> DirectPlayProtocols { get; set; } } } diff --git a/MediaBrowser.Model/Net/HttpException.cs b/MediaBrowser.Model/Net/HttpException.cs deleted file mode 100644 index 48ff5d51c..000000000 --- a/MediaBrowser.Model/Net/HttpException.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Net; - -namespace MediaBrowser.Model.Net -{ - /// <summary> - /// Class HttpException. - /// </summary> - public class HttpException : Exception - { - /// <summary> - /// Gets or sets the status code. - /// </summary> - /// <value>The status code.</value> - public HttpStatusCode? StatusCode { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance is timed out. - /// </summary> - /// <value><c>true</c> if this instance is timed out; otherwise, <c>false</c>.</value> - public bool IsTimedOut { get; set; } - - /// <summary> - /// Initializes a new instance of the <see cref="HttpException" /> class. - /// </summary> - /// <param name="message">The message.</param> - /// <param name="innerException">The inner exception.</param> - public HttpException(string message, Exception innerException) - : base(message, innerException) - { - } - - /// <summary> - /// Initializes a new instance of the <see cref="HttpException" /> class. - /// </summary> - /// <param name="message">The message.</param> - public HttpException(string message) - : base(message) - { - } - } -} diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs index afe7351d3..902db1e9e 100644 --- a/MediaBrowser.Model/Net/MimeTypes.cs +++ b/MediaBrowser.Model/Net/MimeTypes.cs @@ -177,7 +177,7 @@ namespace MediaBrowser.Model.Net var ext = Path.GetExtension(path); - if (_mimeTypeLookup.TryGetValue(ext, out string result)) + if (_mimeTypeLookup.TryGetValue(ext, out string? result)) { return result; } @@ -210,9 +210,9 @@ namespace MediaBrowser.Model.Net return enableStreamDefault ? "application/octet-stream" : null; } - public static string? ToExtension(string mimeType) + public static string? ToExtension(string? mimeType) { - if (mimeType.Length == 0) + if (string.IsNullOrEmpty(mimeType)) { throw new ArgumentException("String can't be empty.", nameof(mimeType)); } @@ -220,7 +220,7 @@ namespace MediaBrowser.Model.Net // handle text/html; charset=UTF-8 mimeType = mimeType.Split(';')[0]; - if (_extensionLookup.TryGetValue(mimeType, out string result)) + if (_extensionLookup.TryGetValue(mimeType, out string? result)) { return result; } |
