diff options
120 files changed, 267 insertions, 748 deletions
diff --git a/.ci/azure-pipelines-abi.yml b/.ci/azure-pipelines-abi.yml index cf74a4201..4b82eedb4 100644 --- a/.ci/azure-pipelines-abi.yml +++ b/.ci/azure-pipelines-abi.yml @@ -7,7 +7,7 @@ parameters: default: "ubuntu-latest" - name: DotNetSdkVersion type: string - default: 6.0.x + default: 7.0.x jobs: - job: CompatibilityCheck diff --git a/.ci/azure-pipelines-main.yml b/.ci/azure-pipelines-main.yml index b7112ba24..020d7fff4 100644 --- a/.ci/azure-pipelines-main.yml +++ b/.ci/azure-pipelines-main.yml @@ -1,7 +1,7 @@ parameters: LinuxImage: 'ubuntu-latest' RestoreBuildProjects: 'Jellyfin.Server/Jellyfin.Server.csproj' - DotNetSdkVersion: 6.0.x + DotNetSdkVersion: 7.0.x jobs: - job: Build @@ -20,35 +20,6 @@ jobs: submodules: true persistCredentials: true - - task: DownloadPipelineArtifact@2 - displayName: 'Download Web Branch' - condition: in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'BuildCompletion') - inputs: - path: '$(Agent.TempDirectory)' - artifact: 'jellyfin-web-production' - source: 'specific' - project: 'jellyfin' - pipeline: 'Jellyfin Web' - runBranch: variables['Build.SourceBranch'] - - - task: DownloadPipelineArtifact@2 - displayName: 'Download Web Target' - condition: eq(variables['Build.Reason'], 'PullRequest') - inputs: - path: '$(Agent.TempDirectory)' - artifact: 'jellyfin-web-production' - source: 'specific' - project: 'jellyfin' - pipeline: 'Jellyfin Web' - runBranch: variables['System.PullRequest.TargetBranch'] - - - task: ExtractFiles@1 - displayName: 'Extract Web Client' - inputs: - archiveFilePatterns: '$(Agent.TempDirectory)/*.zip' - destinationFolder: '$(Build.SourcesDirectory)/MediaBrowser.WebDashboard' - cleanDestinationFolder: false - - task: UseDotNet@2 displayName: 'Update DotNet' inputs: diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index 926d1d322..83504fefe 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -205,10 +205,10 @@ jobs: steps: - task: UseDotNet@2 - displayName: 'Use .NET 6.0 sdk' + displayName: 'Use .NET 7.0 sdk' inputs: packageType: 'sdk' - version: '6.0.x' + version: '7.0.x' - task: DotNetCoreCLI@2 displayName: 'Build Stable Nuget packages' diff --git a/.ci/azure-pipelines-test.yml b/.ci/azure-pipelines-test.yml index cc94dc2c5..81362aab2 100644 --- a/.ci/azure-pipelines-test.yml +++ b/.ci/azure-pipelines-test.yml @@ -10,7 +10,7 @@ parameters: default: "tests/**/*Tests.csproj" - name: DotNetSdkVersion type: string - default: 6.0.x + default: 7.0.x jobs: - job: Test @@ -94,5 +94,5 @@ jobs: displayName: 'Publish OpenAPI Artifact' condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) inputs: - targetPath: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json" + targetPath: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json" artifactName: 'OpenAPI Spec' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 677bfc3df..f385aecb6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,10 +21,10 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3 - - name: Setup .NET Core + - name: Setup .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3 with: - dotnet-version: '6.0.x' + dotnet-version: '7.0.x' - name: Initialize CodeQL uses: github/codeql-action/init@b2a92eb56d8cb930006a1c6ed86b0782dd8a4297 # v2 diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml index a82579f1b..d7ace118b 100644 --- a/.github/workflows/openapi.yml +++ b/.github/workflows/openapi.yml @@ -18,10 +18,10 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Setup .NET Core + - name: Setup .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3 with: - dotnet-version: '6.0.x' + dotnet-version: '7.0.x' - name: Generate openapi.json run: dotnet test tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj -c Release --filter "Jellyfin.Server.Integration.Tests.OpenApiSpecTests" - name: Upload openapi.json @@ -30,7 +30,7 @@ jobs: name: openapi-head retention-days: 14 if-no-files-found: error - path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json + path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json openapi-base: name: OpenAPI - BASE @@ -42,10 +42,10 @@ jobs: uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3 with: ref: ${{ github.base_ref }} - - name: Setup .NET Core + - name: Setup .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3 with: - dotnet-version: '6.0.x' + dotnet-version: '7.0.x' - name: Generate openapi.json run: dotnet test tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj -c Release --filter "Jellyfin.Server.Integration.Tests.OpenApiSpecTests" - name: Upload openapi.json @@ -54,7 +54,7 @@ jobs: name: openapi-base retention-days: 14 if-no-files-found: error - path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json + path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json openapi-diff: permissions: diff --git a/.gitignore b/.gitignore index fd8e1f314..d5a0367bf 100644 --- a/.gitignore +++ b/.gitignore @@ -273,7 +273,6 @@ BenchmarkDotNet.Artifacts # Ignore web artifacts from native builds web/ web-src.* -MediaBrowser.WebDashboard/jellyfin-web apiclient/generated # Omnisharp crash logs diff --git a/.vscode/launch.json b/.vscode/launch.json index b82956a72..55e6508a9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,11 +2,11 @@ "version": "0.2.0", "configurations": [ { - "name": ".NET Core Launch (console)", + "name": ".NET Launch (console)", "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net6.0/jellyfin.dll", + "program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net7.0/jellyfin.dll", "args": [], "cwd": "${workspaceFolder}/Jellyfin.Server", "console": "internalConsole", @@ -18,11 +18,11 @@ } }, { - "name": ".NET Core Launch (nowebclient)", + "name": ".NET Launch (nowebclient)", "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net6.0/jellyfin.dll", + "program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net7.0/jellyfin.dll", "args": ["--nowebclient"], "cwd": "${workspaceFolder}/Jellyfin.Server", "console": "internalConsole", @@ -30,7 +30,7 @@ "internalConsoleOptions": "openOnSessionStart" }, { - "name": ".NET Core Attach", + "name": ".NET Attach", "type": "coreclr", "request": "attach", "processId": "${command:pickProcess}" diff --git a/DvdLib/DvdLib.csproj b/DvdLib/DvdLib.csproj index 755d29160..1053c0089 100644 --- a/DvdLib/DvdLib.csproj +++ b/DvdLib/DvdLib.csproj @@ -10,7 +10,7 @@ </ItemGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> <AnalysisMode>AllDisabledByDefault</AnalysisMode> diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs index b1ee43305..99b3e6e7e 100644 --- a/Emby.Dlna/DlnaManager.cs +++ b/Emby.Dlna/DlnaManager.cs @@ -199,6 +199,11 @@ namespace Emby.Dlna if (headers.TryGetValue(header.Name, out StringValues value)) { + if (StringValues.IsNullOrEmpty(value)) + { + return false; + } + switch (header.Match) { case HeaderMatchType.Equals: @@ -208,7 +213,8 @@ namespace Emby.Dlna // _logger.LogDebug("IsMatch-Substring value: {0} testValue: {1} isMatch: {2}", value, header.Value, isMatch); return isMatch; case HeaderMatchType.Regex: - return Regex.IsMatch(value, header.Value, RegexOptions.IgnoreCase); + // Can't be null, we checked above the switch statement + return Regex.IsMatch(value!, header.Value, RegexOptions.IgnoreCase); default: throw new ArgumentException("Unrecognized HeaderMatchType"); } @@ -265,10 +271,7 @@ namespace Emby.Dlna /// <inheritdoc /> public DeviceProfile? GetProfile(string id) { - if (string.IsNullOrEmpty(id)) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentException.ThrowIfNullOrEmpty(id); var info = GetProfileInfosInternal().FirstOrDefault(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase)); @@ -371,10 +374,7 @@ namespace Emby.Dlna { profile = ReserializeProfile(profile); - if (string.IsNullOrEmpty(profile.Name)) - { - throw new ArgumentException("Profile is missing Name"); - } + ArgumentException.ThrowIfNullOrEmpty(profile.Name); var newFilename = _fileSystem.GetValidFilename(profile.Name) + ".xml"; var path = Path.Combine(UserProfilesPath, newFilename); @@ -387,15 +387,9 @@ namespace Emby.Dlna { profile = ReserializeProfile(profile); - if (string.IsNullOrEmpty(profile.Id)) - { - throw new ArgumentException("Profile is missing Id"); - } + ArgumentException.ThrowIfNullOrEmpty(profile.Id); - if (string.IsNullOrEmpty(profile.Name)) - { - throw new ArgumentException("Profile is missing Name"); - } + ArgumentException.ThrowIfNullOrEmpty(profile.Name); var current = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, profileId, StringComparison.OrdinalIgnoreCase)); if (current.Info.Type == DeviceProfileType.System) diff --git a/Emby.Dlna/Emby.Dlna.csproj b/Emby.Dlna/Emby.Dlna.csproj index 66aded3b4..7ffb7118a 100644 --- a/Emby.Dlna/Emby.Dlna.csproj +++ b/Emby.Dlna/Emby.Dlna.csproj @@ -17,7 +17,7 @@ </ItemGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> @@ -80,7 +80,7 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" /> + <PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" /> </ItemGroup> </Project> diff --git a/Emby.Dlna/IDlnaEventManager.cs b/Emby.Dlna/IDlnaEventManager.cs index eea030d6d..bb1eeb963 100644 --- a/Emby.Dlna/IDlnaEventManager.cs +++ b/Emby.Dlna/IDlnaEventManager.cs @@ -1,3 +1,4 @@ +#nullable disable #pragma warning disable CS1591 namespace Emby.Dlna diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs index fc000334a..9c476119d 100644 --- a/Emby.Dlna/PlayTo/Device.cs +++ b/Emby.Dlna/PlayTo/Device.cs @@ -1017,10 +1017,7 @@ namespace Emby.Dlna.PlayTo } var avService = GetServiceRenderingControl(); - if (avService is null) - { - throw new ArgumentException("Device AvService is null"); - } + ArgumentNullException.ThrowIfNull(avService); string url = NormalizeUrl(Properties.BaseUrl, avService.ScpdUrl); diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index d46a501c7..4cda1d8b7 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -936,10 +936,7 @@ namespace Emby.Dlna.PlayTo private static Guid GetItemId(string url) { - if (string.IsNullOrEmpty(url)) - { - throw new ArgumentNullException(nameof(url)); - } + ArgumentException.ThrowIfNullOrEmpty(url); var parts = url.Split('/'); @@ -962,10 +959,7 @@ namespace Emby.Dlna.PlayTo public static StreamParams ParseFromUrl(string url, ILibraryManager libraryManager, IMediaSourceManager mediaSourceManager) { - if (string.IsNullOrEmpty(url)) - { - throw new ArgumentNullException(nameof(url)); - } + ArgumentException.ThrowIfNullOrEmpty(url); var request = new StreamParams { diff --git a/Emby.Dlna/Server/DescriptionXmlBuilder.cs b/Emby.Dlna/Server/DescriptionXmlBuilder.cs index 8adaaea77..d00df781d 100644 --- a/Emby.Dlna/Server/DescriptionXmlBuilder.cs +++ b/Emby.Dlna/Server/DescriptionXmlBuilder.cs @@ -22,15 +22,8 @@ namespace Emby.Dlna.Server public DescriptionXmlBuilder(DeviceProfile profile, string serverUdn, string serverAddress, string serverName, string serverId) { - if (string.IsNullOrEmpty(serverUdn)) - { - throw new ArgumentNullException(nameof(serverUdn)); - } - - if (string.IsNullOrEmpty(serverAddress)) - { - throw new ArgumentNullException(nameof(serverAddress)); - } + ArgumentException.ThrowIfNullOrEmpty(serverUdn); + ArgumentException.ThrowIfNullOrEmpty(serverAddress); _profile = profile; _serverUdn = serverUdn; diff --git a/Emby.Dlna/Service/BaseService.cs b/Emby.Dlna/Service/BaseService.cs index 68fd98758..67e7bf6a6 100644 --- a/Emby.Dlna/Service/BaseService.cs +++ b/Emby.Dlna/Service/BaseService.cs @@ -1,3 +1,4 @@ +#nullable disable #pragma warning disable CS1591 using System.Net.Http; diff --git a/Emby.Drawing/Emby.Drawing.csproj b/Emby.Drawing/Emby.Drawing.csproj index 177172e8a..5bf226408 100644 --- a/Emby.Drawing/Emby.Drawing.csproj +++ b/Emby.Drawing/Emby.Drawing.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index d2c430415..5a49e876a 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -503,20 +503,9 @@ namespace Emby.Drawing /// </exception> public string GetCachePath(string path, string uniqueName, string fileExtension) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } - - if (string.IsNullOrEmpty(uniqueName)) - { - throw new ArgumentNullException(nameof(uniqueName)); - } - - if (string.IsNullOrEmpty(fileExtension)) - { - throw new ArgumentNullException(nameof(fileExtension)); - } + ArgumentException.ThrowIfNullOrEmpty(path); + ArgumentException.ThrowIfNullOrEmpty(uniqueName); + ArgumentException.ThrowIfNullOrEmpty(fileExtension); var filename = uniqueName.GetMD5() + fileExtension; diff --git a/Emby.Naming/Emby.Naming.csproj b/Emby.Naming/Emby.Naming.csproj index fbf0e1cec..80bc57a5d 100644 --- a/Emby.Naming/Emby.Naming.csproj +++ b/Emby.Naming/Emby.Naming.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> <PublishRepositoryUrl>true</PublishRepositoryUrl> diff --git a/Emby.Notifications/Emby.Notifications.csproj b/Emby.Notifications/Emby.Notifications.csproj index b797a5194..138965c89 100644 --- a/Emby.Notifications/Emby.Notifications.csproj +++ b/Emby.Notifications/Emby.Notifications.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> diff --git a/Emby.Photos/Emby.Photos.csproj b/Emby.Photos/Emby.Photos.csproj index e1688dc6e..34bc8f32f 100644 --- a/Emby.Photos/Emby.Photos.csproj +++ b/Emby.Photos/Emby.Photos.csproj @@ -19,7 +19,7 @@ </ItemGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index a961c09e8..85ccbc028 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -601,10 +601,7 @@ namespace Emby.Server.Implementations.Channels private Guid GetInternalChannelId(string name) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } + ArgumentException.ThrowIfNullOrEmpty(name); return _libraryManager.GetNewItemId("Channel " + name, typeof(Channel)); } diff --git a/Emby.Server.Implementations/ConfigurationOptions.cs b/Emby.Server.Implementations/ConfigurationOptions.cs index 01dc728c1..f0a4c8ffb 100644 --- a/Emby.Server.Implementations/ConfigurationOptions.cs +++ b/Emby.Server.Implementations/ConfigurationOptions.cs @@ -11,7 +11,7 @@ namespace Emby.Server.Implementations /// <summary> /// Gets a new copy of the default configuration options. /// </summary> - public static Dictionary<string, string> DefaultConfiguration => new Dictionary<string, string> + public static Dictionary<string, string?> DefaultConfiguration => new Dictionary<string, string?> { { HostWebClientKey, bool.TrueString }, { DefaultRedirectKey, "web/index.html" }, diff --git a/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs b/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs index e9c005cea..5380c45d8 100644 --- a/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs +++ b/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs @@ -2,8 +2,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Security.Cryptography; -using System.Text; -using MediaBrowser.Common.Extensions; using MediaBrowser.Model.Cryptography; using static MediaBrowser.Model.Cryptography.Constants; @@ -14,25 +12,6 @@ namespace Emby.Server.Implementations.Cryptography /// </summary> public class CryptographyProvider : ICryptoProvider { - // TODO: remove when not needed for backwards compat - private static readonly HashSet<string> _supportedHashMethods = new HashSet<string>() - { - "MD5", - "System.Security.Cryptography.MD5", - "SHA", - "SHA1", - "System.Security.Cryptography.SHA1", - "SHA256", - "SHA-256", - "System.Security.Cryptography.SHA256", - "SHA384", - "SHA-384", - "System.Security.Cryptography.SHA384", - "SHA512", - "SHA-512", - "System.Security.Cryptography.SHA512" - }; - /// <inheritdoc /> public string DefaultHashMethod => "PBKDF2-SHA512"; @@ -80,22 +59,7 @@ namespace Emby.Server.Implementations.Cryptography DefaultOutputLength)); } - if (!_supportedHashMethods.Contains(hash.Id)) - { - throw new CryptographicException($"Requested hash method is not supported: {hash.Id}"); - } - - using var h = HashAlgorithm.Create(hash.Id) ?? throw new ResourceNotFoundException($"Unknown hash method: {hash.Id}."); - var bytes = Encoding.UTF8.GetBytes(password.ToArray()); - if (hash.Salt.Length == 0) - { - return hash.Hash.SequenceEqual(h.ComputeHash(bytes)); - } - - byte[] salted = new byte[bytes.Length + hash.Salt.Length]; - Array.Copy(bytes, salted, bytes.Length); - hash.Salt.CopyTo(salted.AsSpan(bytes.Length)); - return hash.Hash.SequenceEqual(h.ComputeHash(salted)); + throw new NotSupportedException($"Can't verify hash with id: {hash.Id}"); } /// <inheritdoc /> diff --git a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs index 8d78d644d..5f2c3c9dc 100644 --- a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs @@ -140,10 +140,7 @@ namespace Emby.Server.Implementations.Data throw new ArgumentNullException(nameof(userId)); } - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException(nameof(key)); - } + ArgumentException.ThrowIfNullOrEmpty(key); PersistUserData(userId, key, userData, cancellationToken); } @@ -274,10 +271,7 @@ namespace Emby.Server.Implementations.Data throw new ArgumentNullException(nameof(userId)); } - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException(nameof(key)); - } + ArgumentException.ThrowIfNullOrEmpty(key); using (var connection = GetConnection(true)) { diff --git a/Emby.Server.Implementations/Data/TypeMapper.cs b/Emby.Server.Implementations/Data/TypeMapper.cs index 4202915ec..9efcea842 100644 --- a/Emby.Server.Implementations/Data/TypeMapper.cs +++ b/Emby.Server.Implementations/Data/TypeMapper.cs @@ -23,10 +23,7 @@ namespace Emby.Server.Implementations.Data /// <exception cref="ArgumentNullException"><c>typeName</c> is null.</exception> public Type? GetType(string typeName) { - if (string.IsNullOrEmpty(typeName)) - { - throw new ArgumentNullException(nameof(typeName)); - } + ArgumentException.ThrowIfNullOrEmpty(typeName); return _typeMap.GetOrAdd(typeName, k => AppDomain.CurrentDomain.GetAssemblies() .Select(a => a.GetType(k)) diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index de756e1e3..e3d430c69 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -25,11 +25,11 @@ <ItemGroup> <PackageReference Include="DiscUtils.Udf" Version="0.16.13" /> <PackageReference Include="Jellyfin.XmlTv" Version="10.8.0" /> - <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" /> - <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" /> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" /> - <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.11" /> + <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" /> <PackageReference Include="Mono.Nat" Version="3.0.4" /> <PackageReference Include="prometheus-net.DotNetRuntime" Version="4.4.0" /> <PackageReference Include="SQLitePCL.pretty.netstandard" Version="3.1.0" /> @@ -41,7 +41,7 @@ </ItemGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> <!-- https://github.com/microsoft/ApplicationInsights-dotnet/issues/2047 --> diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs index 534ca7b6c..ec8590929 100644 --- a/Emby.Server.Implementations/IO/FileRefresher.cs +++ b/Emby.Server.Implementations/IO/FileRefresher.cs @@ -40,10 +40,7 @@ namespace Emby.Server.Implementations.IO private void AddAffectedPath(string path) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); if (!_affectedPaths.Contains(path, StringComparer.Ordinal)) { @@ -53,10 +50,7 @@ namespace Emby.Server.Implementations.IO public void AddPath(string path) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); lock (_timerLock) { diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs index e88346771..4b999d40b 100644 --- a/Emby.Server.Implementations/IO/LibraryMonitor.cs +++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs @@ -71,20 +71,14 @@ namespace Emby.Server.Implementations.IO public void ReportFileSystemChangeBeginning(string path) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); TemporarilyIgnore(path); } public async void ReportFileSystemChangeComplete(string path, bool refreshPath) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); // This is an arbitrary amount of time, but delay it because file system writes often trigger events long after the file was actually written to. // Seeing long delays in some situations, especially over the network, sometimes up to 45 seconds @@ -197,10 +191,7 @@ namespace Emby.Server.Implementations.IO /// <exception cref="ArgumentNullException"><paramref name="path"/> is <c>null</c>.</exception> private static bool ContainsParentFolder(IEnumerable<string> lst, string path) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); path = path.TrimEnd(Path.DirectorySeparatorChar); @@ -356,10 +347,7 @@ namespace Emby.Server.Implementations.IO public void ReportFileSystemChanged(string path) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); var monitorPath = !IgnorePatterns.ShouldIgnore(path); diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index cdb301094..55f384ae8 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -48,10 +48,7 @@ namespace Emby.Server.Implementations.IO /// <exception cref="ArgumentNullException"><paramref name="filename"/> is <c>null</c>.</exception> public virtual bool IsShortcut(string filename) { - if (string.IsNullOrEmpty(filename)) - { - throw new ArgumentNullException(nameof(filename)); - } + ArgumentException.ThrowIfNullOrEmpty(filename); var extension = Path.GetExtension(filename); return _shortcutHandlers.Any(i => string.Equals(extension, i.Extension, StringComparison.OrdinalIgnoreCase)); @@ -65,10 +62,7 @@ namespace Emby.Server.Implementations.IO /// <exception cref="ArgumentNullException"><paramref name="filename"/> is <c>null</c>.</exception> public virtual string? ResolveShortcut(string filename) { - if (string.IsNullOrEmpty(filename)) - { - throw new ArgumentNullException(nameof(filename)); - } + ArgumentException.ThrowIfNullOrEmpty(filename); var extension = Path.GetExtension(filename); var handler = _shortcutHandlers.Find(i => string.Equals(extension, i.Extension, StringComparison.OrdinalIgnoreCase)); @@ -136,15 +130,8 @@ namespace Emby.Server.Implementations.IO /// <exception cref="ArgumentNullException">The shortcutPath or target is null.</exception> public virtual void CreateShortcut(string shortcutPath, string target) { - if (string.IsNullOrEmpty(shortcutPath)) - { - throw new ArgumentNullException(nameof(shortcutPath)); - } - - if (string.IsNullOrEmpty(target)) - { - throw new ArgumentNullException(nameof(target)); - } + ArgumentException.ThrowIfNullOrEmpty(shortcutPath); + ArgumentException.ThrowIfNullOrEmpty(target); var extension = Path.GetExtension(shortcutPath); var handler = _shortcutHandlers.Find(i => string.Equals(extension, i.Extension, StringComparison.OrdinalIgnoreCase)); @@ -488,15 +475,8 @@ namespace Emby.Server.Implementations.IO /// <param name="file2">The file2.</param> public virtual void SwapFiles(string file1, string file2) { - if (string.IsNullOrEmpty(file1)) - { - throw new ArgumentNullException(nameof(file1)); - } - - if (string.IsNullOrEmpty(file2)) - { - throw new ArgumentNullException(nameof(file2)); - } + ArgumentException.ThrowIfNullOrEmpty(file1); + ArgumentException.ThrowIfNullOrEmpty(file2); var temp1 = Path.Combine(_tempPath, Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture)); @@ -514,15 +494,8 @@ namespace Emby.Server.Implementations.IO /// <inheritdoc /> public virtual bool ContainsSubPath(string parentPath, string path) { - if (string.IsNullOrEmpty(parentPath)) - { - throw new ArgumentNullException(nameof(parentPath)); - } - - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(parentPath); + ArgumentException.ThrowIfNullOrEmpty(path); return path.Contains( Path.TrimEndingDirectorySeparator(parentPath) + Path.DirectorySeparatorChar, @@ -532,10 +505,7 @@ namespace Emby.Server.Implementations.IO /// <inheritdoc /> public virtual string NormalizePath(string path) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); if (path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase)) { diff --git a/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs b/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs index 76c58d5dc..c2aab3879 100644 --- a/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs +++ b/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs @@ -19,10 +19,7 @@ namespace Emby.Server.Implementations.IO public string? Resolve(string shortcutPath) { - if (string.IsNullOrEmpty(shortcutPath)) - { - throw new ArgumentException("Shortcut path is empty or null.", nameof(shortcutPath)); - } + ArgumentException.ThrowIfNullOrEmpty(shortcutPath); if (string.Equals(Path.GetExtension(shortcutPath), ".mblink", StringComparison.OrdinalIgnoreCase)) { @@ -36,15 +33,8 @@ namespace Emby.Server.Implementations.IO public void Create(string shortcutPath, string targetPath) { - if (string.IsNullOrEmpty(shortcutPath)) - { - throw new ArgumentNullException(nameof(shortcutPath)); - } - - if (string.IsNullOrEmpty(targetPath)) - { - throw new ArgumentNullException(nameof(targetPath)); - } + ArgumentException.ThrowIfNullOrEmpty(shortcutPath); + ArgumentException.ThrowIfNullOrEmpty(targetPath); File.WriteAllText(shortcutPath, targetPath); } diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 9ee8a630d..70439d258 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -495,11 +495,7 @@ namespace Emby.Server.Implementations.Library private Guid GetNewItemIdInternal(string key, Type type, bool forceCaseInsensitive) { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException(nameof(key)); - } - + ArgumentException.ThrowIfNullOrEmpty(key); ArgumentNullException.ThrowIfNull(type); string programDataPath = _configurationManager.ApplicationPaths.ProgramDataPath; @@ -818,10 +814,7 @@ namespace Emby.Server.Implementations.Library { // If this returns multiple items it could be tricky figuring out which one is correct. // In most cases, the newest one will be and the others obsolete but not yet cleaned up - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); var query = new InternalItemsQuery { @@ -2340,10 +2333,7 @@ namespace Emby.Server.Implementations.Library string sortName, string uniqueId) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } + ArgumentException.ThrowIfNullOrEmpty(name); var parentIdString = parentId.Equals(default) ? null @@ -3125,10 +3115,7 @@ namespace Emby.Server.Implementations.Library public void RemoveMediaPath(string virtualFolderName, string mediaPath) { - if (string.IsNullOrEmpty(mediaPath)) - { - throw new ArgumentNullException(nameof(mediaPath)); - } + ArgumentException.ThrowIfNullOrEmpty(mediaPath); var rootFolderPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath; var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName); diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs index 7fff6ab7b..eadfa5dfe 100644 --- a/Emby.Server.Implementations/Library/MediaSourceManager.cs +++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs @@ -762,10 +762,7 @@ namespace Emby.Server.Implementations.Library public Task<Tuple<MediaSourceInfo, IDirectStreamProvider>> GetLiveStreamWithDirectStreamProvider(string id, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(id)) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentException.ThrowIfNullOrEmpty(id); // TODO probably shouldn't throw here but it is kept for "backwards compatibility" var info = GetLiveStreamInfo(id) ?? throw new ResourceNotFoundException(); @@ -774,10 +771,7 @@ namespace Emby.Server.Implementations.Library public ILiveStream GetLiveStreamInfo(string id) { - if (string.IsNullOrEmpty(id)) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentException.ThrowIfNullOrEmpty(id); if (_openStreams.TryGetValue(id, out ILiveStream info)) { @@ -801,10 +795,7 @@ namespace Emby.Server.Implementations.Library public async Task CloseLiveStream(string id) { - if (string.IsNullOrEmpty(id)) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentException.ThrowIfNullOrEmpty(id); await _liveStreamSemaphore.WaitAsync().ConfigureAwait(false); @@ -835,10 +826,7 @@ namespace Emby.Server.Implementations.Library private (IMediaSourceProvider MediaSourceProvider, string KeyId) GetProvider(string key) { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentException("Key can't be empty.", nameof(key)); - } + ArgumentException.ThrowIfNullOrEmpty(key); var keys = key.Split(LiveStreamIdDelimeter, 2); diff --git a/Emby.Server.Implementations/Library/ResolverHelper.cs b/Emby.Server.Implementations/Library/ResolverHelper.cs index dedb56d67..7a61e2607 100644 --- a/Emby.Server.Implementations/Library/ResolverHelper.cs +++ b/Emby.Server.Implementations/Library/ResolverHelper.cs @@ -25,10 +25,7 @@ namespace Emby.Server.Implementations.Library public static bool SetInitialItemValues(BaseItem item, Folder? parent, ILibraryManager libraryManager, IDirectoryService directoryService) { // This version of the below method has no ItemResolveArgs, so we have to require the path already being set - if (string.IsNullOrEmpty(item.Path)) - { - throw new ArgumentException("Item must have a Path"); - } + ArgumentException.ThrowIfNullOrEmpty(item.Path); // If the resolver didn't specify this if (parent is not null) diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.cs index 60778a443..b916b9170 100644 --- a/Emby.Server.Implementations/Library/SearchEngine.cs +++ b/Emby.Server.Implementations/Library/SearchEngine.cs @@ -73,10 +73,7 @@ namespace Emby.Server.Implementations.Library { var searchTerm = query.SearchTerm; - if (string.IsNullOrEmpty(searchTerm)) - { - throw new ArgumentException("SearchTerm can't be empty.", nameof(query)); - } + ArgumentException.ThrowIfNullOrEmpty(searchTerm); searchTerm = searchTerm.Trim().RemoveDiacritics(); diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs index b1259de23..bf28f3b67 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs @@ -16,10 +16,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV /// <inheritdoc /> public override void Add(SeriesTimerInfo item) { - if (string.IsNullOrEmpty(item.Id)) - { - throw new ArgumentException("SeriesTimerInfo.Id cannot be null or empty."); - } + ArgumentException.ThrowIfNullOrEmpty(item.Id); base.Add(item); } diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs index 1dfdfe84d..9f8441fa4 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs @@ -74,10 +74,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public override void Add(TimerInfo item) { - if (string.IsNullOrEmpty(item.Id)) - { - throw new ArgumentException("TimerInfo.Id cannot be null or empty."); - } + ArgumentException.ThrowIfNullOrEmpty(item.Id); base.Add(item); AddOrUpdateSystemTimer(item); diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 7db7ac576..3f7914d3b 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -74,10 +74,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(channelId)) - { - throw new ArgumentNullException(nameof(channelId)); - } + ArgumentException.ThrowIfNullOrEmpty(channelId); // Normalize incoming input channelId = channelId.Replace(".json.schedulesdirect.org", string.Empty, StringComparison.OrdinalIgnoreCase).TrimStart('I'); @@ -670,15 +667,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings { var token = await GetToken(info, cancellationToken).ConfigureAwait(false); - if (string.IsNullOrEmpty(token)) - { - throw new ArgumentException("Authentication required."); - } - - if (string.IsNullOrEmpty(info.ListingsId)) - { - throw new ArgumentException("Listings Id required"); - } + ArgumentException.ThrowIfNullOrEmpty(token); + ArgumentException.ThrowIfNullOrEmpty(info.ListingsId); _logger.LogInformation("Adding new LineUp "); @@ -689,17 +679,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings private async Task<bool> HasLineup(ListingsProviderInfo info, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(info.ListingsId)) - { - throw new ArgumentException("Listings Id required"); - } + ArgumentException.ThrowIfNullOrEmpty(info.ListingsId); var token = await GetToken(info, cancellationToken).ConfigureAwait(false); - if (string.IsNullOrEmpty(token)) - { - throw new ArgumentException("token required"); - } + ArgumentException.ThrowIfNullOrEmpty(token); _logger.LogInformation("Headends on account "); @@ -732,23 +716,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings { if (validateLogin) { - if (string.IsNullOrEmpty(info.Username)) - { - throw new ArgumentException("Username is required"); - } - - if (string.IsNullOrEmpty(info.Password)) - { - throw new ArgumentException("Password is required"); - } + ArgumentException.ThrowIfNullOrEmpty(info.Username); + ArgumentException.ThrowIfNullOrEmpty(info.Password); } if (validateListings) { - if (string.IsNullOrEmpty(info.ListingsId)) - { - throw new ArgumentException("Listings Id required"); - } + ArgumentException.ThrowIfNullOrEmpty(info.ListingsId); var hasLineup = await HasLineup(info, CancellationToken.None).ConfigureAwait(false); @@ -767,17 +741,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings public async Task<List<ChannelInfo>> GetChannels(ListingsProviderInfo info, CancellationToken cancellationToken) { var listingsId = info.ListingsId; - if (string.IsNullOrEmpty(listingsId)) - { - throw new ArgumentException("ListingsId required"); - } + ArgumentException.ThrowIfNullOrEmpty(listingsId); var token = await GetToken(info, cancellationToken).ConfigureAwait(false); - if (string.IsNullOrEmpty(token)) - { - throw new ArgumentException("token required"); - } + ArgumentException.ThrowIfNullOrEmpty(token); using var options = new HttpRequestMessage(HttpMethod.Get, ApiUrl + "/lineups/" + listingsId); options.Headers.TryAddWithoutValidation("token", token); diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs index 2e1aef072..7b6c8b80a 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs @@ -131,10 +131,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts public async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(channelId)) - { - throw new ArgumentNullException(nameof(channelId)); - } + ArgumentException.ThrowIfNullOrEmpty(channelId); if (IsValidChannelId(channelId)) { @@ -166,10 +163,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts public async Task<ILiveStream> GetChannelStream(string channelId, string streamId, List<ILiveStream> currentLiveStreams, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(channelId)) - { - throw new ArgumentNullException(nameof(channelId)); - } + ArgumentException.ThrowIfNullOrEmpty(channelId); if (!IsValidChannelId(channelId)) { @@ -223,10 +217,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts protected virtual bool IsValidChannelId(string channelId) { - if (string.IsNullOrEmpty(channelId)) - { - throw new ArgumentNullException(nameof(channelId)); - } + ArgumentException.ThrowIfNullOrEmpty(channelId); return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase); } diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 8f15a155e..b418c7877 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -219,10 +219,7 @@ namespace Emby.Server.Implementations.Localization /// <inheritdoc /> public int? GetRatingLevel(string rating) { - if (string.IsNullOrEmpty(rating)) - { - throw new ArgumentNullException(nameof(rating)); - } + ArgumentException.ThrowIfNullOrEmpty(rating); if (_unratedValues.Contains(rating.AsSpan(), StringComparison.OrdinalIgnoreCase)) { @@ -295,10 +292,7 @@ namespace Emby.Server.Implementations.Localization private Dictionary<string, string> GetLocalizationDictionary(string culture) { - if (string.IsNullOrEmpty(culture)) - { - throw new ArgumentNullException(nameof(culture)); - } + ArgumentException.ThrowIfNullOrEmpty(culture); const string Prefix = "Core"; @@ -310,10 +304,7 @@ namespace Emby.Server.Implementations.Localization private async Task<Dictionary<string, string>> GetDictionary(string prefix, string culture, string baseFilename) { - if (string.IsNullOrEmpty(culture)) - { - throw new ArgumentNullException(nameof(culture)); - } + ArgumentException.ThrowIfNullOrEmpty(culture); var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs index 271c0bc4d..2717c392b 100644 --- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs +++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs @@ -502,15 +502,8 @@ namespace Emby.Server.Implementations.Playlists private static string MakeRelativePath(string folderPath, string fileAbsolutePath) { - if (string.IsNullOrEmpty(folderPath)) - { - throw new ArgumentException("Folder path was null or empty.", nameof(folderPath)); - } - - if (string.IsNullOrEmpty(fileAbsolutePath)) - { - throw new ArgumentException("File absolute path was null or empty.", nameof(fileAbsolutePath)); - } + ArgumentException.ThrowIfNullOrEmpty(folderPath); + ArgumentException.ThrowIfNullOrEmpty(fileAbsolutePath); if (!folderPath.EndsWith(Path.DirectorySeparatorChar)) { diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.cs index 39dc2135d..14e7c2269 100644 --- a/Emby.Server.Implementations/Plugins/PluginManager.cs +++ b/Emby.Server.Implementations/Plugins/PluginManager.cs @@ -210,10 +210,7 @@ namespace Emby.Server.Implementations.Plugins /// <param name="folder">Folder of the plugin.</param> public void ImportPluginFrom(string folder) { - if (string.IsNullOrEmpty(folder)) - { - throw new ArgumentNullException(nameof(folder)); - } + ArgumentException.ThrowIfNullOrEmpty(folder); // Load the plugin. var plugin = LoadManifest(folder); diff --git a/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs b/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs index 532c8d1e3..c4bda9637 100644 --- a/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs +++ b/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs @@ -71,25 +71,10 @@ namespace Emby.Server.Implementations.QuickConnect /// <inheritdoc/> public QuickConnectResult TryConnect(AuthorizationInfo authorizationInfo) { - if (string.IsNullOrEmpty(authorizationInfo.DeviceId)) - { - throw new ArgumentException(nameof(authorizationInfo.DeviceId) + " is required"); - } - - if (string.IsNullOrEmpty(authorizationInfo.Device)) - { - throw new ArgumentException(nameof(authorizationInfo.Device) + " is required"); - } - - if (string.IsNullOrEmpty(authorizationInfo.Client)) - { - throw new ArgumentException(nameof(authorizationInfo.Client) + " is required"); - } - - if (string.IsNullOrEmpty(authorizationInfo.Version)) - { - throw new ArgumentException(nameof(authorizationInfo.Version) + "is required"); - } + ArgumentException.ThrowIfNullOrEmpty(authorizationInfo.DeviceId); + ArgumentException.ThrowIfNullOrEmpty(authorizationInfo.Device); + ArgumentException.ThrowIfNullOrEmpty(authorizationInfo.Client); + ArgumentException.ThrowIfNullOrEmpty(authorizationInfo.Version); AssertActive(); ExpireRequests(); diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 2add9be80..2f60d01a9 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -264,20 +264,9 @@ namespace Emby.Server.Implementations.Session { CheckDisposed(); - if (string.IsNullOrEmpty(appName)) - { - throw new ArgumentNullException(nameof(appName)); - } - - if (string.IsNullOrEmpty(appVersion)) - { - throw new ArgumentNullException(nameof(appVersion)); - } - - if (string.IsNullOrEmpty(deviceId)) - { - throw new ArgumentNullException(nameof(deviceId)); - } + ArgumentException.ThrowIfNullOrEmpty(appName); + ArgumentException.ThrowIfNullOrEmpty(appVersion); + ArgumentException.ThrowIfNullOrEmpty(deviceId); var activityDate = DateTime.UtcNow; var session = await GetSessionInfo(appName, appVersion, deviceId, deviceName, remoteEndPoint, user).ConfigureAwait(false); @@ -478,10 +467,7 @@ namespace Emby.Server.Implementations.Session { CheckDisposed(); - if (string.IsNullOrEmpty(deviceId)) - { - throw new ArgumentNullException(nameof(deviceId)); - } + ArgumentException.ThrowIfNullOrEmpty(deviceId); var key = GetSessionKey(appName, deviceId); @@ -1571,10 +1557,7 @@ namespace Emby.Server.Implementations.Session { CheckDisposed(); - if (string.IsNullOrEmpty(accessToken)) - { - throw new ArgumentNullException(nameof(accessToken)); - } + ArgumentException.ThrowIfNullOrEmpty(accessToken); var existing = (await _deviceManager.GetDevices( new DeviceQuery @@ -1744,10 +1727,7 @@ namespace Emby.Server.Implementations.Session /// <inheritdoc /> public void ReportNowViewingItem(string sessionId, string itemId) { - if (string.IsNullOrEmpty(itemId)) - { - throw new ArgumentNullException(nameof(itemId)); - } + ArgumentException.ThrowIfNullOrEmpty(itemId); var item = _libraryManager.GetItemById(new Guid(itemId)); var session = GetSession(sessionId); diff --git a/Jellyfin.Api/Controllers/DisplayPreferencesController.cs b/Jellyfin.Api/Controllers/DisplayPreferencesController.cs index 14fd7eb3c..67cceb4a8 100644 --- a/Jellyfin.Api/Controllers/DisplayPreferencesController.cs +++ b/Jellyfin.Api/Controllers/DisplayPreferencesController.cs @@ -178,7 +178,7 @@ namespace Jellyfin.Api.Controllers foreach (var key in displayPreferences.CustomPrefs.Keys.Where(key => key.StartsWith("homesection", StringComparison.OrdinalIgnoreCase))) { - var order = int.Parse(key.AsSpan().Slice("homesection".Length), NumberStyles.Any, CultureInfo.InvariantCulture); + var order = int.Parse(key.AsSpan().Slice("homesection".Length), CultureInfo.InvariantCulture); if (!Enum.TryParse<HomeSectionType>(displayPreferences.CustomPrefs[key], true, out var type)) { type = order < 8 ? defaults[order] : HomeSectionType.None; diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs index 260b9536e..49342ad5c 100644 --- a/Jellyfin.Api/Controllers/ImageController.cs +++ b/Jellyfin.Api/Controllers/ImageController.cs @@ -28,6 +28,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; namespace Jellyfin.Api.Controllers @@ -2026,8 +2027,13 @@ namespace Jellyfin.Api.Controllers } var acceptParam = Request.Query[HeaderNames.Accept]; + if (StringValues.IsNullOrEmpty(acceptParam)) + { + return Array.Empty<ImageFormat>(); + } - var supportsWebP = SupportsFormat(supportedFormats, acceptParam, ImageFormat.Webp, false); + // Can't be null, checked above + var supportsWebP = SupportsFormat(supportedFormats, acceptParam!, ImageFormat.Webp, false); if (!supportsWebP) { @@ -2049,7 +2055,8 @@ namespace Jellyfin.Api.Controllers formats.Add(ImageFormat.Jpg); formats.Add(ImageFormat.Png); - if (SupportsFormat(supportedFormats, acceptParam, ImageFormat.Gif, true)) + // Can't be null, checked above + if (SupportsFormat(supportedFormats, acceptParam!, ImageFormat.Gif, true)) { formats.Add(ImageFormat.Gif); } diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 9218c3b5c..25f930135 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -294,10 +294,7 @@ namespace Jellyfin.Api.Controllers { var currentSession = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false); - if (command is null) - { - throw new ArgumentException("Request body may not be null"); - } + ArgumentNullException.ThrowIfNull(command); command.ControllingUserId = currentSession.UserId; diff --git a/Jellyfin.Api/Helpers/HlsHelpers.cs b/Jellyfin.Api/Helpers/HlsHelpers.cs index 0f6d2aef7..671107c1f 100644 --- a/Jellyfin.Api/Helpers/HlsHelpers.cs +++ b/Jellyfin.Api/Helpers/HlsHelpers.cs @@ -46,7 +46,7 @@ namespace Jellyfin.Api.Helpers while (!reader.EndOfStream) { - var line = await reader.ReadLineAsync().ConfigureAwait(false); + var line = await reader.ReadLineAsync(cancellationToken).ConfigureAwait(false); if (line is null) { // Nothing currently in buffer. diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.cs index 1decbcd92..d4fc9c020 100644 --- a/Jellyfin.Api/Helpers/StreamingHelpers.cs +++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs @@ -364,9 +364,9 @@ namespace Jellyfin.Api.Helpers /// </summary> /// <param name="queryString">The query string.</param> /// <returns>A <see cref="Dictionary{String,String}"/> containing the stream options.</returns> - private static Dictionary<string, string> ParseStreamOptions(IQueryCollection queryString) + private static Dictionary<string, string?> ParseStreamOptions(IQueryCollection queryString) { - Dictionary<string, string> streamOptions = new Dictionary<string, string>(); + Dictionary<string, string?> streamOptions = new Dictionary<string, string?>(); foreach (var param in queryString) { if (char.IsLower(param.Key[0])) diff --git a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs index cb3442ccb..77dd51860 100644 --- a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs +++ b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs @@ -136,10 +136,7 @@ namespace Jellyfin.Api.Helpers /// <exception cref="ArgumentNullException">Play session id is null.</exception> public void PingTranscodingJob(string playSessionId, bool? isUserPaused) { - if (string.IsNullOrEmpty(playSessionId)) - { - throw new ArgumentNullException(nameof(playSessionId)); - } + ArgumentException.ThrowIfNullOrEmpty(playSessionId); _logger.LogDebug("PingTranscodingJob PlaySessionId={0} isUsedPaused: {1}", playSessionId, isUserPaused); @@ -522,10 +519,7 @@ namespace Jellyfin.Api.Helpers } } - if (string.IsNullOrEmpty(_mediaEncoder.EncoderPath)) - { - throw new ArgumentException("FFmpeg path not set."); - } + ArgumentException.ThrowIfNullOrEmpty(_mediaEncoder.EncoderPath); // If subtitles get burned in fonts may need to be extracted from the media file if (state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode) diff --git a/Jellyfin.Api/Jellyfin.Api.csproj b/Jellyfin.Api/Jellyfin.Api.csproj index c44fdae78..0317a2f2b 100644 --- a/Jellyfin.Api/Jellyfin.Api.csproj +++ b/Jellyfin.Api/Jellyfin.Api.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateDocumentationFile>true</GenerateDocumentationFile> <!-- https://github.com/microsoft/ApplicationInsights-dotnet/issues/2047 --> <NoWarn>AD0001</NoWarn> @@ -17,8 +17,8 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.11" /> - <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" /> + <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> <PackageReference Include="Swashbuckle.AspNetCore.ReDoc" Version="6.4.0" /> </ItemGroup> diff --git a/Jellyfin.Data/Entities/ActivityLog.cs b/Jellyfin.Data/Entities/ActivityLog.cs index 1d1b86552..51dd0ffb8 100644 --- a/Jellyfin.Data/Entities/ActivityLog.cs +++ b/Jellyfin.Data/Entities/ActivityLog.cs @@ -20,15 +20,8 @@ namespace Jellyfin.Data.Entities /// <param name="userId">The user id.</param> public ActivityLog(string name, string type, Guid userId) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } - - if (string.IsNullOrEmpty(type)) - { - throw new ArgumentNullException(nameof(type)); - } + ArgumentException.ThrowIfNullOrEmpty(name); + ArgumentException.ThrowIfNullOrEmpty(type); Name = name; Type = type; diff --git a/Jellyfin.Data/Entities/Group.cs b/Jellyfin.Data/Entities/Group.cs index 14da0bb15..1be6f986a 100644 --- a/Jellyfin.Data/Entities/Group.cs +++ b/Jellyfin.Data/Entities/Group.cs @@ -18,10 +18,7 @@ namespace Jellyfin.Data.Entities /// <param name="name">The name of the group.</param> public Group(string name) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } + ArgumentException.ThrowIfNullOrEmpty(name); Name = name; Id = Guid.NewGuid(); diff --git a/Jellyfin.Data/Entities/Libraries/Artwork.cs b/Jellyfin.Data/Entities/Libraries/Artwork.cs index 923525fc5..fc3c1036f 100644 --- a/Jellyfin.Data/Entities/Libraries/Artwork.cs +++ b/Jellyfin.Data/Entities/Libraries/Artwork.cs @@ -18,10 +18,7 @@ namespace Jellyfin.Data.Entities.Libraries /// <param name="kind">The kind of art.</param> public Artwork(string path, ArtKind kind) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); Path = path; Kind = kind; diff --git a/Jellyfin.Data/Entities/Libraries/Chapter.cs b/Jellyfin.Data/Entities/Libraries/Chapter.cs index 3d81f713d..f068338f9 100644 --- a/Jellyfin.Data/Entities/Libraries/Chapter.cs +++ b/Jellyfin.Data/Entities/Libraries/Chapter.cs @@ -17,10 +17,7 @@ namespace Jellyfin.Data.Entities.Libraries /// <param name="startTime">The start time for this chapter.</param> public Chapter(string language, long startTime) { - if (string.IsNullOrEmpty(language)) - { - throw new ArgumentNullException(nameof(language)); - } + ArgumentException.ThrowIfNullOrEmpty(language); Language = language; StartTime = startTime; diff --git a/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs b/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs index d429a90c6..fa9276c66 100644 --- a/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs +++ b/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs @@ -18,15 +18,8 @@ namespace Jellyfin.Data.Entities.Libraries /// <param name="language">ISO-639-3 3-character language codes.</param> protected ItemMetadata(string title, string language) { - if (string.IsNullOrEmpty(title)) - { - throw new ArgumentNullException(nameof(title)); - } - - if (string.IsNullOrEmpty(language)) - { - throw new ArgumentNullException(nameof(language)); - } + ArgumentException.ThrowIfNullOrEmpty(title); + ArgumentException.ThrowIfNullOrEmpty(language); Title = title; Language = language; diff --git a/Jellyfin.Data/Entities/Libraries/MediaFile.cs b/Jellyfin.Data/Entities/Libraries/MediaFile.cs index 36e1e4777..7b5a3af64 100644 --- a/Jellyfin.Data/Entities/Libraries/MediaFile.cs +++ b/Jellyfin.Data/Entities/Libraries/MediaFile.cs @@ -19,10 +19,7 @@ namespace Jellyfin.Data.Entities.Libraries /// <param name="kind">The file kind.</param> public MediaFile(string path, MediaFileKind kind) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); Path = path; Kind = kind; diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs index b27196078..b38d6a4f1 100644 --- a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs +++ b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs @@ -16,10 +16,7 @@ namespace Jellyfin.Data.Entities.Libraries /// <param name="name">The name of the metadata provider.</param> public MetadataProvider(string name) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } + ArgumentException.ThrowIfNullOrEmpty(name); Name = name; } diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs index 44c198518..a198f53ba 100644 --- a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs +++ b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs @@ -17,10 +17,7 @@ namespace Jellyfin.Data.Entities.Libraries /// <param name="metadataProvider">The metadata provider.</param> public MetadataProviderId(string providerId, MetadataProvider metadataProvider) { - if (string.IsNullOrEmpty(providerId)) - { - throw new ArgumentNullException(nameof(providerId)); - } + ArgumentException.ThrowIfNullOrEmpty(providerId); ProviderId = providerId; MetadataProvider = metadataProvider; diff --git a/Jellyfin.Data/Entities/Libraries/Person.cs b/Jellyfin.Data/Entities/Libraries/Person.cs index 8b67d920d..90dc55b70 100644 --- a/Jellyfin.Data/Entities/Libraries/Person.cs +++ b/Jellyfin.Data/Entities/Libraries/Person.cs @@ -17,10 +17,7 @@ namespace Jellyfin.Data.Entities.Libraries /// <param name="name">The name of the person.</param> public Person(string name) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } + ArgumentException.ThrowIfNullOrEmpty(name); Name = name; DateAdded = DateTime.UtcNow; diff --git a/Jellyfin.Data/Entities/Libraries/Release.cs b/Jellyfin.Data/Entities/Libraries/Release.cs index d3d52bf5c..e68ab9105 100644 --- a/Jellyfin.Data/Entities/Libraries/Release.cs +++ b/Jellyfin.Data/Entities/Libraries/Release.cs @@ -17,10 +17,7 @@ namespace Jellyfin.Data.Entities.Libraries /// <param name="name">The name of this release.</param> public Release(string name) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } + ArgumentException.ThrowIfNullOrEmpty(name); Name = name; diff --git a/Jellyfin.Data/Entities/User.cs b/Jellyfin.Data/Entities/User.cs index 58d0510cd..eb59e70f3 100644 --- a/Jellyfin.Data/Entities/User.cs +++ b/Jellyfin.Data/Entities/User.cs @@ -29,20 +29,9 @@ namespace Jellyfin.Data.Entities /// <param name="passwordResetProviderId">The Id of the user's password reset provider.</param> public User(string username, string authenticationProviderId, string passwordResetProviderId) { - if (string.IsNullOrEmpty(username)) - { - throw new ArgumentNullException(nameof(username)); - } - - if (string.IsNullOrEmpty(authenticationProviderId)) - { - throw new ArgumentNullException(nameof(authenticationProviderId)); - } - - if (string.IsNullOrEmpty(passwordResetProviderId)) - { - throw new ArgumentNullException(nameof(passwordResetProviderId)); - } + ArgumentException.ThrowIfNullOrEmpty(username); + ArgumentException.ThrowIfNullOrEmpty(authenticationProviderId); + ArgumentException.ThrowIfNullOrEmpty(passwordResetProviderId); Username = username; AuthenticationProviderId = authenticationProviderId; diff --git a/Jellyfin.Data/Jellyfin.Data.csproj b/Jellyfin.Data/Jellyfin.Data.csproj index 47499e038..7fe6466d4 100644 --- a/Jellyfin.Data/Jellyfin.Data.csproj +++ b/Jellyfin.Data/Jellyfin.Data.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> <PublishRepositoryUrl>true</PublishRepositoryUrl> @@ -39,7 +39,7 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" /> + <PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" /> </ItemGroup> <ItemGroup> diff --git a/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj b/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj index 89de998ca..dac3d0a61 100644 --- a/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj +++ b/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> diff --git a/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/Jellyfin.Drawing.Skia/SkiaEncoder.cs index 309972599..9171c4d6e 100644 --- a/Jellyfin.Drawing.Skia/SkiaEncoder.cs +++ b/Jellyfin.Drawing.Skia/SkiaEncoder.cs @@ -145,12 +145,7 @@ namespace Jellyfin.Drawing.Skia /// <exception cref="SkiaCodecException">The file at the specified path could not be used to generate a codec.</exception> public string GetImageBlurHash(int xComp, int yComp, string path) { - ArgumentNullException.ThrowIfNull(path); - - if (path.Length == 0) - { - throw new ArgumentException("String can't be empty", nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); var extension = Path.GetExtension(path.AsSpan()).TrimStart('.'); if (!SupportedInputFormats.Contains(extension, StringComparison.OrdinalIgnoreCase)) @@ -389,15 +384,8 @@ namespace Jellyfin.Drawing.Skia /// <inheritdoc/> public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat outputFormat) { - if (inputPath.Length == 0) - { - throw new ArgumentException("String can't be empty.", nameof(inputPath)); - } - - if (outputPath.Length == 0) - { - throw new ArgumentException("String can't be empty.", nameof(outputPath)); - } + ArgumentException.ThrowIfNullOrEmpty(inputPath); + ArgumentException.ThrowIfNullOrEmpty(outputPath); var inputFormat = Path.GetExtension(inputPath.AsSpan()).TrimStart('.'); if (!SupportedInputFormats.Contains(inputFormat, StringComparison.OrdinalIgnoreCase)) diff --git a/Jellyfin.Networking/Jellyfin.Networking.csproj b/Jellyfin.Networking/Jellyfin.Networking.csproj index d05072152..975d1c8ce 100644 --- a/Jellyfin.Networking/Jellyfin.Networking.csproj +++ b/Jellyfin.Networking/Jellyfin.Networking.csproj @@ -1,6 +1,6 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> diff --git a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs index bbe33be38..15ac5c668 100644 --- a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs +++ b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs @@ -222,11 +222,7 @@ namespace Jellyfin.Server.Implementations.Devices public bool CanAccessDevice(User user, string deviceId) { ArgumentNullException.ThrowIfNull(user); - - if (string.IsNullOrEmpty(deviceId)) - { - throw new ArgumentNullException(nameof(deviceId)); - } + ArgumentException.ThrowIfNullOrEmpty(deviceId); if (user.HasPermission(PermissionKind.EnableAllDevices) || user.HasPermission(PermissionKind.IsAdministrator)) { diff --git a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj index ba5d6a312..d233c00a0 100644 --- a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj +++ b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> @@ -28,13 +28,13 @@ <ItemGroup> <PackageReference Include="EFCoreSecondLevelCacheInterceptor" Version="3.8.0" /> <PackageReference Include="System.Linq.Async" Version="6.0.1" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.11" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.11" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.11"> + <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> - <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.11"> + <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj index 4cb83cdf0..58b416480 100644 --- a/Jellyfin.Server/Jellyfin.Server.csproj +++ b/Jellyfin.Server/Jellyfin.Server.csproj @@ -8,7 +8,7 @@ <PropertyGroup> <AssemblyName>jellyfin</AssemblyName> <OutputType>Exe</OutputType> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <ServerGarbageCollection>false</ServerGarbageCollection> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> @@ -35,10 +35,10 @@ <ItemGroup> <PackageReference Include="CommandLineParser" Version="2.9.1" /> - <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" /> - <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" /> - <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.11" /> - <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="6.0.11" /> + <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="7.0.0" /> <PackageReference Include="prometheus-net" Version="7.0.0" /> <PackageReference Include="prometheus-net.AspNetCore" Version="7.0.0" /> <PackageReference Include="Serilog.AspNetCore" Version="4.1.0" /> diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 0b922f821..46f45b9ad 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Net; using System.Reflection; using System.Runtime.InteropServices; +using System.Runtime.Versioning; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -201,7 +202,7 @@ namespace Jellyfin.Server { await webHost.StartAsync(_tokenSource.Token).ConfigureAwait(false); - if (startupConfig.UseUnixSocket() && Environment.OSVersion.Platform == PlatformID.Unix) + if (!OperatingSystem.IsWindows() && startupConfig.UseUnixSocket()) { var socketPath = GetUnixSocketPath(startupConfig, appPaths); @@ -691,27 +692,15 @@ namespace Jellyfin.Server return socketPath; } + [UnsupportedOSPlatform("windows")] private static void SetUnixSocketPermissions(IConfiguration startupConfig, string socketPath) { var socketPerms = startupConfig.GetUnixSocketPermissions(); if (!string.IsNullOrEmpty(socketPerms)) { - #pragma warning disable SA1300 // Entrypoint is case sensitive. - [DllImport("libc")] - static extern int chmod(string pathname, int mode); - #pragma warning restore SA1300 - - var exitCode = chmod(socketPath, Convert.ToInt32(socketPerms, 8)); - - if (exitCode < 0) - { - _logger.LogError("Failed to set Kestrel unix socket permissions to {SocketPerms}, return code: {ExitCode}", socketPerms, exitCode); - } - else - { - _logger.LogInformation("Kestrel unix socket permissions set to {SocketPerms}", socketPerms); - } + File.SetUnixFileMode(socketPath, (UnixFileMode)Convert.ToInt32(socketPerms, 8)); + _logger.LogInformation("Kestrel unix socket permissions set to {SocketPerms}", socketPerms); } } } diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs index 0a6f9bd92..0d9f379e0 100644 --- a/Jellyfin.Server/StartupOptions.cs +++ b/Jellyfin.Server/StartupOptions.cs @@ -79,9 +79,9 @@ namespace Jellyfin.Server /// Gets the command line options as a dictionary that can be used in the .NET configuration system. /// </summary> /// <returns>The configuration dictionary.</returns> - public Dictionary<string, string> ConvertToConfig() + public Dictionary<string, string?> ConvertToConfig() { - var config = new Dictionary<string, string>(); + var config = new Dictionary<string, string?>(); if (NoWebClient) { diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index f058fba60..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> diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index b7934bc09..32fe1b3b0 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1755,10 +1755,7 @@ namespace MediaBrowser.Controller.Entities /// <exception cref="ArgumentNullException">Throws if name is null.</exception> public void AddStudio(string name) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } + ArgumentException.ThrowIfNullOrEmpty(name); var current = Studios; @@ -1791,10 +1788,7 @@ namespace MediaBrowser.Controller.Entities /// <exception cref="ArgumentNullException">Throwns if name is null.</exception> public void AddGenre(string name) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } + ArgumentException.ThrowIfNullOrEmpty(name); var genres = Genres; if (!genres.Contains(name, StringComparison.OrdinalIgnoreCase)) diff --git a/MediaBrowser.Controller/Entities/Extensions.cs b/MediaBrowser.Controller/Entities/Extensions.cs index d4a779390..3005bee0a 100644 --- a/MediaBrowser.Controller/Entities/Extensions.cs +++ b/MediaBrowser.Controller/Entities/Extensions.cs @@ -17,12 +17,7 @@ namespace MediaBrowser.Controller.Entities /// <param name="url">Trailer URL.</param> public static void AddTrailerUrl(this BaseItem item, string url) { - ArgumentNullException.ThrowIfNull(url); - - if (url.Length == 0) - { - throw new ArgumentException("String can't be empty", nameof(url)); - } + ArgumentException.ThrowIfNullOrEmpty(url); var current = item.RemoteTrailers.FirstOrDefault(i => string.Equals(i.Url, url, StringComparison.OrdinalIgnoreCase)); diff --git a/MediaBrowser.Controller/Entities/PeopleHelper.cs b/MediaBrowser.Controller/Entities/PeopleHelper.cs index 44c0e2539..7f8dc069c 100644 --- a/MediaBrowser.Controller/Entities/PeopleHelper.cs +++ b/MediaBrowser.Controller/Entities/PeopleHelper.cs @@ -12,11 +12,7 @@ namespace MediaBrowser.Controller.Entities public static void AddPerson(List<PersonInfo> people, PersonInfo person) { ArgumentNullException.ThrowIfNull(person); - - if (string.IsNullOrEmpty(person.Name)) - { - throw new ArgumentException("The person's name was empty or null.", nameof(person)); - } + ArgumentException.ThrowIfNullOrEmpty(person.Name); // Normalize if (string.Equals(person.Role, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase)) diff --git a/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs b/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs index 5a7110261..3b5e8ece7 100644 --- a/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs +++ b/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs @@ -73,7 +73,7 @@ namespace MediaBrowser.Controller.Extensions /// </summary> /// <param name="configuration">The configuration to read the setting from.</param> /// <returns>The FFmpeg probe size option.</returns> - public static string GetFFmpegProbeSize(this IConfiguration configuration) + public static string? GetFFmpegProbeSize(this IConfiguration configuration) => configuration[FfmpegProbeSizeKey]; /// <summary> @@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Extensions /// </summary> /// <param name="configuration">The configuration to read the setting from.</param> /// <returns>The FFmpeg analyze duration option.</returns> - public static string GetFFmpegAnalyzeDuration(this IConfiguration configuration) + public static string? GetFFmpegAnalyzeDuration(this IConfiguration configuration) => configuration[FfmpegAnalyzeDurationKey]; /// <summary> @@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Extensions /// </summary> /// <param name="configuration">The configuration to read the setting from.</param> /// <returns>The unix socket path.</returns> - public static string GetUnixSocketPath(this IConfiguration configuration) + public static string? GetUnixSocketPath(this IConfiguration configuration) => configuration[UnixSocketPathKey]; /// <summary> @@ -113,7 +113,7 @@ namespace MediaBrowser.Controller.Extensions /// </summary> /// <param name="configuration">The configuration to read the setting from.</param> /// <returns>The unix socket permissions.</returns> - public static string GetUnixSocketPermissions(this IConfiguration configuration) + public static string? GetUnixSocketPermissions(this IConfiguration configuration) => configuration[UnixSocketPermissionsKey]; } } diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index 71feae536..9f7a93ae2 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -35,10 +35,7 @@ namespace MediaBrowser.Controller.IO int flattenFolderDepth = 0, bool resolveShortcuts = true) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); ArgumentNullException.ThrowIfNull(args); diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 0424399c8..01986d303 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -171,10 +171,7 @@ namespace MediaBrowser.Controller.Library /// <exception cref="ArgumentNullException"><paramref name="path"/> is <c>null</c> or empty.</exception> public void AddAdditionalLocation(string path) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentException("The path was empty or null.", nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); AdditionalLocations ??= new List<string>(); AdditionalLocations.Add(path); @@ -190,10 +187,7 @@ namespace MediaBrowser.Controller.Library /// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c> or empty.</exception> public FileSystemMetadata GetFileSystemEntryByName(string name) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("The name was empty or null.", nameof(name)); - } + ArgumentException.ThrowIfNullOrEmpty(name); return GetFileSystemEntryByPath(System.IO.Path.Combine(Path, name)); } @@ -206,10 +200,7 @@ namespace MediaBrowser.Controller.Library /// <exception cref="ArgumentNullException">Throws if path is invalid.</exception> public FileSystemMetadata GetFileSystemEntryByPath(string path) { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentException("The path was empty or null.", nameof(path)); - } + ArgumentException.ThrowIfNullOrEmpty(path); foreach (var file in FileSystemChildren) { diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 62c17b48c..7e3d7a981 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -18,10 +18,10 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" /> - <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" /> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" /> - <PackageReference Include="System.Threading.Tasks.Dataflow" Version="6.0.0" /> + <PackageReference Include="System.Threading.Tasks.Dataflow" Version="7.0.0" /> </ItemGroup> <ItemGroup> @@ -35,7 +35,7 @@ </ItemGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> <PublishRepositoryUrl>true</PublishRepositoryUrl> diff --git a/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj b/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj index 33b082731..de3987b1e 100644 --- a/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj +++ b/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj @@ -11,7 +11,7 @@ </ItemGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> diff --git a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs index 46625c5c8..1030cf055 100644 --- a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs @@ -54,11 +54,7 @@ namespace MediaBrowser.LocalMetadata.Parsers public void Fetch(MetadataResult<T> item, string metadataFile, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(item); - - if (string.IsNullOrEmpty(metadataFile)) - { - throw new ArgumentException("The metadata file was empty or null.", nameof(metadataFile)); - } + ArgumentException.ThrowIfNullOrEmpty(metadataFile); var settings = new XmlReaderSettings { diff --git a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs index 0ee2bdd38..db177ff76 100644 --- a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs +++ b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs @@ -145,15 +145,8 @@ namespace MediaBrowser.MediaEncoding.Attachments bool isExternal, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(inputPath)) - { - throw new ArgumentNullException(nameof(inputPath)); - } - - if (string.IsNullOrEmpty(outputPath)) - { - throw new ArgumentNullException(nameof(outputPath)); - } + ArgumentException.ThrowIfNullOrEmpty(inputPath); + ArgumentException.ThrowIfNullOrEmpty(outputPath); Directory.CreateDirectory(outputPath); @@ -300,15 +293,9 @@ namespace MediaBrowser.MediaEncoding.Attachments string outputPath, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(inputPath)) - { - throw new ArgumentNullException(nameof(inputPath)); - } + ArgumentException.ThrowIfNullOrEmpty(inputPath); - if (string.IsNullOrEmpty(outputPath)) - { - throw new ArgumentNullException(nameof(outputPath)); - } + ArgumentException.ThrowIfNullOrEmpty(outputPath); Directory.CreateDirectory(Path.GetDirectoryName(outputPath)); diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index addaea33e..ffaf5246d 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -637,10 +637,7 @@ namespace MediaBrowser.MediaEncoding.Encoder private async Task<string> ExtractImageInternal(string inputPath, string container, MediaStream videoStream, int? imageStreamIndex, Video3DFormat? threedFormat, TimeSpan? offset, bool useIFrame, ImageFormat? targetFormat, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(inputPath)) - { - throw new ArgumentNullException(nameof(inputPath)); - } + ArgumentException.ThrowIfNullOrEmpty(inputPath); var outputExtension = targetFormat switch { diff --git a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj index 2ed654e1c..375041490 100644 --- a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj +++ b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> @@ -28,8 +28,8 @@ <ItemGroup> <PackageReference Include="BDInfo" Version="0.7.6.2" /> <PackageReference Include="libse" Version="3.6.5" /> - <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" /> - <PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" /> + <PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" /> + <PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" /> <PackageReference Include="UTF.Unknown" Version="2.5.1" /> </ItemGroup> diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs index 4bc329a8a..b7c2fd7b1 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs @@ -179,7 +179,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles _logger.LogDebug("charset {CharSet} detected for {Path}", result.EncodingName, fileInfo.Path); using var reader = new StreamReader(stream, result.Encoding); - var text = await reader.ReadToEndAsync().ConfigureAwait(false); + var text = await reader.ReadToEndAsync(cancellationToken).ConfigureAwait(false); return new MemoryStream(Encoding.UTF8.GetBytes(text)); } @@ -249,17 +249,14 @@ namespace MediaBrowser.MediaEncoding.Subtitles private bool TryGetWriter(string format, [NotNullWhen(true)] out ISubtitleWriter? value) { + ArgumentException.ThrowIfNullOrEmpty(format); + if (string.Equals(format, SubtitleFormat.ASS, StringComparison.OrdinalIgnoreCase)) { value = new AssWriter(); return true; } - if (string.IsNullOrEmpty(format)) - { - throw new ArgumentNullException(nameof(format)); - } - if (string.Equals(format, "json", StringComparison.OrdinalIgnoreCase)) { value = new JsonWriter(); @@ -355,15 +352,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles private async Task ConvertTextSubtitleToSrtInternal(MediaStream subtitleStream, MediaSourceInfo mediaSource, string outputPath, CancellationToken cancellationToken) { var inputPath = subtitleStream.Path; - if (string.IsNullOrEmpty(inputPath)) - { - throw new ArgumentNullException(nameof(inputPath)); - } + ArgumentException.ThrowIfNullOrEmpty(inputPath); - if (string.IsNullOrEmpty(outputPath)) - { - throw new ArgumentNullException(nameof(outputPath)); - } + ArgumentException.ThrowIfNullOrEmpty(outputPath); Directory.CreateDirectory(Path.GetDirectoryName(outputPath) ?? throw new ArgumentException($"Provided path ({outputPath}) is not valid.", nameof(outputPath))); @@ -522,15 +513,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles string outputPath, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(inputPath)) - { - throw new ArgumentNullException(nameof(inputPath)); - } + ArgumentException.ThrowIfNullOrEmpty(inputPath); - if (string.IsNullOrEmpty(outputPath)) - { - throw new ArgumentNullException(nameof(outputPath)); - } + ArgumentException.ThrowIfNullOrEmpty(outputPath); Directory.CreateDirectory(Path.GetDirectoryName(outputPath) ?? throw new ArgumentException($"Provided path ({outputPath}) is not valid.", nameof(outputPath))); @@ -650,7 +635,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles { encoding = reader.CurrentEncoding; - text = await reader.ReadToEndAsync().ConfigureAwait(false); + text = await reader.ReadToEndAsync(cancellationToken).ConfigureAwait(false); } var newText = text.Replace(",Arial,", ",Arial Unicode MS,", StringComparison.Ordinal); diff --git a/MediaBrowser.Model/Cryptography/PasswordHash.cs b/MediaBrowser.Model/Cryptography/PasswordHash.cs index 32a34d23c..80a30684a 100644 --- a/MediaBrowser.Model/Cryptography/PasswordHash.cs +++ b/MediaBrowser.Model/Cryptography/PasswordHash.cs @@ -29,12 +29,7 @@ namespace MediaBrowser.Model.Cryptography public PasswordHash(string id, byte[] hash, byte[] salt, Dictionary<string, string> parameters) { - ArgumentNullException.ThrowIfNull(id); - - if (id.Length == 0) - { - throw new ArgumentException("String can't be empty", nameof(id)); - } + ArgumentException.ThrowIfNullOrEmpty(id); Id = id; _hash = hash; diff --git a/MediaBrowser.Model/Dlna/SearchCriteria.cs b/MediaBrowser.Model/Dlna/SearchCriteria.cs index b1fc48c08..77d6a55ea 100644 --- a/MediaBrowser.Model/Dlna/SearchCriteria.cs +++ b/MediaBrowser.Model/Dlna/SearchCriteria.cs @@ -9,10 +9,7 @@ namespace MediaBrowser.Model.Dlna { public SearchCriteria(string search) { - if (search.Length == 0) - { - throw new ArgumentException("String can't be empty.", nameof(search)); - } + ArgumentException.ThrowIfNullOrEmpty(search); SearchType = SearchType.Unknown; diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index a004edc6a..af35e98ee 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -1496,10 +1496,7 @@ namespace MediaBrowser.Model.Dlna throw new ArgumentException("ItemId is required"); } - if (string.IsNullOrEmpty(options.DeviceId)) - { - throw new ArgumentException("DeviceId is required"); - } + ArgumentException.ThrowIfNullOrEmpty(options.DeviceId); if (options.Profile is null) { diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 9e0536c73..3b5509907 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -620,10 +620,7 @@ namespace MediaBrowser.Model.Dlna public string ToUrl(string baseUrl, string accessToken) { - if (string.IsNullOrEmpty(baseUrl)) - { - throw new ArgumentNullException(nameof(baseUrl)); - } + ArgumentException.ThrowIfNullOrEmpty(baseUrl); var list = new List<string>(); foreach (NameValuePair pair in BuildParams(this, accessToken)) @@ -664,10 +661,7 @@ namespace MediaBrowser.Model.Dlna private string GetUrl(string baseUrl, string queryString) { - if (string.IsNullOrEmpty(baseUrl)) - { - throw new ArgumentNullException(nameof(baseUrl)); - } + ArgumentException.ThrowIfNullOrEmpty(baseUrl); string extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container; diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 7c5399b4d..98179e486 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -14,7 +14,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> <PublishRepositoryUrl>true</PublishRepositoryUrl> @@ -34,13 +34,13 @@ <ItemGroup> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" /> - <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" /> + <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" /> <PackageReference Include="MimeTypes" Version="2.4.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <PackageReference Include="System.Globalization" Version="4.3.0" /> - <PackageReference Include="System.Text.Json" Version="6.0.7" /> + <PackageReference Include="System.Text.Json" Version="7.0.0" /> </ItemGroup> <ItemGroup> diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs index 3b03466e9..8157dc0c2 100644 --- a/MediaBrowser.Model/Net/MimeTypes.cs +++ b/MediaBrowser.Model/Net/MimeTypes.cs @@ -140,10 +140,7 @@ namespace MediaBrowser.Model.Net [return: NotNullIfNotNull("defaultValue")] public static string? GetMimeType(string filename, string? defaultValue = null) { - if (filename.Length == 0) - { - throw new ArgumentException("String can't be empty.", nameof(filename)); - } + ArgumentException.ThrowIfNullOrEmpty(filename); var ext = Path.GetExtension(filename); @@ -168,10 +165,7 @@ namespace MediaBrowser.Model.Net public static string? ToExtension(string mimeType) { - if (mimeType.Length == 0) - { - throw new ArgumentException("String can't be empty.", nameof(mimeType)); - } + ArgumentException.ThrowIfNullOrEmpty(mimeType); // handle text/html; charset=UTF-8 mimeType = mimeType.AsSpan().LeftPart(';').ToString(); diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs index 2061d384c..50e704060 100644 --- a/MediaBrowser.Providers/Manager/ImageSaver.cs +++ b/MediaBrowser.Providers/Manager/ImageSaver.cs @@ -87,10 +87,7 @@ namespace MediaBrowser.Providers.Manager public async Task SaveImage(BaseItem item, Stream source, string mimeType, ImageType type, int? imageIndex, bool? saveLocallyWithMedia, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(mimeType)) - { - throw new ArgumentNullException(nameof(mimeType)); - } + ArgumentException.ThrowIfNullOrEmpty(mimeType); var saveLocally = item.SupportsLocalMetadata && item.IsSaveLocalMetadataEnabled() && !item.ExtraType.HasValue && item is not Audio; diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 077bb30f4..5b5ca0fca 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -918,15 +918,8 @@ namespace MediaBrowser.Providers.Manager var source = sourceResult.Item; var target = targetResult.Item; - if (source is null) - { - throw new ArgumentException("Item cannot be null.", nameof(sourceResult)); - } - - if (target is null) - { - throw new ArgumentException("Item cannot be null.", nameof(targetResult)); - } + ArgumentNullException.ThrowIfNull(sourceResult); + ArgumentNullException.ThrowIfNull(targetResult); if (!lockedFields.Contains(MetadataField.Name)) { diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj index 30f4a449e..d91402f51 100644 --- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj +++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj @@ -18,9 +18,9 @@ <ItemGroup> <PackageReference Include="LrcParser" Version="2022.529.1" /> <PackageReference Include="MetaBrainz.MusicBrainz" Version="5.0.0" /> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" /> - <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="6.0.0" /> - <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.2" /> <PackageReference Include="OptimizedPriorityQueue" Version="5.1.0" /> <PackageReference Include="PlaylistsNET" Version="1.2.1" /> @@ -29,7 +29,7 @@ </ItemGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> <CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet> diff --git a/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs index 6cd1d49b0..6713a34e6 100644 --- a/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs +++ b/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs @@ -365,10 +365,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb internal string GetDataFilePath(string imdbId) { - if (string.IsNullOrEmpty(imdbId)) - { - throw new ArgumentNullException(nameof(imdbId)); - } + ArgumentException.ThrowIfNullOrEmpty(imdbId); var dataPath = Path.Combine(_configurationManager.ApplicationPaths.CachePath, "omdb"); @@ -379,10 +376,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb internal string GetSeasonFilePath(string imdbId, int seasonId) { - if (string.IsNullOrEmpty(imdbId)) - { - throw new ArgumentNullException(nameof(imdbId)); - } + ArgumentException.ThrowIfNullOrEmpty(imdbId); var dataPath = Path.Combine(_configurationManager.ApplicationPaths.CachePath, "omdb"); diff --git a/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj b/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj index ec062152b..6e82d96d1 100644 --- a/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj +++ b/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj @@ -15,7 +15,7 @@ </ItemGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index 6a144365c..96c512a46 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -90,10 +90,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers throw new ArgumentException("Item can't be null.", nameof(item)); } - if (string.IsNullOrEmpty(metadataFile)) - { - throw new ArgumentException("The metadata filepath was empty.", nameof(metadataFile)); - } + ArgumentException.ThrowIfNullOrEmpty(metadataFile); _validProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); @@ -80,7 +80,7 @@ These instructions will help you get set up with a local development environment ### Prerequisites -Before the project can be built, you must first install the [.NET 6.0 SDK](https://dotnet.microsoft.com/download/dotnet) on your system. +Before the project can be built, you must first install the [.NET 7.0 SDK](https://dotnet.microsoft.com/download/dotnet) on your system. Instructions to run this project from the command line are included here, but you will also need to install an IDE if you want to debug the server while it is running. Any IDE that supports .NET 6 development will work, but two options are recent versions of [Visual Studio](https://visualstudio.microsoft.com/downloads/) (at least 2022) and [Visual Studio Code](https://code.visualstudio.com/Download). @@ -137,7 +137,7 @@ A second option is to build the project and then run the resulting executable fi ```bash dotnet build # Build the project -cd Jellyfin.Server/bin/Debug/net6.0 # Change into the build output directory +cd Jellyfin.Server/bin/Debug/net7.0 # Change into the build output directory ``` 2. Execute the build output. On Linux, Mac, etc. use `./jellyfin` and on Windows use `jellyfin.exe`. diff --git a/RSSDP/RSSDP.csproj b/RSSDP/RSSDP.csproj index 77130983b..df5d982f6 100644 --- a/RSSDP/RSSDP.csproj +++ b/RSSDP/RSSDP.csproj @@ -11,7 +11,7 @@ </ItemGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <AnalysisMode>AllDisabledByDefault</AnalysisMode> <Nullable>disable</Nullable> diff --git a/fuzz/Emby.Server.Implementations.Fuzz/Emby.Server.Implementations.Fuzz.csproj b/fuzz/Emby.Server.Implementations.Fuzz/Emby.Server.Implementations.Fuzz.csproj index b0f3c0149..6cc814ef4 100644 --- a/fuzz/Emby.Server.Implementations.Fuzz/Emby.Server.Implementations.Fuzz.csproj +++ b/fuzz/Emby.Server.Implementations.Fuzz/Emby.Server.Implementations.Fuzz.csproj @@ -2,7 +2,7 @@ <PropertyGroup> <OutputType>Exe</OutputType> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> </PropertyGroup> <ItemGroup> diff --git a/fuzz/Jellyfin.Server.Fuzz/Jellyfin.Server.Fuzz.csproj b/fuzz/Jellyfin.Server.Fuzz/Jellyfin.Server.Fuzz.csproj index 6ffc17ff9..5e7d14b11 100644 --- a/fuzz/Jellyfin.Server.Fuzz/Jellyfin.Server.Fuzz.csproj +++ b/fuzz/Jellyfin.Server.Fuzz/Jellyfin.Server.Fuzz.csproj @@ -2,7 +2,7 @@ <PropertyGroup> <OutputType>Exe</OutputType> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> </PropertyGroup> <ItemGroup> diff --git a/src/Jellyfin.Extensions/Jellyfin.Extensions.csproj b/src/Jellyfin.Extensions/Jellyfin.Extensions.csproj index f99cb0406..eaf2bc35c 100644 --- a/src/Jellyfin.Extensions/Jellyfin.Extensions.csproj +++ b/src/Jellyfin.Extensions/Jellyfin.Extensions.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> <PublishRepositoryUrl>true</PublishRepositoryUrl> diff --git a/src/Jellyfin.MediaEncoding.Hls/Jellyfin.MediaEncoding.Hls.csproj b/src/Jellyfin.MediaEncoding.Hls/Jellyfin.MediaEncoding.Hls.csproj index 2ff7f9645..32f80812a 100644 --- a/src/Jellyfin.MediaEncoding.Hls/Jellyfin.MediaEncoding.Hls.csproj +++ b/src/Jellyfin.MediaEncoding.Hls/Jellyfin.MediaEncoding.Hls.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> @@ -23,7 +23,7 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" /> + <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" /> </ItemGroup> <ItemGroup> diff --git a/src/Jellyfin.MediaEncoding.Keyframes/Jellyfin.MediaEncoding.Keyframes.csproj b/src/Jellyfin.MediaEncoding.Keyframes/Jellyfin.MediaEncoding.Keyframes.csproj index 8be5cd8dc..b11bdc477 100644 --- a/src/Jellyfin.MediaEncoding.Keyframes/Jellyfin.MediaEncoding.Keyframes.csproj +++ b/src/Jellyfin.MediaEncoding.Keyframes/Jellyfin.MediaEncoding.Keyframes.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> @@ -21,7 +21,7 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" /> + <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" /> </ItemGroup> <ItemGroup> diff --git a/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj index a20c9690f..bd412bc76 100644 --- a/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj +++ b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> @@ -15,8 +15,8 @@ <PackageReference Include="AutoFixture" Version="4.17.0" /> <PackageReference Include="AutoFixture.AutoMoq" Version="4.17.0" /> <PackageReference Include="AutoFixture.Xunit2" Version="4.17.0" /> - <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.9" /> - <PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" /> + <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> <PackageReference Include="xunit" Version="2.4.2" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> diff --git a/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj b/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj index 95fc1d917..3ca761b3d 100644 --- a/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj +++ b/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> diff --git a/tests/Jellyfin.Controller.Tests/Jellyfin.Controller.Tests.csproj b/tests/Jellyfin.Controller.Tests/Jellyfin.Controller.Tests.csproj index d95747206..650973c6a 100644 --- a/tests/Jellyfin.Controller.Tests/Jellyfin.Controller.Tests.csproj +++ b/tests/Jellyfin.Controller.Tests/Jellyfin.Controller.Tests.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> diff --git a/tests/Jellyfin.Dlna.Tests/Jellyfin.Dlna.Tests.csproj b/tests/Jellyfin.Dlna.Tests/Jellyfin.Dlna.Tests.csproj index 1444d6faf..cba946800 100644 --- a/tests/Jellyfin.Dlna.Tests/Jellyfin.Dlna.Tests.csproj +++ b/tests/Jellyfin.Dlna.Tests/Jellyfin.Dlna.Tests.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> diff --git a/tests/Jellyfin.Extensions.Tests/Jellyfin.Extensions.Tests.csproj b/tests/Jellyfin.Extensions.Tests/Jellyfin.Extensions.Tests.csproj index 9e3bef881..075bcaac8 100644 --- a/tests/Jellyfin.Extensions.Tests/Jellyfin.Extensions.Tests.csproj +++ b/tests/Jellyfin.Extensions.Tests/Jellyfin.Extensions.Tests.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> diff --git a/tests/Jellyfin.MediaEncoding.Hls.Tests/Jellyfin.MediaEncoding.Hls.Tests.csproj b/tests/Jellyfin.MediaEncoding.Hls.Tests/Jellyfin.MediaEncoding.Hls.Tests.csproj index 83ea1907c..f7163edc7 100644 --- a/tests/Jellyfin.MediaEncoding.Hls.Tests/Jellyfin.MediaEncoding.Hls.Tests.csproj +++ b/tests/Jellyfin.MediaEncoding.Hls.Tests/Jellyfin.MediaEncoding.Hls.Tests.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> diff --git a/tests/Jellyfin.MediaEncoding.Keyframes.Tests/Jellyfin.MediaEncoding.Keyframes.Tests.csproj b/tests/Jellyfin.MediaEncoding.Keyframes.Tests/Jellyfin.MediaEncoding.Keyframes.Tests.csproj index 84a069424..72bfb3fd2 100644 --- a/tests/Jellyfin.MediaEncoding.Keyframes.Tests/Jellyfin.MediaEncoding.Keyframes.Tests.csproj +++ b/tests/Jellyfin.MediaEncoding.Keyframes.Tests/Jellyfin.MediaEncoding.Keyframes.Tests.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> <RootNamespace>Jellyfin.MediaEncoding.Keyframes</RootNamespace> diff --git a/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj b/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj index 4cff2143c..e68e7f39a 100644 --- a/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj +++ b/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> diff --git a/tests/Jellyfin.Model.Tests/Jellyfin.Model.Tests.csproj b/tests/Jellyfin.Model.Tests/Jellyfin.Model.Tests.csproj index fbcaa66f4..2c7e393af 100644 --- a/tests/Jellyfin.Model.Tests/Jellyfin.Model.Tests.csproj +++ b/tests/Jellyfin.Model.Tests/Jellyfin.Model.Tests.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> diff --git a/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj b/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj index da0e9f5b1..0d9acf0e1 100644 --- a/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj +++ b/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> diff --git a/tests/Jellyfin.Networking.Tests/Jellyfin.Networking.Tests.csproj b/tests/Jellyfin.Networking.Tests/Jellyfin.Networking.Tests.csproj index 8ec0262bd..9e13dd4ad 100644 --- a/tests/Jellyfin.Networking.Tests/Jellyfin.Networking.Tests.csproj +++ b/tests/Jellyfin.Networking.Tests/Jellyfin.Networking.Tests.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> diff --git a/tests/Jellyfin.Providers.Tests/Jellyfin.Providers.Tests.csproj b/tests/Jellyfin.Providers.Tests/Jellyfin.Providers.Tests.csproj index 194229737..2d8e3c8f2 100644 --- a/tests/Jellyfin.Providers.Tests/Jellyfin.Providers.Tests.csproj +++ b/tests/Jellyfin.Providers.Tests/Jellyfin.Providers.Tests.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> diff --git a/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj b/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj index 918802d77..d91b4f00b 100644 --- a/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj +++ b/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> <RootNamespace>Jellyfin.Server.Implementations.Tests</RootNamespace> diff --git a/tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj b/tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj index 659737392..ecc3ebb86 100644 --- a/tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj +++ b/tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj @@ -1,6 +1,6 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> @@ -9,8 +9,8 @@ <PackageReference Include="AutoFixture" Version="4.17.0" /> <PackageReference Include="AutoFixture.AutoMoq" Version="4.17.0" /> <PackageReference Include="AutoFixture.Xunit2" Version="4.17.0" /> - <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.9" /> - <PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" /> + <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> <PackageReference Include="xunit" Version="2.4.2" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> diff --git a/tests/Jellyfin.Server.Tests/Jellyfin.Server.Tests.csproj b/tests/Jellyfin.Server.Tests/Jellyfin.Server.Tests.csproj index b2653b28b..0ce2721c7 100644 --- a/tests/Jellyfin.Server.Tests/Jellyfin.Server.Tests.csproj +++ b/tests/Jellyfin.Server.Tests/Jellyfin.Server.Tests.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> @@ -10,8 +10,8 @@ <PackageReference Include="AutoFixture" Version="4.17.0" /> <PackageReference Include="AutoFixture.AutoMoq" Version="4.17.0" /> <PackageReference Include="AutoFixture.Xunit2" Version="4.17.0" /> - <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.9" /> - <PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" /> + <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> <PackageReference Include="xunit" Version="2.4.2" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> diff --git a/tests/Jellyfin.XbmcMetadata.Tests/Jellyfin.XbmcMetadata.Tests.csproj b/tests/Jellyfin.XbmcMetadata.Tests/Jellyfin.XbmcMetadata.Tests.csproj index f03448eed..bde34d639 100644 --- a/tests/Jellyfin.XbmcMetadata.Tests/Jellyfin.XbmcMetadata.Tests.csproj +++ b/tests/Jellyfin.XbmcMetadata.Tests/Jellyfin.XbmcMetadata.Tests.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> <IsPackable>false</IsPackable> <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet> </PropertyGroup> |
