diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs index 9f7ab8762..e74811301 100644 --- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs +++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs @@ -69,7 +69,13 @@ namespace Flow.Launcher.Core.Plugin private static readonly JsonSerializerOptions options = new() { PropertyNameCaseInsensitive = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, +#pragma warning disable SYSLIB0020 + // IgnoreNullValues is obsolete, but the replacement JsonIgnoreCondition.WhenWritingNull still + // deserializes null, instead of ignoring it and leaving the default (empty list). We can change the behaviour + // to accept null and fallback to a default etc, or just keep IgnoreNullValues for now + // see: https://github.com/dotnet/runtime/issues/39152 + IgnoreNullValues = true, +#pragma warning restore SYSLIB0020 // Type or member is obsolete Converters = { new JsonObjectConverter() @@ -82,12 +88,15 @@ namespace Flow.Launcher.Core.Plugin }; private Dictionary Settings { get; set; } - private Dictionary _settingControls = new(); + private readonly Dictionary _settingControls = new(); private async Task> DeserializedResultAsync(Stream output) { if (output == Stream.Null) return null; + var temp = System.Text.Encoding.UTF8.GetString(((MemoryStream)output).ToArray()); + System.Diagnostics.Debug.WriteLine(temp); + var queryResponseModel = await JsonSerializer.DeserializeAsync(output, options); diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index 134c3c002..d6b130f7b 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -74,7 +74,7 @@ namespace Flow.Launcher.Core.Plugin } } - public static async Task ReloadData() + public static async Task ReloadDataAsync() { await Task.WhenAll(AllPlugins.Select(plugin => plugin.Plugin switch { @@ -327,4 +327,4 @@ namespace Flow.Launcher.Core.Plugin } } } -} \ No newline at end of file +} diff --git a/Flow.Launcher.Core/Plugin/PluginsLoader.cs b/Flow.Launcher.Core/Plugin/PluginsLoader.cs index 265c19e6e..b46b2c799 100644 --- a/Flow.Launcher.Core/Plugin/PluginsLoader.cs +++ b/Flow.Launcher.Core/Plugin/PluginsLoader.cs @@ -45,8 +45,10 @@ namespace Flow.Launcher.Core.Plugin var assembly = assemblyLoader.LoadAssemblyAndDependencies(); var type = assemblyLoader.FromAssemblyGetTypeOfInterface(assembly, typeof(IAsyncPlugin)); - +#pragma warning disable IDE0019 // "Use Pattern Matching" - disabled because the pattern is useful for RELEASE var plugin = Activator.CreateInstance(type) as IAsyncPlugin; +#pragma warning restore IDE0019 + #else Assembly assembly = null; IAsyncPlugin plugin = null; diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 69b537b39..976c4eec1 100644 --- a/Flow.Launcher.Core/Updater.cs +++ b/Flow.Launcher.Core/Updater.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Net; using System.Net.Http; @@ -40,7 +40,7 @@ namespace Flow.Launcher.Core api.ShowMsg(api.GetTranslation("pleaseWait"), api.GetTranslation("update_flowlauncher_update_check")); - using var updateManager = await GitHubUpdateManager(GitHubRepository).ConfigureAwait(false); + using var updateManager = await GitHubUpdateManagerAsync(GitHubRepository).ConfigureAwait(false); // UpdateApp CheckForUpdate will return value only if the app is squirrel installed var newUpdateInfo = await updateManager.CheckForUpdate().NonNull().ConfigureAwait(false); @@ -115,7 +115,7 @@ namespace Flow.Launcher.Core } /// https://github.com/Squirrel/Squirrel.Windows/blob/master/src/Squirrel/UpdateManager.Factory.cs - private async Task GitHubUpdateManager(string repository) + private async Task GitHubUpdateManagerAsync(string repository) { var uri = new Uri(repository); var api = $"https://api.github.com/repos{uri.AbsolutePath}/releases"; @@ -145,4 +145,4 @@ namespace Flow.Launcher.Core } } -} \ No newline at end of file +} diff --git a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs index 3f77dce47..40ac6b121 100644 --- a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs +++ b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs @@ -78,7 +78,7 @@ namespace Flow.Launcher.Infrastructure.Exception sb.AppendLine(); sb.AppendLine("## Assemblies - " + AppDomain.CurrentDomain.FriendlyName); sb.AppendLine(); - foreach (var ass in AppDomain.CurrentDomain.GetAssemblies().OrderBy(o => o.GlobalAssemblyCache ? 50 : 0)) + foreach (var ass in AppDomain.CurrentDomain.GetAssemblies()) { sb.Append("* "); sb.Append(ass.FullName); diff --git a/Flow.Launcher.Infrastructure/Image/ImageHashGenerator.cs b/Flow.Launcher.Infrastructure/Image/ImageHashGenerator.cs index 736133052..2611e99e8 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageHashGenerator.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageHashGenerator.cs @@ -14,30 +14,23 @@ namespace Flow.Launcher.Infrastructure.Image { public string GetHashFromImage(ImageSource imageSource) { - if (!(imageSource is BitmapSource image)) + if (imageSource is not BitmapSource image) { return null; } try { - using (var outStream = new MemoryStream()) - { - // PngBitmapEncoder enc2 = new PngBitmapEncoder(); - // enc2.Frames.Add(BitmapFrame.Create(tt)); - - var enc = new JpegBitmapEncoder(); - var bitmapFrame = BitmapFrame.Create(image); - bitmapFrame.Freeze(); - enc.Frames.Add(bitmapFrame); - enc.Save(outStream); - var byteArray = outStream.GetBuffer(); - using (var sha1 = new SHA1CryptoServiceProvider()) - { - var hash = Convert.ToBase64String(sha1.ComputeHash(byteArray)); - return hash; - } - } + using var outStream = new MemoryStream(); + var enc = new JpegBitmapEncoder(); + var bitmapFrame = BitmapFrame.Create(image); + bitmapFrame.Freeze(); + enc.Frames.Add(bitmapFrame); + enc.Save(outStream); + var byteArray = outStream.GetBuffer(); + using var sha1 = SHA1.Create(); + var hash = Convert.ToBase64String(sha1.ComputeHash(byteArray)); + return hash; } catch { @@ -46,4 +39,4 @@ namespace Flow.Launcher.Infrastructure.Image } } -} \ No newline at end of file +} diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index 9d42ff88b..8c1d7d74f 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -13,11 +13,11 @@ namespace Flow.Launcher.Infrastructure.Image { public static class ImageLoader { - private static readonly ImageCache ImageCache = new ImageCache(); + private static readonly ImageCache ImageCache = new(); private static BinaryStorage> _storage; - private static readonly ConcurrentDictionary GuidToKey = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary GuidToKey = new(); private static IImageHashGenerator _hashGenerator; - private static bool EnableImageHash = true; + private static readonly bool EnableImageHash = true; public static ImageSource DefaultImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon)); @@ -243,7 +243,6 @@ namespace Flow.Launcher.Infrastructure.Image ImageCache[path] = img; } - return img; } diff --git a/Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs b/Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs index 5205543b1..b0af1974f 100644 --- a/Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs +++ b/Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs @@ -9,6 +9,7 @@ using Flow.Launcher.Infrastructure.UserSettings; namespace Flow.Launcher.Infrastructure.Storage { +#pragma warning disable SYSLIB0011 // BinaryFormatter is obsolete. /// /// Stroage object using binary data /// Normally, it has better performance, but not readable @@ -113,4 +114,5 @@ namespace Flow.Launcher.Infrastructure.Storage } } } +#pragma warning enable SYSLIB0011 } diff --git a/Flow.Launcher.Plugin/AllowedLanguage.cs b/Flow.Launcher.Plugin/AllowedLanguage.cs index 827958a7b..d4c8b0d2f 100644 --- a/Flow.Launcher.Plugin/AllowedLanguage.cs +++ b/Flow.Launcher.Plugin/AllowedLanguage.cs @@ -1,5 +1,6 @@ namespace Flow.Launcher.Plugin { +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member public static class AllowedLanguage { public static string Python @@ -35,4 +36,5 @@ || language.ToUpper() == Executable.ToUpper(); } } -} \ No newline at end of file +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member +} diff --git a/Flow.Launcher.Plugin/BaseModel.cs b/Flow.Launcher.Plugin/BaseModel.cs index 5bb558702..a4d666ced 100644 --- a/Flow.Launcher.Plugin/BaseModel.cs +++ b/Flow.Launcher.Plugin/BaseModel.cs @@ -4,14 +4,24 @@ using JetBrains.Annotations; namespace Flow.Launcher.Plugin { + /// + /// Base model for plugin classes + /// public class BaseModel : INotifyPropertyChanged { + /// + /// Property changed event handler + /// public event PropertyChangedEventHandler PropertyChanged; + /// + /// Invoked when a property changes + /// + /// [NotifyPropertyChangedInvocator] protected void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } -} \ No newline at end of file +} diff --git a/Flow.Launcher.Plugin/EventHandler.cs b/Flow.Launcher.Plugin/EventHandler.cs index 476668584..009e1721c 100644 --- a/Flow.Launcher.Plugin/EventHandler.cs +++ b/Flow.Launcher.Plugin/EventHandler.cs @@ -3,9 +3,24 @@ using System.Windows.Input; namespace Flow.Launcher.Plugin { + /// + /// Delegate for key down event + /// + /// public delegate void FlowLauncherKeyDownEventHandler(FlowLauncherKeyDownEventArgs e); + + /// + /// Delegate for query event + /// + /// public delegate void AfterFlowLauncherQueryEventHandler(FlowLauncherQueryEventArgs e); + /// + /// Delegate for drop events [unused?] + /// + /// + /// + /// public delegate void ResultItemDropEventHandler(Result result, IDataObject dropObject, DragEventArgs e); /// @@ -17,14 +32,30 @@ namespace Flow.Launcher.Plugin /// return true to continue handling, return false to intercept system handling public delegate bool FlowLauncherGlobalKeyboardEventHandler(int keyevent, int vkcode, SpecialKeyState state); + /// + /// Arguments container for the Key Down event + /// public class FlowLauncherKeyDownEventArgs { + /// + /// The actual query + /// public string Query { get; set; } + + /// + /// Relevant key events for this event + /// public KeyEventArgs keyEventArgs { get; set; } } + /// + /// Arguments container for the Query event + /// public class FlowLauncherQueryEventArgs { + /// + /// The actual query + /// public Query Query { get; set; } } } diff --git a/Flow.Launcher.Plugin/Interfaces/IAsyncReloadable.cs b/Flow.Launcher.Plugin/Interfaces/IAsyncReloadable.cs index bd4500a7e..3d5f44a0d 100644 --- a/Flow.Launcher.Plugin/Interfaces/IAsyncReloadable.cs +++ b/Flow.Launcher.Plugin/Interfaces/IAsyncReloadable.cs @@ -15,6 +15,10 @@ namespace Flow.Launcher.Plugin /// public interface IAsyncReloadable : IFeatures { + /// + /// Reload plugin data + /// + /// Task ReloadDataAsync(); } -} \ No newline at end of file +} diff --git a/Flow.Launcher.Plugin/Interfaces/IReloadable.cs b/Flow.Launcher.Plugin/Interfaces/IReloadable.cs index bd1ad406e..707f8d92c 100644 --- a/Flow.Launcher.Plugin/Interfaces/IReloadable.cs +++ b/Flow.Launcher.Plugin/Interfaces/IReloadable.cs @@ -17,6 +17,9 @@ /// public interface IReloadable : IFeatures { + /// + /// Synchronously reload plugin data + /// void ReloadData(); } -} \ No newline at end of file +} diff --git a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs index a1a4eea8e..5cb3a171a 100644 --- a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs +++ b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs @@ -5,6 +5,9 @@ using System.Windows; namespace Flow.Launcher.Plugin.SharedCommands { + /// + /// Commands that are useful to run on files... and folders! + /// public static class FilesFolders { private const string FileExplorerProgramName = "explorer"; @@ -65,6 +68,13 @@ namespace Flow.Launcher.Plugin.SharedCommands } + /// + /// Check if the files and directories are identical between + /// and + /// + /// + /// + /// public static bool VerifyBothFolderFilesEqual(this string fromPath, string toPath) { try @@ -92,6 +102,10 @@ namespace Flow.Launcher.Plugin.SharedCommands } + /// + /// Deletes a folder if it exists + /// + /// public static void RemoveFolderIfExists(this string path) { try @@ -109,16 +123,30 @@ namespace Flow.Launcher.Plugin.SharedCommands } } + /// + /// Checks if a directory exists + /// + /// + /// public static bool LocationExists(this string path) { return Directory.Exists(path); } + /// + /// Checks if a file exists + /// + /// + /// public static bool FileExists(this string filePath) { return File.Exists(filePath); } + /// + /// Open a directory window (using the OS's default handler, usually explorer) + /// + /// public static void OpenPath(string fileOrFolderPath) { var psi = new ProcessStartInfo { FileName = FileExplorerProgramName, UseShellExecute = true, Arguments = '"' + fileOrFolderPath + '"' }; @@ -137,6 +165,10 @@ namespace Flow.Launcher.Plugin.SharedCommands } } + /// + /// Open the folder that contains + /// + /// public static void OpenContainingFolder(string path) { Process.Start(FileExplorerProgramEXE, $" /select,\"{path}\""); diff --git a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs index ab4047cec..b98df9a94 100644 --- a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs +++ b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs @@ -81,7 +81,7 @@ namespace Flow.Launcher } tbAction.Text = updateCustomHotkey.ActionKeyword; - ctlHotkey.SetHotkey(updateCustomHotkey.Hotkey, false); + _ = ctlHotkey.SetHotkey(updateCustomHotkey.Hotkey, false); update = true; lblAdd.Text = InternationalizationManager.Instance.GetTranslation("update"); } diff --git a/Flow.Launcher/Helper/SingleInstance.cs b/Flow.Launcher/Helper/SingleInstance.cs index 1a1e6ec3c..606e02cc3 100644 --- a/Flow.Launcher/Helper/SingleInstance.cs +++ b/Flow.Launcher/Helper/SingleInstance.cs @@ -400,6 +400,7 @@ namespace Flow.Launcher.Helper /// to ensure that lease never expires. /// /// Always null. + [Obsolete] // overrides an obsolete method, so also needs to be obsolete public override object InitializeLifetimeService() { return null; diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 7af435639..5fef5499b 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -82,7 +82,7 @@ namespace Flow.Launcher ImageLoader.Save(); } - public Task ReloadAllPluginData() => PluginManager.ReloadData(); + public Task ReloadAllPluginData() => PluginManager.ReloadDataAsync(); public void ShowMsgError(string title, string subTitle = "") => ShowMsg(title, subTitle, Constant.ErrorIcon, true); diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 0e66cc733..38b5e0a5a 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -101,7 +101,7 @@ namespace Flow.Launcher private void OnHotkeyControlLoaded(object sender, RoutedEventArgs e) { - HotkeyControl.SetHotkey(viewModel.Settings.Hotkey, false); + _ = HotkeyControl.SetHotkey(viewModel.Settings.Hotkey, false); } private void OnHotkeyControlFocused(object sender, RoutedEventArgs e) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 061bf49d9..e62899261 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -300,7 +300,7 @@ namespace Flow.Launcher.ViewModel Hide(); _ = PluginManager - .ReloadData() + .ReloadDataAsync() .ContinueWith(_ => Application.Current.Dispatcher.Invoke(() => { diff --git a/Flow.Launcher/ViewModel/RelayCommand.cs b/Flow.Launcher/ViewModel/RelayCommand.cs index ee4140ed5..e8d4af8b5 100644 --- a/Flow.Launcher/ViewModel/RelayCommand.cs +++ b/Flow.Launcher/ViewModel/RelayCommand.cs @@ -5,7 +5,7 @@ namespace Flow.Launcher.ViewModel { public class RelayCommand : ICommand { - private Action _action; + private readonly Action _action; public RelayCommand(Action action) { @@ -17,7 +17,9 @@ namespace Flow.Launcher.ViewModel return true; } +#pragma warning disable CS0067 // the event is never used public event EventHandler CanExecuteChanged; +#pragma warning restore CS0067 public virtual void Execute(object parameter) { diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index 634382109..c4cd19eec 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Specialized; @@ -53,7 +53,7 @@ namespace Flow.Launcher.Plugin.Program { if (IsStartupIndexProgramsRequired) - _ = IndexPrograms(); + _ = IndexProgramsAsync(); var result = await cache.GetOrCreateAsync(query.Search, async entry => { @@ -122,7 +122,7 @@ namespace Flow.Launcher.Plugin.Program { if (indexedWinApps && indexedUWPApps) _settings.LastIndexTime = DateTime.Today; - }); + }, TaskScheduler.Current); if (!(_win32s.Any() && _uwps.Any())) await indexTask; @@ -142,7 +142,7 @@ namespace Flow.Launcher.Plugin.Program _uwps = applications; } - public static async Task IndexPrograms() + public static async Task IndexProgramsAsync() { var t1 = Task.Run(IndexWin32Programs); var t2 = Task.Run(IndexUwpPrograms); @@ -246,7 +246,7 @@ namespace Flow.Launcher.Plugin.Program public async Task ReloadDataAsync() { - await IndexPrograms(); + await IndexProgramsAsync(); } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index 2a04b2b2e..d0118f3c9 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -157,8 +157,7 @@ namespace Flow.Launcher.Plugin.Program.Programs #if !DEBUG catch (Exception e) { - ProgramLogger.LogException($"|UWP|All|{p.InstalledLocation}|An unexpected error occured and " - + $"unable to convert Package to UWP for {p.Id.FullName}", e); + _ = ProgramLogger.LogException($"|UWP|All|{p.InstalledLocation}|An unexpected error occured and " + $"unable to convert Package to UWP for {p.Id.FullName}", e); return new Application[] { }; } #endif @@ -397,7 +396,7 @@ namespace Flow.Launcher.Plugin.Program.Programs { try { - appManager.ActivateApplication(UserModelId, noArgs, noFlags, out _); + _ = appManager.ActivateApplication(UserModelId, noArgs, noFlags, out _); } catch (Exception) { @@ -428,10 +427,10 @@ namespace Flow.Launcher.Plugin.Program.Programs manifestApp.GetAppUserModelId(out string tmpUserModelId); manifestApp.GetAppUserModelId(out string tmpUniqueIdentifier); - manifestApp.GetStringValue("DisplayName", out string tmpDisplayName); - manifestApp.GetStringValue("Description", out string tmpDescription); - manifestApp.GetStringValue("BackgroundColor", out string tmpBackgroundColor); - manifestApp.GetStringValue("EntryPoint", out string tmpEntryPoint); + _ = manifestApp.GetStringValue("DisplayName", out string tmpDisplayName); + _ = manifestApp.GetStringValue("Description", out string tmpDescription); + _ = manifestApp.GetStringValue("BackgroundColor", out string tmpBackgroundColor); + _ = manifestApp.GetStringValue("EntryPoint", out string tmpEntryPoint); UserModelId = tmpUserModelId; UniqueIdentifier = tmpUniqueIdentifier; @@ -540,7 +539,7 @@ namespace Flow.Launcher.Plugin.Program.Programs if (logoKeyFromVersion.ContainsKey(Package.Version)) { var key = logoKeyFromVersion[Package.Version]; - app.GetStringValue(key, out string logoUri); + _ = app.GetStringValue(key, out string logoUri); return logoUri; } else @@ -729,4 +728,4 @@ namespace Flow.Launcher.Plugin.Program.Programs private static extern Hresult SHLoadIndirectString(string pszSource, StringBuilder pszOutBuf, uint cchOutBuf, IntPtr ppvReserved); } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index 1464bd785..ba6ada3b6 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -517,9 +517,9 @@ namespace Flow.Launcher.Plugin.Program.Programs return programs.Concat(autoIndexPrograms).Distinct().ToArray(); } #if DEBUG //This is to make developer aware of any unhandled exception and add in handling. - catch (Exception e) + catch (Exception) { - throw e; + throw; } #endif @@ -546,4 +546,4 @@ namespace Flow.Launcher.Plugin.Program.Programs return UniqueIdentifier == other.UniqueIdentifier; } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs index a8d6c25e7..1a31e8c28 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs @@ -119,7 +119,7 @@ namespace Flow.Launcher.Plugin.Program.Views { ViewRefresh(); indexingPanel.Visibility = Visibility.Visible; - await Main.IndexPrograms(); + await Main.IndexProgramsAsync(); indexingPanel.Visibility = Visibility.Hidden; } diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs index cdf0a3fa2..808f8ef19 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs @@ -270,11 +270,12 @@ namespace Flow.Launcher.Plugin.Sys // Hide the window first then show msg after done because sometimes the reload could take a while, so not to make user think it's frozen. Application.Current.MainWindow.Hide(); - context.API.ReloadAllPluginData().ContinueWith(_ => + _ = context.API.ReloadAllPluginData().ContinueWith(_ => context.API.ShowMsg( context.API.GetTranslation("flowlauncher_plugin_sys_dlgtitle_success"), context.API.GetTranslation( - "flowlauncher_plugin_sys_dlgtext_all_applicableplugins_reloaded"))); + "flowlauncher_plugin_sys_dlgtext_all_applicableplugins_reloaded")), + System.Threading.Tasks.TaskScheduler.Current); return true; } diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs index 2495abe66..372e601e0 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Infrastructure.Image; +using Flow.Launcher.Infrastructure.Image; using System; using System.Drawing; using System.IO; @@ -34,10 +34,10 @@ namespace Flow.Launcher.Plugin.WebSearch { File.Copy(fullpathToSelectedImage, destinationFileNameFullPath); } - catch (Exception e) + catch (Exception) { #if DEBUG - throw e; + throw; #else MessageBox.Show(string.Format("Copying the selected image file to {0} has failed, changes will now be reverted", destinationFileNameFullPath)); UpdateIconAttributes(selectedSearchSource, fullPathToOriginalImage);