Merge pull request #2767 from Bond-009/nullable3

Enable nullabe reference types for MediaBrowser.Model
This commit is contained in:
Vasily
2020-06-03 12:26:54 +03:00
committed by GitHub
204 changed files with 629 additions and 508 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -10,6 +11,7 @@ namespace MediaBrowser.Model.Dlna
{
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
public ProfileCondition[] Conditions { get; set; }
[XmlAttribute("container")]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -25,7 +25,7 @@ namespace MediaBrowser.Model.Entities
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
/// <returns>System.String.</returns>
public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider)
public static string? GetProviderId(this IHasProviderIds instance, MetadataProviders provider)
{
return instance.GetProviderId(provider.ToString());
}
@@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Entities
/// <param name="instance">The instance.</param>
/// <param name="name">The name.</param>
/// <returns>System.String.</returns>
public static string GetProviderId(this IHasProviderIds instance, string name)
public static string? GetProviderId(this IHasProviderIds instance, string name)
{
if (instance == null)
{

View File

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

View File

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

View File

@@ -0,0 +1,29 @@
#nullable disable
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Extensions
{
// TODO: @bond remove
public static class ListHelper
{
public static bool ContainsIgnoreCase(string[] list, string value)
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
foreach (var item in list)
{
if (string.Equals(item, value, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -16,7 +16,6 @@ namespace MediaBrowser.Model.IO
/// <param name="isoPath">The iso path.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>IsoMount.</returns>
/// <exception cref="ArgumentNullException">isoPath</exception>
/// <exception cref="IOException">Unable to create mount.</exception>
Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken);

View File

@@ -8,7 +8,7 @@ namespace MediaBrowser.Model.IO
public interface IIsoMount : IDisposable
{
/// <summary>
/// Gets or sets the iso path.
/// Gets the iso path.
/// </summary>
/// <value>The iso path.</value>
string IsoPath { get; }

View File

@@ -9,6 +9,12 @@ namespace MediaBrowser.Model.IO
{
public interface IIsoMounter
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; }
/// <summary>
/// Mounts the specified iso path.
/// </summary>
@@ -25,11 +31,5 @@ namespace MediaBrowser.Model.IO
/// <param name="path">The path.</param>
/// <returns><c>true</c> if this instance can mount the specified path; otherwise, <c>false</c>.</returns>
bool CanMount(string path);
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; }
}
}

View File

@@ -14,6 +14,7 @@ namespace MediaBrowser.Model.IO
Task CopyToAsync(Stream source, Stream destination, int bufferSize, int emptyReadLimit, CancellationToken cancellationToken);
Task<int> CopyToAsync(Stream source, Stream destination, CancellationToken cancellationToken);
Task CopyToAsync(Stream source, Stream destination, long copyLength, CancellationToken cancellationToken);
Task CopyUntilCancelled(Stream source, Stream target, int bufferSize, CancellationToken cancellationToken);

View File

@@ -6,6 +6,12 @@ namespace MediaBrowser.Model.Library
{
public class UserViewQuery
{
public UserViewQuery()
{
IncludeExternalContent = true;
PresetViews = Array.Empty<string>();
}
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
@@ -25,11 +31,5 @@ namespace MediaBrowser.Model.Library
public bool IncludeHidden { get; set; }
public string[] PresetViews { get; set; }
public UserViewQuery()
{
IncludeExternalContent = true;
PresetViews = Array.Empty<string>();
}
}
}

View File

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

View File

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

View File

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

View File

@@ -6,6 +6,12 @@ namespace MediaBrowser.Model.LiveTv
{
public class LiveTvInfo
{
public LiveTvInfo()
{
Services = Array.Empty<LiveTvServiceInfo>();
EnabledUsers = Array.Empty<string>();
}
/// <summary>
/// Gets or sets the services.
/// </summary>
@@ -23,11 +29,5 @@ namespace MediaBrowser.Model.LiveTv
/// </summary>
/// <value>The enabled users.</value>
public string[] EnabledUsers { get; set; }
public LiveTvInfo()
{
Services = Array.Empty<LiveTvServiceInfo>();
EnabledUsers = Array.Empty<string>();
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,7 @@ namespace MediaBrowser.Model.LiveTv
/// Gets or sets the sort by - SortName, Priority
/// </summary>
/// <value>The sort by.</value>
public string SortBy { get; set; }
public string? SortBy { get; set; }
/// <summary>
/// Gets or sets the sort order.

View File

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

View File

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

View File

@@ -17,6 +17,8 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors Condition=" '$(Configuration)' == 'Release' ">true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>

View File

@@ -10,9 +10,9 @@ namespace MediaBrowser.Model.MediaInfo
public static string GetFriendlyName(string codec)
{
if (string.IsNullOrEmpty(codec))
if (codec.Length == 0)
{
return string.Empty;
return codec;
}
switch (codec.ToLowerInvariant())

View File

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

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