Code quality

This commit is contained in:
Jack251970 2025-03-20 16:54:14 +08:00
parent a837e8e197
commit 443f17dcef

View file

@ -17,7 +17,7 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex
{
private static PluginInitContext _context;
private static List<Bookmark> _cachedBookmarks = new List<Bookmark>();
private static List<Bookmark> _cachedBookmarks = new();
private static Settings _settings;
@ -107,9 +107,9 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex
}
}
private static Channel<byte> _refreshQueue = Channel.CreateBounded<byte>(1);
private static readonly Channel<byte> _refreshQueue = Channel.CreateBounded<byte>(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<Result>()
{
new Result
new()
{
Title = _context.API.GetTranslation("flowlauncher_plugin_browserbookmark_copyurl_title"),
SubTitle = _context.API.GetTranslation("flowlauncher_plugin_browserbookmark_copyurl_subtitle"),