diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..11a0bcdf6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,146 @@ +# To learn more about .editorconfig see https://aka.ms/editorconfigdocs +############################### +# Core EditorConfig Options # +############################### +# All files +[*] +indent_style = space + +# XML project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] +indent_size = 2 + +# XML config files +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] +indent_size = 2 + +# Code files +[*.{cs,csx,vb,vbx}] +indent_size = 4 +insert_final_newline = true +charset = utf-8-bom +############################### +# .NET Coding Conventions # +############################### +[*.{cs,vb}] +# Organize usings +dotnet_sort_system_directives_first = true +# this. preferences +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_property = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_event = false:silent +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent +dotnet_style_readonly_field = true:suggestion +# Expression-level preferences +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +############################### +# Naming Conventions # +############################### +# Style Definitions +dotnet_naming_style.pascal_case_style.capitalization = pascal_case +# Use PascalCase for constant fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.applicable_accessibilities = * +dotnet_naming_symbols.constant_fields.required_modifiers = const +dotnet_style_operator_placement_when_wrapping = beginning_of_line +tab_width = 2 +end_of_line = crlf +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_diagnostic.CA1416.severity = silent +############################### +# C# Coding Conventions # +############################### +[*.cs] +dotnet_diagnostics.VSTHRD200.severity = none # VSTHRD200: Use "Async" suffix for async methods +dotnet_analyzer_diagnostic.VSTHRD200.severity = none # VSTHRD200: Use "Async" suffix for async methods +# var preferences +csharp_style_var_for_built_in_types = true:silent +csharp_style_var_when_type_is_apparent = true:silent +csharp_style_var_elsewhere = true:silent +# Expression-bodied members +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_accessors = true:silent +# Pattern matching preferences +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +# Null-checking preferences +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion +# Modifier preferences +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion +# Expression-level preferences +csharp_prefer_braces = true:silent +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +############################### +# C# Formatting Rules # +############################### +# New line preferences +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true +# Indentation preferences +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_indent_labels = flush_left +# Space preferences +csharp_space_after_cast = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_around_binary_operators = before_and_after +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +# Wrapping preferences +csharp_preserve_single_line_statements = true +csharp_preserve_single_line_blocks = true +csharp_using_directive_placement = outside_namespace:silent +csharp_prefer_simple_using_statement = true:suggestion +csharp_style_namespace_declarations = block_scoped:silent +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +############################### +# VB Coding Conventions # +############################### +[*.vb] +# Modifier preferences +visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion diff --git a/Flow.Launcher.Core/Configuration/Portable.cs b/Flow.Launcher.Core/Configuration/Portable.cs index 5bca087b8..bd77ea7cf 100644 --- a/Flow.Launcher.Core/Configuration/Portable.cs +++ b/Flow.Launcher.Core/Configuration/Portable.cs @@ -1,4 +1,4 @@ -using Microsoft.Win32; +using Microsoft.Win32; using Squirrel; using System; using System.IO; @@ -127,7 +127,7 @@ namespace Flow.Launcher.Core.Configuration using (var portabilityUpdater = NewUpdateManager()) { - portabilityUpdater.CreateUninstallerRegistryEntry(); + _ = portabilityUpdater.CreateUninstallerRegistryEntry(); } } diff --git a/Flow.Launcher.Core/Plugin/PluginsLoader.cs b/Flow.Launcher.Core/Plugin/PluginsLoader.cs index b3d56221a..646ead77a 100644 --- a/Flow.Launcher.Core/Plugin/PluginsLoader.cs +++ b/Flow.Launcher.Core/Plugin/PluginsLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -98,7 +98,7 @@ namespace Flow.Launcher.Core.Plugin + (erroredPlugins.Count > 1 ? "plugins have " : "plugin has ") + "errored and cannot be loaded:"; - Task.Run(() => + _ = Task.Run(() => { MessageBox.Show($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" + $"{errorPluginString}{Environment.NewLine}{Environment.NewLine}" + diff --git a/Flow.Launcher.Core/Properties/AssemblyInfo.cs b/Flow.Launcher.Core/Properties/AssemblyInfo.cs index 40017c46c..3a72118eb 100644 --- a/Flow.Launcher.Core/Properties/AssemblyInfo.cs +++ b/Flow.Launcher.Core/Properties/AssemblyInfo.cs @@ -1,3 +1,4 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Flow.Launcher.Test")] \ No newline at end of file +[assembly: InternalsVisibleTo("Flow.Launcher.Test")] +[assembly: System.Runtime.Versioning.SupportedOSPlatform("Windows10.0.19041.0")] diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index 6561419a1..e0c6fe941 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -99,7 +99,7 @@ namespace Flow.Launcher.Core.Resource SetBlurForWindow(); } - catch (DirectoryNotFoundException e) + catch (DirectoryNotFoundException) { Log.Error($"|Theme.ChangeTheme|Theme <{theme}> path can't be found"); if (theme != defaultTheme) @@ -109,7 +109,7 @@ namespace Flow.Launcher.Core.Resource } return false; } - catch (XamlParseException e) + catch (XamlParseException) { Log.Error($"|Theme.ChangeTheme|Theme <{theme}> fail to parse"); if (theme != defaultTheme) diff --git a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs index 3849f6e30..3f77dce47 100644 --- a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs +++ b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs @@ -166,7 +166,7 @@ namespace Flow.Launcher.Infrastructure.Exception } return result; } - catch (System.Exception e) + catch { return new List(); } diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index ac333d567..9d42ff88b 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; @@ -46,7 +46,7 @@ namespace Flow.Launcher.Infrastructure.Image ImageCache[icon] = img; } - Task.Run(() => + _ = Task.Run(() => { Stopwatch.Normal("|ImageLoader.Initialize|Preload images cost", () => { diff --git a/Flow.Launcher.Infrastructure/Properties/AssemblyInfo.cs b/Flow.Launcher.Infrastructure/Properties/AssemblyInfo.cs index 4cdadffc9..3c29d0dcb 100644 --- a/Flow.Launcher.Infrastructure/Properties/AssemblyInfo.cs +++ b/Flow.Launcher.Infrastructure/Properties/AssemblyInfo.cs @@ -2,4 +2,5 @@ [assembly: InternalsVisibleTo("Flow.Launcher")] [assembly: InternalsVisibleTo("Flow.Launcher.Core")] -[assembly: InternalsVisibleTo("Flow.Launcher.Test")] \ No newline at end of file +[assembly: InternalsVisibleTo("Flow.Launcher.Test")] +[assembly: System.Runtime.Versioning.SupportedOSPlatform("Windows10.0.19041.0")] diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index 69057820e..41d062570 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -1,7 +1,8 @@ -using Flow.Launcher.Plugin.SharedModels; +using Flow.Launcher.Plugin.SharedModels; using JetBrains.Annotations; using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Runtime.CompilerServices; using System.Threading; @@ -41,7 +42,7 @@ namespace Flow.Launcher.Plugin /// /// Copy Text to clipboard /// - /// Text to save on clipboard + /// Text to save on clipboard public void CopyToClipboard(string text); /// @@ -163,6 +164,7 @@ namespace Flow.Launcher.Plugin /// Download the specific url to a cretain file path /// /// URL to download file + /// path to save downloaded file /// place to store file /// Task showing the progress Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath, CancellationToken token = default); @@ -178,7 +180,7 @@ namespace Flow.Launcher.Plugin /// Remove ActionKeyword for specific plugin /// /// ID for plugin that needs to remove action keyword - /// The actionkeyword that is supposed to be removed + /// The actionkeyword that is supposed to be removed void RemoveActionKeyword(string pluginId, string oldActionKeyword); /// diff --git a/Flow.Launcher.Plugin/Properties/AssemblyInfo.cs b/Flow.Launcher.Plugin/Properties/AssemblyInfo.cs index 4cdadffc9..0a602a472 100644 --- a/Flow.Launcher.Plugin/Properties/AssemblyInfo.cs +++ b/Flow.Launcher.Plugin/Properties/AssemblyInfo.cs @@ -2,4 +2,4 @@ [assembly: InternalsVisibleTo("Flow.Launcher")] [assembly: InternalsVisibleTo("Flow.Launcher.Core")] -[assembly: InternalsVisibleTo("Flow.Launcher.Test")] \ No newline at end of file +[assembly: InternalsVisibleTo("Flow.Launcher.Test")] diff --git a/Flow.Launcher.Plugin/Query.cs b/Flow.Launcher.Plugin/Query.cs index 3fcf3c1d7..95547d273 100644 --- a/Flow.Launcher.Plugin/Query.cs +++ b/Flow.Launcher.Plugin/Query.cs @@ -16,7 +16,9 @@ namespace Flow.Launcher.Plugin { Search = search; RawQuery = rawQuery; +#pragma warning disable CS0618 Terms = terms; +#pragma warning restore CS0618 SearchTerms = searchTerms; ActionKeyword = actionKeyword; } @@ -98,4 +100,4 @@ namespace Flow.Launcher.Plugin public override string ToString() => RawQuery; } -} \ No newline at end of file +} diff --git a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs index be33bd86c..a1a4eea8e 100644 --- a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs +++ b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs @@ -53,10 +53,10 @@ namespace Flow.Launcher.Plugin.SharedCommands CopyAll(subdir.FullName, temppath); } } - catch (Exception e) + catch (Exception) { #if DEBUG - throw e; + throw; #else MessageBox.Show(string.Format("Copying path {0} has failed, it will now be deleted for consistency", targetPath)); RemoveFolderIfExists(targetPath); @@ -80,10 +80,10 @@ namespace Flow.Launcher.Plugin.SharedCommands return true; } - catch (Exception e) + catch (Exception) { #if DEBUG - throw e; + throw; #else MessageBox.Show(string.Format("Unable to verify folders and files between {0} and {1}", fromPath, toPath)); return false; @@ -99,10 +99,10 @@ namespace Flow.Launcher.Plugin.SharedCommands if (Directory.Exists(path)) Directory.Delete(path, true); } - catch (Exception e) + catch (Exception) { #if DEBUG - throw e; + throw; #else MessageBox.Show(string.Format("Not able to delete folder {0}, please go to the location and manually delete it", path)); #endif @@ -127,10 +127,10 @@ namespace Flow.Launcher.Plugin.SharedCommands if (LocationExists(fileOrFolderPath) || FileExists(fileOrFolderPath)) Process.Start(psi); } - catch (Exception e) + catch (Exception) { #if DEBUG - throw e; + throw; #else MessageBox.Show(string.Format("Unable to open the path {0}, please check if it exists", fileOrFolderPath)); #endif diff --git a/Flow.Launcher.Plugin/SharedCommands/ShellCommand.cs b/Flow.Launcher.Plugin/SharedCommands/ShellCommand.cs index a2eea19a7..c18f8b90c 100644 --- a/Flow.Launcher.Plugin/SharedCommands/ShellCommand.cs +++ b/Flow.Launcher.Plugin/SharedCommands/ShellCommand.cs @@ -1,6 +1,8 @@ -using System; +using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; +using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; @@ -87,7 +89,8 @@ namespace Flow.Launcher.Plugin.SharedCommands /// /// Runs a windows command using the provided ProcessStartInfo using a custom execute command function /// - /// allows you to pass in a custom command execution function + /// allows you to pass in a custom command execution function + /// allows you to pass in the info that will be passed to startProcess /// Thrown when unable to find the file specified in the command /// Thrown when error occurs during the execution of the command public static void Execute(Func startProcess, ProcessStartInfo info) diff --git a/Flow.Launcher.sln b/Flow.Launcher.sln index b8deae553..ec4a29ee7 100644 --- a/Flow.Launcher.sln +++ b/Flow.Launcher.sln @@ -43,6 +43,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Url", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FFD651C7-0546-441F-BC8C-D4EE8FD01EA7}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig .gitattributes = .gitattributes .gitignore = .gitignore appveyor.yml = appveyor.yml diff --git a/Flow.Launcher/Helper/WindowsInteropHelper.cs b/Flow.Launcher/Helper/WindowsInteropHelper.cs index f1e8b2099..4811eb224 100644 --- a/Flow.Launcher/Helper/WindowsInteropHelper.cs +++ b/Flow.Launcher/Helper/WindowsInteropHelper.cs @@ -69,7 +69,7 @@ namespace Flow.Launcher.Helper //get current active window IntPtr hWnd = GetForegroundWindow(); - if (hWnd != null && !hWnd.Equals(IntPtr.Zero)) + if (!hWnd.Equals(IntPtr.Zero)) { //if current active window is NOT desktop or shell if (!(hWnd.Equals(HWND_DESKTOP) || hWnd.Equals(HWND_SHELL))) @@ -98,7 +98,7 @@ namespace Flow.Launcher.Helper { IntPtr hWndDesktop = FindWindowEx(hWnd, IntPtr.Zero, "SHELLDLL_DefView", null); hWndDesktop = FindWindowEx(hWndDesktop, IntPtr.Zero, "SysListView32", "FolderView"); - if (hWndDesktop != null && !hWndDesktop.Equals(IntPtr.Zero)) + if (!hWndDesktop.Equals(IntPtr.Zero)) { return false; } @@ -160,4 +160,4 @@ namespace Flow.Launcher.Helper public int Bottom; } } -} \ No newline at end of file +} diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs index bc437d862..c69d73c02 100644 --- a/Flow.Launcher/HotkeyControl.xaml.cs +++ b/Flow.Launcher/HotkeyControl.xaml.cs @@ -103,7 +103,7 @@ namespace Flow.Launcher public void SetHotkey(string keyStr, bool triggerValidate = true) { - SetHotkey(new HotkeyModel(keyStr), triggerValidate); + _ = SetHotkey(new HotkeyModel(keyStr), triggerValidate); } private bool CheckHotkeyAvailability() => HotKeyMapper.CheckAvailability(CurrentHotkey); diff --git a/Flow.Launcher/Properties/AssemblyInfo.cs b/Flow.Launcher/Properties/AssemblyInfo.cs index 332bfac3f..7c86c52aa 100644 --- a/Flow.Launcher/Properties/AssemblyInfo.cs +++ b/Flow.Launcher/Properties/AssemblyInfo.cs @@ -4,4 +4,5 @@ using System.Windows; [assembly: ThemeInfo( ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly -)] \ No newline at end of file +)] +[assembly: System.Runtime.Versioning.SupportedOSPlatform("Windows10.0.19041.0")] diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 81f7a2389..7201f75b2 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -23,7 +23,6 @@ using System.Runtime.CompilerServices; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.Storage; using System.Collections.Concurrent; -using Flow.Launcher.Plugin.SharedCommands; using System.Diagnostics; namespace Flow.Launcher diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 120131830..2d340c711 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Core.ExternalPlugins; +using Flow.Launcher.Core.ExternalPlugins; using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Resource; using Flow.Launcher.Helper; @@ -35,7 +35,6 @@ namespace Flow.Launcher public readonly IPublicAPI API; private Settings settings; private SettingWindowViewModel viewModel; - private static MainViewModel mainViewModel; public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel) { @@ -264,7 +263,7 @@ namespace Flow.Launcher #endregion - private async void OnCheckUpdates(object sender, RoutedEventArgs e) + private void OnCheckUpdates(object sender, RoutedEventArgs e) { viewModel.UpdateApp(); // TODO: change to command } @@ -384,4 +383,4 @@ namespace Flow.Launcher Plugins.ScrollIntoView(Plugins.SelectedItem); } } -} \ No newline at end of file +} diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index fbcea504e..fe908ef8d 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -299,7 +299,7 @@ namespace Flow.Launcher.ViewModel { Hide(); - PluginManager + _ = PluginManager .ReloadData() .ContinueWith(_ => Application.Current.Dispatcher.Invoke(() => @@ -308,7 +308,7 @@ namespace Flow.Launcher.ViewModel InternationalizationManager.Instance.GetTranslation("success"), InternationalizationManager.Instance.GetTranslation("completedSuccessfully"), ""); - })) + }), TaskScheduler.Default) .ConfigureAwait(false); }); } @@ -927,4 +927,4 @@ namespace Flow.Launcher.ViewModel #endregion } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs index ea278b49b..5473a6b91 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Runtime.InteropServices; @@ -98,7 +98,7 @@ namespace Flow.Launcher.Plugin.Caculator Clipboard.SetDataObject(newResult); return true; } - catch (ExternalException e) + catch (ExternalException) { MessageBox.Show("Copy failed, please try later"); return false; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs index f499274a9..4bc6705f4 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -202,7 +202,7 @@ namespace Flow.Launcher.Plugin.Explorer { try { - Task.Run(() => ShellCommand.RunAsDifferentUser(record.FullPath.SetProcessStartInfo())); + _ = Task.Run(() => ShellCommand.RunAsDifferentUser(record.FullPath.SetProcessStartInfo())); } catch (FileNotFoundException e) { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 8ce627a44..0251c9d68 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -93,7 +93,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search Settings.ActionKeyword.IndexSearchActionKeyword => Settings.IndexSearchKeywordEnabled && keyword == Settings.IndexSearchActionKeyword, Settings.ActionKeyword.QuickAccessActionKeyword => Settings.QuickAccessKeywordEnabled && - keyword == Settings.QuickAccessActionKeyword + keyword == Settings.QuickAccessActionKeyword, + _ => false }; } @@ -224,4 +225,4 @@ namespace Flow.Launcher.Plugin.Explorer.Search return IndexSearch.PathIsIndexed(pathToDirectory); } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs index dd8a05b0f..a8b7ea827 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; @@ -378,7 +378,7 @@ namespace Flow.Launcher.Plugin.Shell Title = context.API.GetTranslation("flowlauncher_plugin_cmd_run_as_different_user"), Action = c => { - Task.Run(() => Execute(ShellCommand.RunAsDifferentUser, PrepareProcessStartInfo(selectedResult.Title))); + _ = Task.Run(() => Execute(ShellCommand.RunAsDifferentUser, PrepareProcessStartInfo(selectedResult.Title))); return true; }, IcoPath = "Images/user.png" @@ -408,4 +408,4 @@ namespace Flow.Launcher.Plugin.Shell return resultlist; } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs index 78e4893a5..cdf0a3fa2 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -340,4 +340,4 @@ namespace Flow.Launcher.Plugin.Sys return context.API.GetTranslation("flowlauncher_plugin_sys_plugin_description"); } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.Url/Main.cs b/Plugins/Flow.Launcher.Plugin.Url/Main.cs index 9d5b528ec..c507f0b1c 100644 --- a/Plugins/Flow.Launcher.Plugin.Url/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Url/Main.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text.RegularExpressions; using System.Windows.Controls; @@ -72,7 +72,7 @@ namespace Flow.Launcher.Plugin.Url return true; } - catch(Exception ex) + catch(Exception) { context.API.ShowMsg(string.Format(context.API.GetTranslation("flowlauncher_plugin_url_canot_open_url"), raw)); return false; @@ -124,4 +124,4 @@ namespace Flow.Launcher.Plugin.Url return context.API.GetTranslation("flowlauncher_plugin_url_plugin_description"); } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSource.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSource.cs index 98e9376fb..caed3f16c 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSource.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSource.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Windows.Media; using JetBrains.Annotations; using Flow.Launcher.Infrastructure.Image; @@ -41,14 +41,14 @@ namespace Flow.Launcher.Plugin.WebSearch { var webSearch = new SearchSource { - Title = string.Copy(Title), - ActionKeyword = string.Copy(ActionKeyword), - Url = string.Copy(Url), - Icon = string.Copy(Icon), + Title = Title, + ActionKeyword = ActionKeyword, + Url = Url, + Icon = Icon, CustomIcon = CustomIcon, Enabled = Enabled }; return webSearch; } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs index d1fbd4ac5..40379b1ed 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs @@ -23,7 +23,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources try { const string api = "http://suggestion.baidu.com/su?json=1&wd="; - result = await Http.GetAsync(api + Uri.EscapeUriString(query), token).ConfigureAwait(false); + result = await Http.GetAsync(api + Uri.EscapeDataString(query), token).ConfigureAwait(false); } catch (Exception e) when (e is HttpRequestException or {InnerException: TimeoutException}) { @@ -59,4 +59,4 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources return "Baidu"; } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs index 971fc079c..e01b66df5 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs @@ -22,7 +22,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources { const string api = "https://api.bing.com/qsonhs.aspx?q="; - using var resultStream = await Http.GetStreamAsync(api + Uri.EscapeUriString(query), token).ConfigureAwait(false); + using var resultStream = await Http.GetStreamAsync(api + Uri.EscapeDataString(query), token).ConfigureAwait(false); using var json = (await JsonDocument.ParseAsync(resultStream, cancellationToken: token)); var root = json.RootElement.GetProperty("AS"); diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs index a6c18b1ef..bde63ab29 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs @@ -20,7 +20,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources { const string api = "https://www.google.com/complete/search?output=chrome&q="; - using var resultStream = await Http.GetStreamAsync(api + Uri.EscapeUriString(query)).ConfigureAwait(false); + using var resultStream = await Http.GetStreamAsync(api + Uri.EscapeDataString(query)).ConfigureAwait(false); using var json = await JsonDocument.ParseAsync(resultStream, cancellationToken: token); @@ -49,4 +49,4 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources return "Google"; } } -} \ No newline at end of file +} diff --git a/SolutionAssemblyInfo.cs b/SolutionAssemblyInfo.cs index 1482bce9e..00b62b958 100644 --- a/SolutionAssemblyInfo.cs +++ b/SolutionAssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; #if DEBUG @@ -18,4 +18,5 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyFileVersion("1.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("1.0.0")] +[assembly: System.Runtime.Versioning.SupportedOSPlatform("Windows10.0.19041.0")]