mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 13:35:31 +02:00
Add pluginID for result.
This commit is contained in:
@@ -3,18 +3,18 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
|||||||
{
|
{
|
||||||
internal static class QueryDispatcher
|
internal static class QueryDispatcher
|
||||||
{
|
{
|
||||||
private static IQueryDispatcher pluginCmd = new RegularPluginQueryDispatcher();
|
private static IQueryDispatcher regularDispatcher = new RegularPluginQueryDispatcher();
|
||||||
private static IQueryDispatcher systemCmd = new WildcardPluginQueryDispatcher();
|
private static IQueryDispatcher wildcardDispatcher = new WildcardPluginQueryDispatcher();
|
||||||
|
|
||||||
public static void Dispatch(Wox.Plugin.Query query)
|
public static void Dispatch(Wox.Plugin.Query query)
|
||||||
{
|
{
|
||||||
if (PluginManager.IsRegularPluginQuery(query))
|
if (PluginManager.IsRegularPluginQuery(query))
|
||||||
{
|
{
|
||||||
pluginCmd.Dispatch(query);
|
regularDispatcher.Dispatch(query);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
systemCmd.Dispatch(query);
|
wildcardDispatcher.Dispatch(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<Result> results = regularPlugin.Plugin.Query(query) ?? new List<Result>();
|
List<Result> results = regularPlugin.Plugin.Query(query) ?? new List<Result>();
|
||||||
PluginManager.API.PushResults(query,regularPlugin.Metadata,results);
|
results.ForEach(o =>
|
||||||
|
{
|
||||||
|
o.PluginID = regularPlugin.Metadata.ID;
|
||||||
|
});
|
||||||
|
PluginManager.API.PushResults(query, regularPlugin.Metadata, results);
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,10 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<Result> results = pair1.Plugin.Query(query);
|
List<Result> results = pair1.Plugin.Query(query);
|
||||||
results.ForEach(o => { o.AutoAjustScore = true; });
|
results.ForEach(o =>
|
||||||
|
{
|
||||||
|
o.PluginID = pair1.Metadata.ID;
|
||||||
|
});
|
||||||
|
|
||||||
PluginManager.API.PushResults(query, pair1.Metadata, results);
|
PluginManager.API.PushResults(query, pair1.Metadata, results);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ namespace Wox.Core.UserSettings
|
|||||||
|
|
||||||
protected override string ConfigFolder
|
protected override string ConfigFolder
|
||||||
{
|
{
|
||||||
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
|
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Config"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string ConfigName
|
protected override string ConfigName
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Wox.Plugin
|
|||||||
{
|
{
|
||||||
public class PluginInitContext
|
public class PluginInitContext
|
||||||
{
|
{
|
||||||
public PluginMetadata CurrentPluginMetadata { get; set; }
|
public PluginMetadata CurrentPluginMetadata { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Public APIs for plugin invocation
|
/// Public APIs for plugin invocation
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace Wox.Plugin
|
|||||||
/// if we need to change the plugin config in the futher, use this to
|
/// if we need to change the plugin config in the futher, use this to
|
||||||
/// indicate config version
|
/// indicate config version
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Obsolete]
|
||||||
public int ConfigVersion
|
public int ConfigVersion
|
||||||
{
|
{
|
||||||
get { return configVersion; }
|
get { return configVersion; }
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// 有关程序集的常规信息通过以下
|
|
||||||
// 特性集控制。更改这些特性值可修改
|
|
||||||
// 与程序集关联的信息。
|
|
||||||
[assembly: AssemblyTitle("Wox.Plugin")]
|
[assembly: AssemblyTitle("Wox.Plugin")]
|
||||||
[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")]
|
[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
@@ -13,24 +10,10 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyCopyright("The MIT License (MIT)")]
|
[assembly: AssemblyCopyright("The MIT License (MIT)")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
|
||||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
|
||||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
|
||||||
[assembly: Guid("c22be00d-a6f5-4e45-8ecc-09ebf297c812")]
|
[assembly: Guid("c22be00d-a6f5-4e45-8ecc-09ebf297c812")]
|
||||||
|
|
||||||
// 程序集的版本信息由下面四个值组成:
|
|
||||||
//
|
|
||||||
// 主版本
|
|
||||||
// 次版本
|
|
||||||
// 生成号
|
|
||||||
// 修订号
|
|
||||||
//
|
|
||||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
|
||||||
// 方法是按如下所示使用“*”:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("Wox")]
|
||||||
|
[assembly: InternalsVisibleTo("Wox.Core")]
|
||||||
@@ -8,7 +8,6 @@ namespace Wox.Plugin
|
|||||||
|
|
||||||
public class Result
|
public class Result
|
||||||
{
|
{
|
||||||
|
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string SubTitle { get; set; }
|
public string SubTitle { get; set; }
|
||||||
public string IcoPath { get; set; }
|
public string IcoPath { get; set; }
|
||||||
@@ -34,21 +33,15 @@ namespace Wox.Plugin
|
|||||||
|
|
||||||
public int Score { get; set; }
|
public int Score { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Auto add scores for MRU items
|
|
||||||
/// </summary>
|
|
||||||
public bool AutoAjustScore { get; set; }
|
|
||||||
|
|
||||||
//todo: this should be controlled by system, not visible to users
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only resulsts that originQuery match with curren query will be displayed in the panel
|
/// Only resulsts that originQuery match with curren query will be displayed in the panel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Query OriginQuery { get; set; }
|
internal Query OriginQuery { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't set this property if you are developing a plugin
|
/// Plugin directory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PluginDirectory { get; set; }
|
public string PluginDirectory { get; internal set; }
|
||||||
|
|
||||||
public new bool Equals(object obj)
|
public new bool Equals(object obj)
|
||||||
{
|
{
|
||||||
@@ -75,6 +68,14 @@ namespace Wox.Plugin
|
|||||||
this.SubTitle = SubTitle;
|
this.SubTitle = SubTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Result> ContextMenu { get; set; }
|
/// <summary>
|
||||||
|
/// Context menus associate with this result
|
||||||
|
/// </summary>
|
||||||
|
public List<Result> ContextMenu { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Plugin ID that generate this result
|
||||||
|
/// </summary>
|
||||||
|
public string PluginID { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -653,12 +653,10 @@ namespace Wox
|
|||||||
|
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
//todo:this should be opened to users, it's their choice to use it or not in their workflows
|
list.ForEach(o =>
|
||||||
list.ForEach(
|
{
|
||||||
o =>
|
o.Score += UserSelectedRecordStorage.Instance.GetSelectedCount(o) * 5;
|
||||||
{
|
});
|
||||||
if (o.AutoAjustScore) o.Score += UserSelectedRecordStorage.Instance.GetSelectedCount(o) * 5;
|
|
||||||
});
|
|
||||||
List<Result> l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList();
|
List<Result> l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList();
|
||||||
Dispatcher.Invoke(new Action(() =>
|
Dispatcher.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Wox.Storage
|
|||||||
|
|
||||||
protected override string ConfigFolder
|
protected override string ConfigFolder
|
||||||
{
|
{
|
||||||
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
|
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Config"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string ConfigName
|
protected override string ConfigName
|
||||||
|
|||||||
Reference in New Issue
Block a user