Adopted further C# 14 and .NET 10 features (#1158)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-04 14:04:10 +01:00
1 parent f649febf88
commit f0fa1411c8
40 files changed
+545 -56

No files matched your search

@@ -20,7 +20,7 @@ public sealed class GlobalShortcutService : BackgroundService, IMessageBusReceiv
}
private readonly SemaphoreSlim registrationSemaphore = new(1, 1);
private readonly object runtimeStateLock = new();
private readonly Lock runtimeStateLock = new();
private readonly Dictionary<Shortcut, ShortcutState> lastSentStates = [];
private readonly Dictionary<Shortcut, string> lastNonEmptyShortcuts = [];
private readonly Dictionary<Shortcut, ShortcutRuntimeBinding> runtimeBindings = [];
@@ -12,7 +12,7 @@ internal sealed partial class FileSourceIndexer
private readonly ConcurrentDictionary<string, DataSourceWatcherRegistration> watchers = new(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, CancellationTokenSource> watcherDebounceTokens = new(StringComparer.OrdinalIgnoreCase);
private readonly object watcherDebounceLock = new();
private readonly Lock watcherDebounceLock = new();
/// <summary>
/// The data sources handed in last, by their id. A watcher which failed is created anew from here.
@@ -45,7 +45,7 @@ public sealed partial class PluginInstallService
if (!this.TryCreateStagingDirectory(PLUGIN_IMPORT_DIRECTORY_PREFIX, out stagingDirectory, out var stagingIssue))
return Error(stagingIssue);
PluginArchive.Extract(archivePath, stagingDirectory);
await PluginArchive.ExtractAsync(archivePath, stagingDirectory, token);
var pluginFiles = Directory.EnumerateFiles(stagingDirectory, PLUGIN_FILE_NAME, SearchOption.AllDirectories).ToArray();
if (pluginFiles.Length != 1)
@@ -140,7 +140,7 @@ public sealed class PluginShareService(NativeShareService nativeShareService, Ru
// one next to it, which is what deleting and recreating would come down to.
//
await using var archiveStream = File.Create(archivePath);
ZipFile.CreateFromDirectory(pluginRoot, archiveStream, CompressionLevel.Optimal, false);
await ZipFile.CreateFromDirectoryAsync(pluginRoot, archiveStream, CompressionLevel.Optimal, false, token);
}, token);
logger.LogInformation("Exported plugin '{PluginName}' ({PluginId}) to the archive '{ArchivePath}'.", plugin.Name, plugin.Id, archivePath);
@@ -177,10 +177,10 @@ public sealed class PluginShareService(NativeShareService nativeShareService, Ru
Directory.CreateDirectory(archiveDirectory);
this.CleanUpExpiredArchives(archiveDirectory);
await Task.Run(() =>
await Task.Run(async () =>
{
token.ThrowIfCancellationRequested();
ZipFile.CreateFromDirectory(pluginRoot, archivePath, CompressionLevel.Optimal, false);
await ZipFile.CreateFromDirectoryAsync(pluginRoot, archivePath, CompressionLevel.Optimal, false, token);
}, token);
token.ThrowIfCancellationRequested();