mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Misc
This commit is contained in:
@@ -141,14 +141,10 @@ namespace Wox.Core.Plugin
|
|||||||
{
|
{
|
||||||
var customizedPluginConfig = UserSettingStorage.Instance.
|
var customizedPluginConfig = UserSettingStorage.Instance.
|
||||||
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == plugin.Metadata.ID);
|
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == plugin.Metadata.ID);
|
||||||
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
|
if (customizedPluginConfig != null && customizedPluginConfig.Disabled) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (query.IsIntantQuery && IsInstantSearchPlugin(plugin.Metadata))
|
if (query.IsIntantQuery && IsInstantSearchPlugin(plugin.Metadata))
|
||||||
{
|
{
|
||||||
Debug.WriteLine(string.Format("Plugin {0} is executing instant search.", plugin.Metadata.Name));
|
using (new Timeit($"Plugin {plugin.Metadata.Name} is executing instant search"))
|
||||||
using (new Timeit(" => instant search took: "))
|
|
||||||
{
|
{
|
||||||
QueryForPlugin(plugin, query);
|
QueryForPlugin(plugin, query);
|
||||||
}
|
}
|
||||||
@@ -190,16 +186,17 @@ namespace Wox.Core.Plugin
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static bool IsVailldActionKeyword(string actionKeyword)
|
private static bool IsVailldActionKeyword(string actionKeyword)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(actionKeyword) || actionKeyword == Query.ActionKeywordWildcardSign) return false;
|
if (string.IsNullOrEmpty(actionKeyword) || actionKeyword == Query.WildcardSign) return false;
|
||||||
PluginPair pair = AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == actionKeyword);
|
PluginPair pair = AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == actionKeyword);
|
||||||
if (pair == null) return false;
|
if (pair == null) return false;
|
||||||
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pair.Metadata.ID);
|
var customizedPluginConfig = UserSettingStorage.Instance.
|
||||||
|
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pair.Metadata.ID);
|
||||||
return customizedPluginConfig == null || !customizedPluginConfig.Disabled;
|
return customizedPluginConfig == null || !customizedPluginConfig.Disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsSystemPlugin(PluginMetadata metadata)
|
public static bool IsSystemPlugin(PluginMetadata metadata)
|
||||||
{
|
{
|
||||||
return metadata.ActionKeyword == Query.ActionKeywordWildcardSign;
|
return metadata.ActionKeyword == Query.WildcardSign;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsInstantQuery(string query)
|
public static bool IsInstantQuery(string query)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Wox.Infrastructure
|
|||||||
_stopwatch.Stop();
|
_stopwatch.Stop();
|
||||||
long seconds = _stopwatch.ElapsedMilliseconds;
|
long seconds = _stopwatch.ElapsedMilliseconds;
|
||||||
_stopwatch.Start();
|
_stopwatch.Start();
|
||||||
Debug.WriteLine(_name + ":" + _stopwatch.ElapsedMilliseconds + "ms");
|
Debug.WriteLine(_name + " : " + _stopwatch.ElapsedMilliseconds + "ms");
|
||||||
return seconds;
|
return seconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ namespace Wox.Plugin
|
|||||||
|
|
||||||
public const string Seperater = " ";
|
public const string Seperater = " ";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// * is used for System Plugin
|
||||||
|
/// </summary>
|
||||||
|
public const string WildcardSign = "*";
|
||||||
|
|
||||||
internal string ActionKeyword { get; set; }
|
internal string ActionKeyword { get; set; }
|
||||||
|
|
||||||
internal bool IsIntantQuery { get; set; }
|
internal bool IsIntantQuery { get; set; }
|
||||||
@@ -120,6 +125,6 @@ namespace Wox.Plugin
|
|||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public const string ActionKeywordWildcardSign = "*";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Wox
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check new action keyword didn't used by other plugin
|
//check new action keyword didn't used by other plugin
|
||||||
if (tbAction.Text.Trim() != Query.ActionKeywordWildcardSign && PluginManager.AllPlugins.Exists(o => o.Metadata.ActionKeyword == tbAction.Text.Trim()))
|
if (tbAction.Text.Trim() != Query.WildcardSign && PluginManager.AllPlugins.Exists(o => o.Metadata.ActionKeyword == tbAction.Text.Trim()))
|
||||||
{
|
{
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("newActionKeywordHasBeenAssigned"));
|
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("newActionKeywordHasBeenAssigned"));
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user