diff options
Diffstat (limited to 'MediaBrowser.Common')
| -rw-r--r-- | MediaBrowser.Common/Events/EventHelper.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Common/Extensions/HttpContextExtensions.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Common/MediaBrowser.Common.csproj | 8 | ||||
| -rw-r--r-- | MediaBrowser.Common/Net/IPHost.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Common/Net/IPNetAddress.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Common/Net/IPObject.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Common/Net/NetworkExtensions.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Common/Plugins/BasePluginOfT.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Common/Plugins/LocalPlugin.cs | 8 |
9 files changed, 20 insertions, 20 deletions
diff --git a/MediaBrowser.Common/Events/EventHelper.cs b/MediaBrowser.Common/Events/EventHelper.cs index a9cf86fbc..0e495f4fa 100644 --- a/MediaBrowser.Common/Events/EventHelper.cs +++ b/MediaBrowser.Common/Events/EventHelper.cs @@ -19,7 +19,7 @@ namespace MediaBrowser.Common.Events /// <param name="logger">The logger.</param> public static void QueueEventIfNotNull(EventHandler? handler, object sender, EventArgs args, ILogger logger) { - if (handler != null) + if (handler is not null) { Task.Run(() => { @@ -45,7 +45,7 @@ namespace MediaBrowser.Common.Events /// <param name="logger">The logger.</param> public static void QueueEventIfNotNull<T>(EventHandler<T>? handler, object sender, T args, ILogger logger) { - if (handler != null) + if (handler is not null) { Task.Run(() => { diff --git a/MediaBrowser.Common/Extensions/HttpContextExtensions.cs b/MediaBrowser.Common/Extensions/HttpContextExtensions.cs index 1e5877c84..6608704c0 100644 --- a/MediaBrowser.Common/Extensions/HttpContextExtensions.cs +++ b/MediaBrowser.Common/Extensions/HttpContextExtensions.cs @@ -15,8 +15,8 @@ namespace MediaBrowser.Common.Extensions /// <returns><c>true</c> if the request is coming from LAN, <c>false</c> otherwise.</returns> public static bool IsLocal(this HttpContext context) { - return (context.Connection.LocalIpAddress == null - && context.Connection.RemoteIpAddress == null) + return (context.Connection.LocalIpAddress is null + && context.Connection.RemoteIpAddress is null) || Equals(context.Connection.LocalIpAddress, context.Connection.RemoteIpAddress); } diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index 7a55f398a..0296974b5 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -19,8 +19,8 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" /> - <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" /> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" /> </ItemGroup> @@ -29,7 +29,7 @@ </ItemGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> <PublishRepositoryUrl>true</PublishRepositoryUrl> @@ -39,7 +39,7 @@ </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> - <TreatWarningsAsErrors>false</TreatWarningsAsErrors> + <CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors> </PropertyGroup> <PropertyGroup Condition=" '$(Stability)'=='Unstable'"> diff --git a/MediaBrowser.Common/Net/IPHost.cs b/MediaBrowser.Common/Net/IPHost.cs index 1f125f2b1..7cf1b8aa0 100644 --- a/MediaBrowser.Common/Net/IPHost.cs +++ b/MediaBrowser.Common/Net/IPHost.cs @@ -236,7 +236,7 @@ namespace MediaBrowser.Common.Net /// <inheritdoc/> public override bool Contains(IPAddress address) { - if (address != null && !Address.Equals(IPAddress.None)) + if (address is not null && !Address.Equals(IPAddress.None)) { if (address.IsIPv4MappedToIPv6) { diff --git a/MediaBrowser.Common/Net/IPNetAddress.cs b/MediaBrowser.Common/Net/IPNetAddress.cs index 98d1c2d97..ac3396a9f 100644 --- a/MediaBrowser.Common/Net/IPNetAddress.cs +++ b/MediaBrowser.Common/Net/IPNetAddress.cs @@ -214,7 +214,7 @@ namespace MediaBrowser.Common.Net /// <inheritdoc/> public override bool Equals(IPAddress ip) { - if (ip != null && !ip.Equals(IPAddress.None) && !Address.Equals(IPAddress.None)) + if (ip is not null && !ip.Equals(IPAddress.None) && !Address.Equals(IPAddress.None)) { return ip.Equals(Address); } diff --git a/MediaBrowser.Common/Net/IPObject.cs b/MediaBrowser.Common/Net/IPObject.cs index 37385972f..93655234b 100644 --- a/MediaBrowser.Common/Net/IPObject.cs +++ b/MediaBrowser.Common/Net/IPObject.cs @@ -292,7 +292,7 @@ namespace MediaBrowser.Common.Net /// <returns>Equality result.</returns> public virtual bool Equals(IPAddress ip) { - if (ip != null) + if (ip is not null) { if (ip.IsIPv4MappedToIPv6) { @@ -312,7 +312,7 @@ namespace MediaBrowser.Common.Net /// <returns>Equality result.</returns> public virtual bool Equals(IPObject? other) { - if (other != null) + if (other is not null) { return !Address.Equals(IPAddress.None) && Address.Equals(other.Address); } diff --git a/MediaBrowser.Common/Net/NetworkExtensions.cs b/MediaBrowser.Common/Net/NetworkExtensions.cs index 7ad005854..5e5e5b81b 100644 --- a/MediaBrowser.Common/Net/NetworkExtensions.cs +++ b/MediaBrowser.Common/Net/NetworkExtensions.cs @@ -114,7 +114,7 @@ namespace MediaBrowser.Common.Net /// <returns>True if both are equal.</returns> public static bool Compare(this Collection<IPObject> source, Collection<IPObject> dest) { - if (dest == null || source.Count != dest.Count) + if (dest is null || source.Count != dest.Count) { return false; } @@ -187,7 +187,7 @@ namespace MediaBrowser.Common.Net /// <returns>A new collection, with the items excluded.</returns> public static Collection<IPObject> Exclude(this Collection<IPObject> source, Collection<IPObject> excludeList, bool isNetwork) { - if (source.Count == 0 || excludeList == null) + if (source.Count == 0 || excludeList is null) { return new Collection<IPObject>(source); } diff --git a/MediaBrowser.Common/Plugins/BasePluginOfT.cs b/MediaBrowser.Common/Plugins/BasePluginOfT.cs index 0da5592d3..152fa8b4a 100644 --- a/MediaBrowser.Common/Plugins/BasePluginOfT.cs +++ b/MediaBrowser.Common/Plugins/BasePluginOfT.cs @@ -47,7 +47,7 @@ namespace MediaBrowser.Common.Plugins var assemblyFilePath = assembly.Location; var dataFolderPath = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(assemblyFilePath)); - if (Version != null && !Directory.Exists(dataFolderPath)) + if (Version is not null && !Directory.Exists(dataFolderPath)) { // Try again with the version number appended to the folder name. dataFolderPath += "_" + Version.ToString(); @@ -103,7 +103,7 @@ namespace MediaBrowser.Common.Plugins get { // Lazy load - if (_configuration == null) + if (_configuration is null) { lock (_configurationSyncLock) { diff --git a/MediaBrowser.Common/Plugins/LocalPlugin.cs b/MediaBrowser.Common/Plugins/LocalPlugin.cs index 4c8e2d504..96af423cc 100644 --- a/MediaBrowser.Common/Plugins/LocalPlugin.cs +++ b/MediaBrowser.Common/Plugins/LocalPlugin.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Common.Plugins { get { - if (_version == null) + if (_version is null) { _version = Version.Parse(Manifest.Version); } @@ -85,9 +85,9 @@ namespace MediaBrowser.Common.Plugins /// <returns>Comparison result.</returns> public static int Compare(LocalPlugin a, LocalPlugin b) { - if (a == null || b == null) + if (a is null || b is null) { - throw new ArgumentNullException(a == null ? nameof(a) : nameof(b)); + throw new ArgumentNullException(a is null ? nameof(a) : nameof(b)); } var compare = string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase); @@ -128,7 +128,7 @@ namespace MediaBrowser.Common.Plugins /// <inheritdoc /> public bool Equals(LocalPlugin? other) { - if (other == null) + if (other is null) { return false; } |
