From 443f17dcef2dfbfa79ec0764ad8482cad2ab3828 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 20 Mar 2025 16:54:14 +0800 Subject: [PATCH] Code quality --- .../Main.cs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs index 3acf94bf6..3ae7cfa1d 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs @@ -17,7 +17,7 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex { private static PluginInitContext _context; - private static List _cachedBookmarks = new List(); + private static List _cachedBookmarks = new(); private static Settings _settings; @@ -107,9 +107,9 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex } } - private static Channel _refreshQueue = Channel.CreateBounded(1); + private static readonly Channel _refreshQueue = Channel.CreateBounded(1); - private static SemaphoreSlim _fileMonitorSemaphore = new(1, 1); + private static readonly SemaphoreSlim _fileMonitorSemaphore = new(1, 1); private static async Task MonitorRefreshQueueAsync() { @@ -143,12 +143,13 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex return; } - var watcher = new FileSystemWatcher(directory!); - watcher.Filter = Path.GetFileName(path); - - watcher.NotifyFilter = NotifyFilters.FileName | - NotifyFilters.LastWrite | - NotifyFilters.Size; + var watcher = new FileSystemWatcher(directory!) + { + Filter = Path.GetFileName(path), + NotifyFilter = NotifyFilters.FileName | + NotifyFilters.LastWrite | + NotifyFilters.Size + }; watcher.Changed += static (_, _) => { @@ -197,7 +198,7 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex { return new List() { - new Result + new() { Title = _context.API.GetTranslation("flowlauncher_plugin_browserbookmark_copyurl_title"), SubTitle = _context.API.GetTranslation("flowlauncher_plugin_browserbookmark_copyurl_subtitle"),