diff --git a/Wox.Core/Plugin/QueryDispatcher/QueryDispatcher.cs b/Wox.Core/Plugin/QueryDispatcher/QueryDispatcher.cs index cb27b232a9..6e50c81663 100644 --- a/Wox.Core/Plugin/QueryDispatcher/QueryDispatcher.cs +++ b/Wox.Core/Plugin/QueryDispatcher/QueryDispatcher.cs @@ -3,18 +3,18 @@ namespace Wox.Core.Plugin.QueryDispatcher { internal static class QueryDispatcher { - private static IQueryDispatcher pluginCmd = new RegularPluginQueryDispatcher(); - private static IQueryDispatcher systemCmd = new WildcardPluginQueryDispatcher(); + private static IQueryDispatcher regularDispatcher = new RegularPluginQueryDispatcher(); + private static IQueryDispatcher wildcardDispatcher = new WildcardPluginQueryDispatcher(); public static void Dispatch(Wox.Plugin.Query query) { if (PluginManager.IsRegularPluginQuery(query)) { - pluginCmd.Dispatch(query); + regularDispatcher.Dispatch(query); } else { - systemCmd.Dispatch(query); + wildcardDispatcher.Dispatch(query); } } } diff --git a/Wox.Core/Plugin/QueryDispatcher/RegularPluginQueryDispatcher.cs b/Wox.Core/Plugin/QueryDispatcher/RegularPluginQueryDispatcher.cs index ace7a59174..b1cc26e424 100644 --- a/Wox.Core/Plugin/QueryDispatcher/RegularPluginQueryDispatcher.cs +++ b/Wox.Core/Plugin/QueryDispatcher/RegularPluginQueryDispatcher.cs @@ -29,7 +29,11 @@ namespace Wox.Core.Plugin.QueryDispatcher try { List results = regularPlugin.Plugin.Query(query) ?? new List(); - 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) { diff --git a/Wox.Core/Plugin/QueryDispatcher/WildcardPluginQueryDispatcher.cs b/Wox.Core/Plugin/QueryDispatcher/WildcardPluginQueryDispatcher.cs index ae5500b5b5..f57c41ae58 100644 --- a/Wox.Core/Plugin/QueryDispatcher/WildcardPluginQueryDispatcher.cs +++ b/Wox.Core/Plugin/QueryDispatcher/WildcardPluginQueryDispatcher.cs @@ -23,7 +23,10 @@ namespace Wox.Core.Plugin.QueryDispatcher try { List 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); } diff --git a/Wox.Core/UserSettings/UserSettingStorage.cs b/Wox.Core/UserSettings/UserSettingStorage.cs index 0e6d8a94e2..bb2cb82189 100644 --- a/Wox.Core/UserSettings/UserSettingStorage.cs +++ b/Wox.Core/UserSettings/UserSettingStorage.cs @@ -145,7 +145,7 @@ namespace Wox.Core.UserSettings 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 diff --git a/Wox.Plugin/PluginInitContext.cs b/Wox.Plugin/PluginInitContext.cs index 928b15b788..1b9c463a1e 100644 --- a/Wox.Plugin/PluginInitContext.cs +++ b/Wox.Plugin/PluginInitContext.cs @@ -7,7 +7,7 @@ namespace Wox.Plugin { public class PluginInitContext { - public PluginMetadata CurrentPluginMetadata { get; set; } + public PluginMetadata CurrentPluginMetadata { get; internal set; } /// /// Public APIs for plugin invocation diff --git a/Wox.Plugin/PluginMetadata.cs b/Wox.Plugin/PluginMetadata.cs index 2c83eb4454..63baf87eb2 100644 --- a/Wox.Plugin/PluginMetadata.cs +++ b/Wox.Plugin/PluginMetadata.cs @@ -15,6 +15,7 @@ namespace Wox.Plugin /// if we need to change the plugin config in the futher, use this to /// indicate config version /// + [Obsolete] public int ConfigVersion { get { return configVersion; } diff --git a/Wox.Plugin/Properties/AssemblyInfo.cs b/Wox.Plugin/Properties/AssemblyInfo.cs index 32d76d415f..80837687cd 100644 --- a/Wox.Plugin/Properties/AssemblyInfo.cs +++ b/Wox.Plugin/Properties/AssemblyInfo.cs @@ -2,9 +2,6 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin")] [assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] [assembly: AssemblyConfiguration("")] @@ -13,24 +10,10 @@ using System.Runtime.InteropServices; [assembly: AssemblyCopyright("The MIT License (MIT)")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("c22be00d-a6f5-4e45-8ecc-09ebf297c812")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: InternalsVisibleTo("Wox")] +[assembly: InternalsVisibleTo("Wox.Core")] \ No newline at end of file diff --git a/Wox.Plugin/Result.cs b/Wox.Plugin/Result.cs index db0bd309c0..6c1938fa43 100644 --- a/Wox.Plugin/Result.cs +++ b/Wox.Plugin/Result.cs @@ -8,7 +8,6 @@ namespace Wox.Plugin public class Result { - public string Title { get; set; } public string SubTitle { get; set; } public string IcoPath { get; set; } @@ -34,21 +33,15 @@ namespace Wox.Plugin public int Score { get; set; } - /// - /// Auto add scores for MRU items - /// - public bool AutoAjustScore { get; set; } - - //todo: this should be controlled by system, not visible to users /// /// Only resulsts that originQuery match with curren query will be displayed in the panel /// - public Query OriginQuery { get; set; } + internal Query OriginQuery { get; set; } /// - /// Don't set this property if you are developing a plugin + /// Plugin directory /// - public string PluginDirectory { get; set; } + public string PluginDirectory { get; internal set; } public new bool Equals(object obj) { @@ -75,6 +68,14 @@ namespace Wox.Plugin this.SubTitle = SubTitle; } - public List ContextMenu { get; set; } + /// + /// Context menus associate with this result + /// + public List ContextMenu { get; set; } + + /// + /// Plugin ID that generate this result + /// + public string PluginID { get; set; } } } \ No newline at end of file diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index ec52097b5c..0680bb11da 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -653,12 +653,10 @@ namespace Wox 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 => - { - if (o.AutoAjustScore) o.Score += UserSelectedRecordStorage.Instance.GetSelectedCount(o) * 5; - }); + list.ForEach(o => + { + o.Score += UserSelectedRecordStorage.Instance.GetSelectedCount(o) * 5; + }); List l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList(); Dispatcher.Invoke(new Action(() => { diff --git a/Wox/Storage/UserSelectedRecordStorage.cs b/Wox/Storage/UserSelectedRecordStorage.cs index cc3fe9cd17..7afa73c814 100644 --- a/Wox/Storage/UserSelectedRecordStorage.cs +++ b/Wox/Storage/UserSelectedRecordStorage.cs @@ -15,7 +15,7 @@ namespace Wox.Storage 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