This commit is contained in:
bao-qian 2015-11-02 00:09:42 +00:00
parent bfa0db3ba3
commit a3117fa61d
4 changed files with 14 additions and 12 deletions

View File

@ -141,14 +141,10 @@ namespace Wox.Core.Plugin
{
var customizedPluginConfig = UserSettingStorage.Instance.
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == plugin.Metadata.ID);
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
{
return;
}
if (customizedPluginConfig != null && customizedPluginConfig.Disabled) return;
if (query.IsIntantQuery && IsInstantSearchPlugin(plugin.Metadata))
{
Debug.WriteLine(string.Format("Plugin {0} is executing instant search.", plugin.Metadata.Name));
using (new Timeit(" => instant search took: "))
using (new Timeit($"Plugin {plugin.Metadata.Name} is executing instant search"))
{
QueryForPlugin(plugin, query);
}
@ -190,16 +186,17 @@ namespace Wox.Core.Plugin
/// <returns></returns>
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);
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;
}
public static bool IsSystemPlugin(PluginMetadata metadata)
{
return metadata.ActionKeyword == Query.ActionKeywordWildcardSign;
return metadata.ActionKeyword == Query.WildcardSign;
}
public static bool IsInstantQuery(string query)

View File

@ -23,7 +23,7 @@ namespace Wox.Infrastructure
_stopwatch.Stop();
long seconds = _stopwatch.ElapsedMilliseconds;
_stopwatch.Start();
Debug.WriteLine(_name + ":" + _stopwatch.ElapsedMilliseconds + "ms");
Debug.WriteLine(_name + " : " + _stopwatch.ElapsedMilliseconds + "ms");
return seconds;
}
}

View File

@ -27,6 +27,11 @@ namespace Wox.Plugin
public const string Seperater = " ";
/// <summary>
/// * is used for System Plugin
/// </summary>
public const string WildcardSign = "*";
internal string ActionKeyword { get; set; }
internal bool IsIntantQuery { get; set; }
@ -120,6 +125,6 @@ namespace Wox.Plugin
return String.Empty;
}
public const string ActionKeywordWildcardSign = "*";
}
}

View File

@ -45,7 +45,7 @@ namespace Wox
}
//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"));
return;