Enable multiple action keywords

See issue #352
This commit is contained in:
bao-qian
2015-11-04 22:49:40 +00:00
parent 59a4abff7c
commit a07d6aa1e7
25 changed files with 95 additions and 112 deletions

View File

@@ -10,8 +10,10 @@ namespace Wox.Plugin
List<Result> LoadContextMenus(Result selectedResult);
}
[Obsolete("If a plugin has a action keyword, then it is exclusive. This interface will be remove in v1.3.0")]
public interface IExclusiveQuery : IFeatures
{
[Obsolete("If a plugin has a action keyword, then it is exclusive. This method will be remove in v1.3.0")]
bool IsExclusiveQuery(Query query);
}

View File

@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Collections.Generic;
namespace Wox.Plugin
{
@@ -23,8 +24,11 @@ namespace Wox.Plugin
public string PluginDirectory { get; set; }
[Obsolete("Use ActionKeywords instead, because Wox now support multiple action keywords. This will be remove in v1.3.0")]
public string ActionKeyword { get; set; }
public string[] ActionKeywords { get; set; }
public string IcoPath { get; set; }
public override string ToString()

View File

@@ -25,14 +25,15 @@ namespace Wox.Plugin
/// </summary>
internal string[] Terms { private get; set; }
public const string Seperater = " ";
public const string TermSeperater = " ";
public const string ActionKeywordSeperater = ";";
/// <summary>
/// * is used for System Plugin
/// </summary>
public const string WildcardSign = "*";
internal string ActionKeyword { get; set; }
public string ActionKeyword { get; set; }
/// <summary>
/// Return first search split by space if it has
@@ -46,8 +47,8 @@ namespace Wox.Plugin
{
get
{
var index = String.IsNullOrEmpty(ActionKeyword) ? 1 : 2;
return String.Join(Seperater, Terms.Skip(index).ToArray());
var index = string.IsNullOrEmpty(ActionKeyword) ? 1 : 2;
return string.Join(TermSeperater, Terms.Skip(index).ToArray());
}
}
@@ -65,18 +66,17 @@ namespace Wox.Plugin
{
try
{
return String.IsNullOrEmpty(ActionKeyword) ? Terms[index] : Terms[index + 1];
return string.IsNullOrEmpty(ActionKeyword) ? Terms[index] : Terms[index + 1];
}
catch (IndexOutOfRangeException)
{
return String.Empty;
return string.Empty;
}
}
public override string ToString() => RawQuery;
[Obsolete("Use Search instead, A plugin developer shouldn't care about action name, as it may changed by users. " +
"this property will be removed in v1.3.0")]
[Obsolete("Use ActionKeyword, this property will be removed in v1.3.0")]
public string ActionName { get; internal set; }
[Obsolete("Use Search instead, this property will be removed in v1.3.0")]