Forráskód Böngészése

Remove nullable, add async task

crobibero 5 éve
szülő
commit
9a51f484af

+ 0 - 1
Jellyfin.Api/Controllers/ActivityLogController.cs

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

+ 0 - 2
Jellyfin.Api/Controllers/ConfigurationController.cs

@@ -1,5 +1,3 @@
-#nullable enable
-
 using System.Text.Json;
 using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Jellyfin.Api.Constants;
 using Jellyfin.Api.Constants;

+ 0 - 2
Jellyfin.Api/Controllers/DevicesController.cs

@@ -1,5 +1,3 @@
-#nullable enable
-
 using System;
 using System;
 using Jellyfin.Api.Constants;
 using Jellyfin.Api.Constants;
 using MediaBrowser.Controller.Devices;
 using MediaBrowser.Controller.Devices;

+ 1 - 2
Jellyfin.Api/Controllers/FilterController.cs

@@ -1,5 +1,4 @@
-#nullable enable
-#pragma warning disable CA1801
+#pragma warning disable CA1801
 
 
 using System;
 using System;
 using System.Linq;
 using System.Linq;

+ 0 - 2
Jellyfin.Api/Controllers/ImageByNameController.cs

@@ -1,5 +1,3 @@
-#nullable enable
-
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.IO;
 using System.IO;

+ 0 - 1
Jellyfin.Api/Controllers/ItemRefreshController.cs

@@ -1,4 +1,3 @@
-#nullable enable
 #pragma warning disable CA1801
 #pragma warning disable CA1801
 
 
 using System.ComponentModel;
 using System.ComponentModel;

+ 9 - 16
Jellyfin.Api/Controllers/LibraryStructureController.cs

@@ -1,4 +1,3 @@
-#nullable enable
 #pragma warning disable CA1801
 #pragma warning disable CA1801
 
 
 using System;
 using System;
@@ -175,20 +174,18 @@ namespace Jellyfin.Api.Controllers
             {
             {
                 CollectionFolder.OnCollectionFolderChange();
                 CollectionFolder.OnCollectionFolderChange();
 
 
-                Task.Run(() =>
+                Task.Run(async () =>
                 {
                 {
                     // No need to start if scanning the library because it will handle it
                     // No need to start if scanning the library because it will handle it
                     if (refreshLibrary)
                     if (refreshLibrary)
                     {
                     {
-                        _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
+                        await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
                     }
                     }
                     else
                     else
                     {
                     {
                         // Need to add a delay here or directory watchers may still pick up the changes
                         // Need to add a delay here or directory watchers may still pick up the changes
-                        var task = Task.Delay(1000);
                         // Have to block here to allow exceptions to bubble
                         // Have to block here to allow exceptions to bubble
-                        Task.WaitAll(task);
-
+                        await Task.Delay(1000).ConfigureAwait(false);
                         _libraryMonitor.Start();
                         _libraryMonitor.Start();
                     }
                     }
                 });
                 });
@@ -230,20 +227,18 @@ namespace Jellyfin.Api.Controllers
             }
             }
             finally
             finally
             {
             {
-                Task.Run(() =>
+                Task.Run(async () =>
                 {
                 {
                     // No need to start if scanning the library because it will handle it
                     // No need to start if scanning the library because it will handle it
                     if (refreshLibrary)
                     if (refreshLibrary)
                     {
                     {
-                        _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
+                        await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
                     }
                     }
                     else
                     else
                     {
                     {
                         // Need to add a delay here or directory watchers may still pick up the changes
                         // Need to add a delay here or directory watchers may still pick up the changes
-                        var task = Task.Delay(1000);
                         // Have to block here to allow exceptions to bubble
                         // Have to block here to allow exceptions to bubble
-                        Task.WaitAll(task);
-
+                        await Task.Delay(1000).ConfigureAwait(false);
                         _libraryMonitor.Start();
                         _libraryMonitor.Start();
                     }
                     }
                 });
                 });
@@ -304,20 +299,18 @@ namespace Jellyfin.Api.Controllers
             }
             }
             finally
             finally
             {
             {
-                Task.Run(() =>
+                Task.Run(async () =>
                 {
                 {
                     // No need to start if scanning the library because it will handle it
                     // No need to start if scanning the library because it will handle it
                     if (refreshLibrary)
                     if (refreshLibrary)
                     {
                     {
-                        _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
+                        await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
                     }
                     }
                     else
                     else
                     {
                     {
                         // Need to add a delay here or directory watchers may still pick up the changes
                         // Need to add a delay here or directory watchers may still pick up the changes
-                        var task = Task.Delay(1000);
                         // Have to block here to allow exceptions to bubble
                         // Have to block here to allow exceptions to bubble
-                        Task.WaitAll(task);
-
+                        await Task.Delay(1000).ConfigureAwait(false);
                         _libraryMonitor.Start();
                         _libraryMonitor.Start();
                     }
                     }
                 });
                 });

+ 0 - 1
Jellyfin.Api/Controllers/NotificationsController.cs

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

+ 0 - 2
Jellyfin.Api/Controllers/PackageController.cs

@@ -1,5 +1,3 @@
-#nullable enable
-
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;

+ 1 - 2
Jellyfin.Api/Controllers/PluginsController.cs

@@ -1,5 +1,4 @@
-#nullable enable
-#pragma warning disable CA1801
+#pragma warning disable CA1801
 
 
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;

+ 1 - 3
Jellyfin.Api/Controllers/Images/RemoteImageController.cs → Jellyfin.Api/Controllers/RemoteImageController.cs

@@ -1,5 +1,3 @@
-#nullable enable
-
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.IO;
 using System.IO;
@@ -21,7 +19,7 @@ using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Mvc.ModelBinding;
 using Microsoft.AspNetCore.Mvc.ModelBinding;
 
 
-namespace Jellyfin.Api.Controllers.Images
+namespace Jellyfin.Api.Controllers
 {
 {
     /// <summary>
     /// <summary>
     /// Remote Images Controller.
     /// Remote Images Controller.

+ 0 - 1
Jellyfin.Api/Controllers/SubtitleController.cs

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

+ 0 - 2
Jellyfin.Api/Controllers/VideoAttachmentsController.cs

@@ -1,5 +1,3 @@
-#nullable enable
-
 using System;
 using System;
 using System.Net.Mime;
 using System.Net.Mime;
 using System.Threading;
 using System.Threading;

+ 0 - 2
Jellyfin.Api/Models/ConfigurationDtos/MediaEncoderPathDto.cs

@@ -1,5 +1,3 @@
-#nullable enable
-
 namespace Jellyfin.Api.Models.ConfigurationDtos
 namespace Jellyfin.Api.Models.ConfigurationDtos
 {
 {
     /// <summary>
     /// <summary>

+ 0 - 2
Jellyfin.Api/Models/NotificationDtos/NotificationDto.cs

@@ -1,5 +1,3 @@
-#nullable enable
-
 using System;
 using System;
 using MediaBrowser.Model.Notifications;
 using MediaBrowser.Model.Notifications;
 
 

+ 0 - 2
Jellyfin.Api/Models/NotificationDtos/NotificationResultDto.cs

@@ -1,5 +1,3 @@
-#nullable enable
-
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 

+ 0 - 2
Jellyfin.Api/Models/NotificationDtos/NotificationsSummaryDto.cs

@@ -1,5 +1,3 @@
-#nullable enable
-
 using MediaBrowser.Model.Notifications;
 using MediaBrowser.Model.Notifications;
 
 
 namespace Jellyfin.Api.Models.NotificationDtos
 namespace Jellyfin.Api.Models.NotificationDtos

+ 1 - 3
Jellyfin.Api/Models/PluginDtos/MBRegistrationRecord.cs

@@ -1,6 +1,4 @@
-#nullable enable
-
-using System;
+using System;
 
 
 namespace Jellyfin.Api.Models.PluginDtos
 namespace Jellyfin.Api.Models.PluginDtos
 {
 {

+ 1 - 3
Jellyfin.Api/Models/PluginDtos/PluginSecurityInfo.cs

@@ -1,6 +1,4 @@
-#nullable enable
-
-namespace Jellyfin.Api.Models.PluginDtos
+namespace Jellyfin.Api.Models.PluginDtos
 {
 {
     /// <summary>
     /// <summary>
     /// Plugin security info.
     /// Plugin security info.

+ 3 - 5
Jellyfin.Api/Models/StartupDtos/StartupConfigurationDto.cs

@@ -1,5 +1,3 @@
-#nullable disable
-
 namespace Jellyfin.Api.Models.StartupDtos
 namespace Jellyfin.Api.Models.StartupDtos
 {
 {
     /// <summary>
     /// <summary>
@@ -10,16 +8,16 @@ namespace Jellyfin.Api.Models.StartupDtos
         /// <summary>
         /// <summary>
         /// Gets or sets UI language culture.
         /// Gets or sets UI language culture.
         /// </summary>
         /// </summary>
-        public string UICulture { get; set; }
+        public string? UICulture { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Gets or sets the metadata country code.
         /// Gets or sets the metadata country code.
         /// </summary>
         /// </summary>
-        public string MetadataCountryCode { get; set; }
+        public string? MetadataCountryCode { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Gets or sets the preferred language for the metadata.
         /// Gets or sets the preferred language for the metadata.
         /// </summary>
         /// </summary>
-        public string PreferredMetadataLanguage { get; set; }
+        public string? PreferredMetadataLanguage { get; set; }
     }
     }
 }
 }

+ 2 - 4
Jellyfin.Api/Models/StartupDtos/StartupUserDto.cs

@@ -1,5 +1,3 @@
-#nullable disable
-
 namespace Jellyfin.Api.Models.StartupDtos
 namespace Jellyfin.Api.Models.StartupDtos
 {
 {
     /// <summary>
     /// <summary>
@@ -10,11 +8,11 @@ namespace Jellyfin.Api.Models.StartupDtos
         /// <summary>
         /// <summary>
         /// Gets or sets the username.
         /// Gets or sets the username.
         /// </summary>
         /// </summary>
-        public string Name { get; set; }
+        public string? Name { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Gets or sets the user's password.
         /// Gets or sets the user's password.
         /// </summary>
         /// </summary>
-        public string Password { get; set; }
+        public string? Password { get; set; }
     }
     }
 }
 }