mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #1314 from nachmore/warnings
Fix (some) build warnings
This commit is contained in:
commit
af7efd8347
57 changed files with 437 additions and 184 deletions
146
.editorconfig
Normal file
146
.editorconfig
Normal file
|
|
@ -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
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
<PackageReference Include="Droplex" Version="1.4.1" />
|
||||
<PackageReference Include="FSharp.Core" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.1.3" />
|
||||
<PackageReference Include="squirrel.windows" Version="1.5.2" />
|
||||
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -69,7 +69,13 @@ namespace Flow.Launcher.Core.Plugin
|
|||
private static readonly JsonSerializerOptions options = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
#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,7 +88,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
};
|
||||
private Dictionary<string, object> Settings { get; set; }
|
||||
|
||||
private Dictionary<string, FrameworkElement> _settingControls = new();
|
||||
private readonly Dictionary<string, FrameworkElement> _settingControls = new();
|
||||
|
||||
private async Task<List<Result>> DeserializedResultAsync(Stream output)
|
||||
{
|
||||
|
|
@ -535,4 +541,4 @@ namespace Flow.Launcher.Core.Plugin
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
@ -109,7 +109,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
/// Call initialize for all plugins
|
||||
/// </summary>
|
||||
/// <returns>return the list of failed to init plugins or null for none</returns>
|
||||
public static async Task InitializePlugins(IPublicAPI api)
|
||||
public static async Task InitializePluginsAsync(IPublicAPI api)
|
||||
{
|
||||
API = api;
|
||||
var failedPlugins = new ConcurrentQueue<PluginPair>();
|
||||
|
|
@ -327,4 +327,4 @@ namespace Flow.Launcher.Core.Plugin
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -11,7 +11,6 @@ using Flow.Launcher.Infrastructure.Logger;
|
|||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
using System.Diagnostics;
|
||||
using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;
|
||||
|
||||
namespace Flow.Launcher.Core.Plugin
|
||||
|
|
@ -41,14 +40,6 @@ namespace Flow.Launcher.Core.Plugin
|
|||
var milliseconds = Stopwatch.Debug(
|
||||
$"|PluginsLoader.DotNetPlugins|Constructor init cost for {metadata.Name}", () =>
|
||||
{
|
||||
#if DEBUG
|
||||
var assemblyLoader = new PluginAssemblyLoader(metadata.ExecuteFilePath);
|
||||
var assembly = assemblyLoader.LoadAssemblyAndDependencies();
|
||||
var type = assemblyLoader.FromAssemblyGetTypeOfInterface(assembly,
|
||||
typeof(IAsyncPlugin));
|
||||
|
||||
var plugin = Activator.CreateInstance(type) as IAsyncPlugin;
|
||||
#else
|
||||
Assembly assembly = null;
|
||||
IAsyncPlugin plugin = null;
|
||||
|
||||
|
|
@ -62,6 +53,12 @@ namespace Flow.Launcher.Core.Plugin
|
|||
|
||||
plugin = Activator.CreateInstance(type) as IAsyncPlugin;
|
||||
}
|
||||
#if DEBUG
|
||||
catch (Exception e)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
#else
|
||||
catch (Exception e) when (assembly == null)
|
||||
{
|
||||
Log.Exception($"|PluginsLoader.DotNetPlugins|Couldn't load assembly for the plugin: {metadata.Name}", e);
|
||||
|
|
@ -79,6 +76,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
Log.Exception($"|PluginsLoader.DotNetPlugins|The following plugin has errored and can not be loaded: <{metadata.Name}>", e);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (plugin == null)
|
||||
{
|
||||
erroredPlugins.Add(metadata.Name);
|
||||
|
|
@ -98,7 +96,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}" +
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("Flow.Launcher.Test")]
|
||||
[assembly: InternalsVisibleTo("Flow.Launcher.Test")]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -102,7 +102,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)
|
||||
|
|
@ -112,7 +112,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)
|
||||
|
|
|
|||
|
|
@ -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<UpdateManager> GitHubUpdateManager(string repository)
|
||||
private async Task<UpdateManager> 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
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -166,7 +166,7 @@ namespace Flow.Launcher.Infrastructure.Exception
|
|||
}
|
||||
return result;
|
||||
}
|
||||
catch (System.Exception e)
|
||||
catch
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
@ -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<Dictionary<string, int>> _storage;
|
||||
private static readonly ConcurrentDictionary<string, string> GuidToKey = new ConcurrentDictionary<string, string>();
|
||||
private static readonly ConcurrentDictionary<string, string> 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));
|
||||
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
ImageCache[icon] = img;
|
||||
}
|
||||
|
||||
Task.Run(() =>
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
Stopwatch.Normal("|ImageLoader.Initialize|Preload images cost", () =>
|
||||
{
|
||||
|
|
@ -243,7 +243,6 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
ImageCache[path] = img;
|
||||
}
|
||||
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@
|
|||
|
||||
[assembly: InternalsVisibleTo("Flow.Launcher")]
|
||||
[assembly: InternalsVisibleTo("Flow.Launcher.Core")]
|
||||
[assembly: InternalsVisibleTo("Flow.Launcher.Test")]
|
||||
[assembly: InternalsVisibleTo("Flow.Launcher.Test")]
|
||||
[assembly: System.Runtime.Versioning.SupportedOSPlatform("Windows10.0.19041.0")]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using Flow.Launcher.Infrastructure.UserSettings;
|
|||
|
||||
namespace Flow.Launcher.Infrastructure.Storage
|
||||
{
|
||||
#pragma warning disable SYSLIB0011 // BinaryFormatter is obsolete.
|
||||
/// <summary>
|
||||
/// Stroage object using binary data
|
||||
/// Normally, it has better performance, but not readable
|
||||
|
|
@ -113,4 +114,5 @@ namespace Flow.Launcher.Infrastructure.Storage
|
|||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore SYSLIB0011
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,58 @@
|
|||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Allowed plugin languages
|
||||
/// </summary>
|
||||
public static class AllowedLanguage
|
||||
{
|
||||
/// <summary>
|
||||
/// Python
|
||||
/// </summary>
|
||||
public static string Python
|
||||
{
|
||||
get { return "PYTHON"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C#
|
||||
/// </summary>
|
||||
public static string CSharp
|
||||
{
|
||||
get { return "CSHARP"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// F#
|
||||
/// </summary>
|
||||
public static string FSharp
|
||||
{
|
||||
get { return "FSHARP"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Standard .exe
|
||||
/// </summary>
|
||||
public static string Executable
|
||||
{
|
||||
get { return "EXECUTABLE"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if this language is a .NET language
|
||||
/// </summary>
|
||||
/// <param name="language"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsDotNet(string language)
|
||||
{
|
||||
return language.ToUpper() == CSharp
|
||||
|| language.ToUpper() == FSharp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if this language is supported
|
||||
/// </summary>
|
||||
/// <param name="language"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsAllowed(string language)
|
||||
{
|
||||
return IsDotNet(language)
|
||||
|
|
@ -35,4 +60,4 @@
|
|||
|| language.ToUpper() == Executable.ToUpper();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,24 @@ using JetBrains.Annotations;
|
|||
|
||||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Base model for plugin classes
|
||||
/// </summary>
|
||||
public class BaseModel : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary>
|
||||
/// Property changed event handler
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when a property changes
|
||||
/// </summary>
|
||||
/// <param name="propertyName"></param>
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,24 @@ using System.Windows.Input;
|
|||
|
||||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate for key down event
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
public delegate void FlowLauncherKeyDownEventHandler(FlowLauncherKeyDownEventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for query event
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
public delegate void AfterFlowLauncherQueryEventHandler(FlowLauncherQueryEventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for drop events [unused?]
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <param name="dropObject"></param>
|
||||
/// <param name="e"></param>
|
||||
public delegate void ResultItemDropEventHandler(Result result, IDataObject dropObject, DragEventArgs e);
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -17,14 +32,30 @@ namespace Flow.Launcher.Plugin
|
|||
/// <returns>return true to continue handling, return false to intercept system handling</returns>
|
||||
public delegate bool FlowLauncherGlobalKeyboardEventHandler(int keyevent, int vkcode, SpecialKeyState state);
|
||||
|
||||
/// <summary>
|
||||
/// Arguments container for the Key Down event
|
||||
/// </summary>
|
||||
public class FlowLauncherKeyDownEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The actual query
|
||||
/// </summary>
|
||||
public string Query { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Relevant key events for this event
|
||||
/// </summary>
|
||||
public KeyEventArgs keyEventArgs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Arguments container for the Query event
|
||||
/// </summary>
|
||||
public class FlowLauncherQueryEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The actual query
|
||||
/// </summary>
|
||||
public Query Query { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ namespace Flow.Launcher.Plugin
|
|||
/// </summary>
|
||||
public interface IAsyncReloadable : IFeatures
|
||||
{
|
||||
/// <summary>
|
||||
/// Reload plugin data
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task ReloadDataAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
|||
/// <summary>
|
||||
/// Copy Text to clipboard
|
||||
/// </summary>
|
||||
/// <param name="Text">Text to save on clipboard</param>
|
||||
/// <param name="text">Text to save on clipboard</param>
|
||||
public void CopyToClipboard(string text);
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -163,6 +164,7 @@ namespace Flow.Launcher.Plugin
|
|||
/// Download the specific url to a cretain file path
|
||||
/// </summary>
|
||||
/// <param name="url">URL to download file</param>
|
||||
/// <param name="filePath">path to save downloaded file</param>
|
||||
/// <param name="token">place to store file</param>
|
||||
/// <returns>Task showing the progress</returns>
|
||||
Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath, CancellationToken token = default);
|
||||
|
|
@ -178,7 +180,7 @@ namespace Flow.Launcher.Plugin
|
|||
/// Remove ActionKeyword for specific plugin
|
||||
/// </summary>
|
||||
/// <param name="pluginId">ID for plugin that needs to remove action keyword</param>
|
||||
/// <param name="newActionKeyword">The actionkeyword that is supposed to be removed</param>
|
||||
/// <param name="oldActionKeyword">The actionkeyword that is supposed to be removed</param>
|
||||
void RemoveActionKeyword(string pluginId, string oldActionKeyword);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
/// </summary>
|
||||
public interface IReloadable : IFeatures
|
||||
{
|
||||
/// <summary>
|
||||
/// Synchronously reload plugin data
|
||||
/// </summary>
|
||||
void ReloadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
[assembly: InternalsVisibleTo("Flow.Launcher")]
|
||||
[assembly: InternalsVisibleTo("Flow.Launcher.Core")]
|
||||
[assembly: InternalsVisibleTo("Flow.Launcher.Test")]
|
||||
[assembly: InternalsVisibleTo("Flow.Launcher.Test")]
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -6,7 +6,9 @@ using System.Windows.Media;
|
|||
|
||||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Describes the result of a plugin
|
||||
/// </summary>
|
||||
public class Result
|
||||
{
|
||||
|
||||
|
|
@ -65,6 +67,10 @@ namespace Flow.Launcher.Plugin
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delegate function, see <see cref="Icon"/>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public delegate ImageSource IconDelegate();
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -105,6 +111,9 @@ namespace Flow.Launcher.Plugin
|
|||
/// </summary>
|
||||
public IList<int> TitleHighlightData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Deprecated as of Flow Launcher v1.9.1. Subtitle highlighting is no longer offered
|
||||
/// </summary>
|
||||
[Obsolete("Deprecated as of Flow Launcher v1.9.1. Subtitle highlighting is no longer offered")]
|
||||
public IList<int> SubTitleHighlightData { get; set; }
|
||||
|
||||
|
|
@ -178,10 +187,15 @@ namespace Flow.Launcher.Plugin
|
|||
/// Show message as ToolTip on result SubTitle hover over
|
||||
/// </summary>
|
||||
public string SubTitleToolTip { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Run this result, asynchronously
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public ValueTask<bool> ExecuteAsync(ActionContext context)
|
||||
{
|
||||
return AsyncAction?.Invoke(context) ?? ValueTask.FromResult(Action?.Invoke(context) ?? false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ using System.Windows;
|
|||
|
||||
namespace Flow.Launcher.Plugin.SharedCommands
|
||||
{
|
||||
/// <summary>
|
||||
/// Commands that are useful to run on files... and folders!
|
||||
/// </summary>
|
||||
public static class FilesFolders
|
||||
{
|
||||
private const string FileExplorerProgramName = "explorer";
|
||||
|
|
@ -53,10 +56,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);
|
||||
|
|
@ -65,6 +68,13 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the files and directories are identical between <paramref name="fromPath"/>
|
||||
/// and <paramref name="toPath"/>
|
||||
/// </summary>
|
||||
/// <param name="fromPath"></param>
|
||||
/// <param name="toPath"></param>
|
||||
/// <returns></returns>
|
||||
public static bool VerifyBothFolderFilesEqual(this string fromPath, string toPath)
|
||||
{
|
||||
try
|
||||
|
|
@ -80,10 +90,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;
|
||||
|
|
@ -92,6 +102,10 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a folder if it exists
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public static void RemoveFolderIfExists(this string path)
|
||||
{
|
||||
try
|
||||
|
|
@ -99,26 +113,40 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a directory exists
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static bool LocationExists(this string path)
|
||||
{
|
||||
return Directory.Exists(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a file exists
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
public static bool FileExists(this string filePath)
|
||||
{
|
||||
return File.Exists(filePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open a directory window (using the OS's default handler, usually explorer)
|
||||
/// </summary>
|
||||
/// <param name="fileOrFolderPath"></param>
|
||||
public static void OpenPath(string fileOrFolderPath)
|
||||
{
|
||||
var psi = new ProcessStartInfo { FileName = FileExplorerProgramName, UseShellExecute = true, Arguments = '"' + fileOrFolderPath + '"' };
|
||||
|
|
@ -127,16 +155,20 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the folder that contains <paramref name="path"/>
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public static void OpenContainingFolder(string path)
|
||||
{
|
||||
Process.Start(FileExplorerProgramEXE, $" /select,\"{path}\"");
|
||||
|
|
|
|||
|
|
@ -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
|
|||
/// <summary>
|
||||
/// Runs a windows command using the provided ProcessStartInfo using a custom execute command function
|
||||
/// </summary>
|
||||
/// <param name="Func startProcess">allows you to pass in a custom command execution function</param>
|
||||
/// <param name="startProcess">allows you to pass in a custom command execution function</param>
|
||||
/// <param name="info">allows you to pass in the info that will be passed to startProcess</param>
|
||||
/// <exception cref="FileNotFoundException">Thrown when unable to find the file specified in the command </exception>
|
||||
/// <exception cref="Win32Exception">Thrown when error occurs during the execution of the command </exception>
|
||||
public static void Execute(Func<ProcessStartInfo, Process> startProcess, ProcessStartInfo info)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.Explorer;
|
||||
using Flow.Launcher.Plugin.Explorer.Search;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo;
|
||||
|
|
@ -19,10 +19,12 @@ namespace Flow.Launcher.Test.Plugins
|
|||
[TestFixture]
|
||||
public class ExplorerTest
|
||||
{
|
||||
#pragma warning disable CS1998 // async method with no await (more readable to leave it async to match the tested signature)
|
||||
private async Task<List<Result>> MethodWindowsIndexSearchReturnsZeroResultsAsync(Query dummyQuery, string dummyString, CancellationToken dummyToken)
|
||||
{
|
||||
return new List<Result>();
|
||||
}
|
||||
#pragma warning restore CS1998
|
||||
|
||||
private List<Result> MethodDirectoryInfoClassSearchReturnsTwoResults(Query dummyQuery, string dummyString, CancellationToken token)
|
||||
{
|
||||
|
|
@ -151,7 +153,7 @@ namespace Flow.Launcher.Test.Plugins
|
|||
}
|
||||
|
||||
[TestCase]
|
||||
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldContinueDirectoryInfoClassSearch()
|
||||
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldContinueDirectoryInfoClassSearchAsync()
|
||||
{
|
||||
// Given
|
||||
var searchManager = new SearchManager(new Settings(), new PluginInitContext());
|
||||
|
|
@ -172,7 +174,7 @@ namespace Flow.Launcher.Test.Plugins
|
|||
}
|
||||
|
||||
[TestCase]
|
||||
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldNotContinueDirectoryInfoClassSearch()
|
||||
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldNotContinueDirectoryInfoClassSearchAsync()
|
||||
{
|
||||
// Given
|
||||
var searchManager = new SearchManager(new Settings(), new PluginInitContext());
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Flow.Launcher
|
|||
Http.API = API;
|
||||
Http.Proxy = _settings.Proxy;
|
||||
|
||||
await PluginManager.InitializePlugins(API);
|
||||
await PluginManager.InitializePluginsAsync(API);
|
||||
var window = new MainWindow(_settings, _mainVM);
|
||||
|
||||
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Flow.Launcher
|
|||
}
|
||||
|
||||
tbAction.Text = updateCustomHotkey.ActionKeyword;
|
||||
ctlHotkey.SetHotkey(updateCustomHotkey.Hotkey, false);
|
||||
_ = ctlHotkey.SetHotkeyAsync(updateCustomHotkey.Hotkey, false);
|
||||
update = true;
|
||||
lblAdd.Text = InternationalizationManager.Instance.GetTranslation("update");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -385,27 +385,5 @@ namespace Flow.Launcher.Helper
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Classes
|
||||
|
||||
/// <summary>
|
||||
/// Remoting service class which is exposed by the server i.e the first instance and called by the second instance
|
||||
/// to pass on the command line arguments to the first instance and cause it to activate itself.
|
||||
/// </summary>
|
||||
private class IPCRemoteService : MarshalByRefObject
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Remoting Object's ease expires after every 5 minutes by default. We need to override the InitializeLifetimeService class
|
||||
/// to ensure that lease never expires.
|
||||
/// </summary>
|
||||
/// <returns>Always null.</returns>
|
||||
public override object InitializeLifetimeService()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ namespace Flow.Launcher
|
|||
{
|
||||
await Task.Delay(500, token);
|
||||
if (!token.IsCancellationRequested)
|
||||
await SetHotkey(hotkeyModel);
|
||||
await SetHotkeyAsync(hotkeyModel);
|
||||
});
|
||||
}
|
||||
|
||||
public async Task SetHotkey(HotkeyModel keyModel, bool triggerValidate = true)
|
||||
public async Task SetHotkeyAsync(HotkeyModel keyModel, bool triggerValidate = true)
|
||||
{
|
||||
CurrentHotkey = keyModel;
|
||||
|
||||
|
|
@ -101,9 +101,9 @@ namespace Flow.Launcher
|
|||
}
|
||||
}
|
||||
|
||||
public void SetHotkey(string keyStr, bool triggerValidate = true)
|
||||
public Task SetHotkeyAsync(string keyStr, bool triggerValidate = true)
|
||||
{
|
||||
SetHotkey(new HotkeyModel(keyStr), triggerValidate);
|
||||
return SetHotkeyAsync(new HotkeyModel(keyStr), triggerValidate);
|
||||
}
|
||||
|
||||
private bool CheckHotkeyAvailability() => HotKeyMapper.CheckAvailability(CurrentHotkey);
|
||||
|
|
@ -116,4 +116,4 @@ namespace Flow.Launcher
|
|||
tbMsg.Foreground = tbMsgForegroundColorOriginal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ using System.Windows;
|
|||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None,
|
||||
ResourceDictionaryLocation.SourceAssembly
|
||||
)]
|
||||
)]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -83,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);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Flow.Launcher.Resources.Pages
|
|||
tbMsgTextOriginal = HotkeyControl.tbMsg.Text;
|
||||
tbMsgForegroundColorOriginal = HotkeyControl.tbMsg.Foreground;
|
||||
|
||||
HotkeyControl.SetHotkey(new Infrastructure.Hotkey.HotkeyModel(Settings.Hotkey), false);
|
||||
HotkeyControl.SetHotkeyAsync(new Infrastructure.Hotkey.HotkeyModel(Settings.Hotkey), false);
|
||||
}
|
||||
private void HotkeyControl_OnGotFocus(object sender, RoutedEventArgs args)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ namespace Flow.Launcher
|
|||
public readonly IPublicAPI API;
|
||||
private Settings settings;
|
||||
private SettingWindowViewModel viewModel;
|
||||
private static MainViewModel mainViewModel;
|
||||
|
||||
public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel)
|
||||
{
|
||||
|
|
@ -102,7 +101,7 @@ namespace Flow.Launcher
|
|||
|
||||
private void OnHotkeyControlLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
HotkeyControl.SetHotkey(viewModel.Settings.Hotkey, false);
|
||||
_ = HotkeyControl.SetHotkeyAsync(viewModel.Settings.Hotkey, false);
|
||||
}
|
||||
|
||||
private void OnHotkeyControlFocused(object sender, RoutedEventArgs e)
|
||||
|
|
@ -230,7 +229,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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -299,8 +299,8 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
Hide();
|
||||
|
||||
PluginManager
|
||||
.ReloadData()
|
||||
_ = PluginManager
|
||||
.ReloadDataAsync()
|
||||
.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);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
public class RelayCommand : ICommand
|
||||
{
|
||||
private Action<object> _action;
|
||||
private readonly Action<object> _action;
|
||||
|
||||
public RelayCommand(Action<object> 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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
_ => throw new NotImplementedException()
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -224,4 +225,4 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
return IndexSearch.PathIsIndexed(pathToDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
//search could be url, no need ToLower() when passed in
|
||||
Settings.InstallCommand => await pluginManager.RequestInstallOrUpdate(query.SecondToEndSearch, token),
|
||||
Settings.UninstallCommand => pluginManager.RequestUninstall(query.SecondToEndSearch),
|
||||
Settings.UpdateCommand => await pluginManager.RequestUpdate(query.SecondToEndSearch, token),
|
||||
Settings.UpdateCommand => await pluginManager.RequestUpdateAsync(query.SecondToEndSearch, token),
|
||||
_ => pluginManager.GetDefaultHotKeys().Where(hotkey =>
|
||||
{
|
||||
hotkey.Score = StringMatcher.FuzzySearch(query.Search, hotkey.Title).Score;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Flow.Launcher.Core.ExternalPlugins;
|
||||
using Flow.Launcher.Core.ExternalPlugins;
|
||||
using Flow.Launcher.Core.Plugin;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.Http;
|
||||
|
|
@ -109,7 +109,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
};
|
||||
}
|
||||
|
||||
internal async Task InstallOrUpdate(UserPlugin plugin)
|
||||
internal async Task InstallOrUpdateAsync(UserPlugin plugin)
|
||||
{
|
||||
if (PluginExists(plugin.ID))
|
||||
{
|
||||
|
|
@ -182,7 +182,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
Context.API.RestartApp();
|
||||
}
|
||||
|
||||
internal async ValueTask<List<Result>> RequestUpdate(string search, CancellationToken token)
|
||||
internal async ValueTask<List<Result>> RequestUpdateAsync(string search, CancellationToken token)
|
||||
{
|
||||
await UpdateManifestAsync(token);
|
||||
|
||||
|
|
@ -336,7 +336,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
}
|
||||
|
||||
Application.Current.MainWindow.Hide();
|
||||
_ = InstallOrUpdate(plugin);
|
||||
_ = InstallOrUpdateAsync(plugin);
|
||||
|
||||
return ShouldHideWindow;
|
||||
}
|
||||
|
|
@ -383,7 +383,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
}
|
||||
|
||||
Application.Current.MainWindow.Hide();
|
||||
_ = InstallOrUpdate(x); // No need to wait
|
||||
_ = InstallOrUpdateAsync(x); // No need to wait
|
||||
return ShouldHideWindow;
|
||||
},
|
||||
ContextData = x
|
||||
|
|
@ -502,4 +502,4 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
&& newMetadata.Version.CompareTo(x.Metadata.Version) <= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
|
@ -157,9 +157,8 @@ 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);
|
||||
return new Application[] { };
|
||||
ProgramLogger.LogException($"|UWP|All|{p.InstalledLocation}|An unexpected error occured and unable to convert Package to UWP for {p.Id.FullName}", e);
|
||||
return Array.Empty<Application>();
|
||||
}
|
||||
#endif
|
||||
#if DEBUG //make developer aware and implement handling
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
@ -408,7 +407,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
});
|
||||
}
|
||||
|
||||
private async void LaunchElevated()
|
||||
private void LaunchElevated()
|
||||
{
|
||||
string command = "shell:AppsFolder\\" + UniqueIdentifier;
|
||||
command = Environment.ExpandEnvironmentVariables(command.Trim());
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="InputSimulator" Version="1.0.4" />
|
||||
<PackageReference Include="InputSimulator" Version="1.0.4" NoWarn="NU1701" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -376,9 +376,9 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
new Result
|
||||
{
|
||||
Title = context.API.GetTranslation("flowlauncher_plugin_cmd_run_as_different_user"),
|
||||
Action = c =>
|
||||
AsyncAction = async c =>
|
||||
{
|
||||
Task.Run(() => Execute(ShellCommand.RunAsDifferentUser, PrepareProcessStartInfo(selectedResult.Title)));
|
||||
Execute(ShellCommand.RunAsDifferentUser, PrepareProcessStartInfo(selectedResult.Title));
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/user.png"
|
||||
|
|
@ -408,4 +408,4 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
return resultlist;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -340,4 +341,4 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
return context.API.GetTranslation("flowlauncher_plugin_sys_plugin_description");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if DEBUG
|
||||
|
|
@ -18,4 +18,4 @@ using System.Runtime.InteropServices;
|
|||
[assembly: ComVisible(false)]
|
||||
[assembly: AssemblyVersion("1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0")]
|
||||
|
|
|
|||
Loading…
Reference in a new issue