mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 12:46:47 +02:00
make some renames
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
echo "start clean"
|
||||||
cd /d %~dp0
|
cd /d %~dp0
|
||||||
|
|
||||||
REM Clean Plugins
|
REM Clean Plugins
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Wox.Plugin.PluginIndicator
|
|||||||
|
|
||||||
if (allPlugins.Count == 0)
|
if (allPlugins.Count == 0)
|
||||||
{
|
{
|
||||||
allPlugins = context.API.GetAllPlugins().Where(o => !PluginManager.IsSystemPlugin(o.Metadata)).ToList();
|
allPlugins = context.API.GetAllPlugins().Where(o => !PluginManager.IsWildcardPlugin(o.Metadata)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (PluginMetadata metadata in allPlugins.Select(o => o.Metadata))
|
foreach (PluginMetadata metadata in allPlugins.Select(o => o.Metadata))
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ namespace Wox.Plugin.PluginManagement
|
|||||||
private List<Result> ListUnInstalledPlugins(Query query)
|
private List<Result> ListUnInstalledPlugins(Query query)
|
||||||
{
|
{
|
||||||
List<Result> results = new List<Result>();
|
List<Result> results = new List<Result>();
|
||||||
List<PluginMetadata> allInstalledPlugins = ParseUserPlugins();
|
List<PluginMetadata> allInstalledPlugins = ParseRegularPlugins();
|
||||||
if (query.ActionParameters.Count > 1)
|
if (query.ActionParameters.Count > 1)
|
||||||
{
|
{
|
||||||
string pluginName = query.ActionParameters[1];
|
string pluginName = query.ActionParameters[1];
|
||||||
@@ -235,7 +235,7 @@ namespace Wox.Plugin.PluginManagement
|
|||||||
private List<Result> ListInstalledPlugins()
|
private List<Result> ListInstalledPlugins()
|
||||||
{
|
{
|
||||||
List<Result> results = new List<Result>();
|
List<Result> results = new List<Result>();
|
||||||
foreach (PluginMetadata plugin in ParseUserPlugins())
|
foreach (PluginMetadata plugin in ParseRegularPlugins())
|
||||||
{
|
{
|
||||||
results.Add(new Result()
|
results.Add(new Result()
|
||||||
{
|
{
|
||||||
@@ -247,7 +247,7 @@ namespace Wox.Plugin.PluginManagement
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<PluginMetadata> ParseUserPlugins()
|
private static List<PluginMetadata> ParseRegularPlugins()
|
||||||
{
|
{
|
||||||
List<PluginMetadata> pluginMetadatas = new List<PluginMetadata>();
|
List<PluginMetadata> pluginMetadatas = new List<PluginMetadata>();
|
||||||
if (!Directory.Exists(PluginPath))
|
if (!Directory.Exists(PluginPath))
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ namespace Wox.Core.Plugin
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class PluginManager
|
public static class PluginManager
|
||||||
{
|
{
|
||||||
|
public const string ActionKeywordWildcard = "*";
|
||||||
|
|
||||||
public static String DebuggerMode { get; private set; }
|
public static String DebuggerMode { get; private set; }
|
||||||
public static IPublicAPI API { get; private set; }
|
public static IPublicAPI API { get; private set; }
|
||||||
|
|
||||||
@@ -113,16 +115,16 @@ namespace Wox.Core.Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsUserPluginQuery(Query query)
|
public static bool IsRegularPluginQuery(Query query)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(query.ActionName)) return false;
|
if (string.IsNullOrEmpty(query.ActionName)) return false;
|
||||||
|
|
||||||
return plugins.Any(o => o.Metadata.PluginType == PluginType.User && o.Metadata.ActionKeyword == query.ActionName);
|
return plugins.Any(o => o.Metadata.PluginType == PluginType.User && o.Metadata.ActionKeyword == query.ActionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsSystemPlugin(PluginMetadata metadata)
|
public static bool IsWildcardPlugin(PluginMetadata metadata)
|
||||||
{
|
{
|
||||||
return metadata.ActionKeyword == "*";
|
return metadata.ActionKeyword == ActionKeywordWildcard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ActivatePluginDebugger(string path)
|
public static void ActivatePluginDebugger(string path)
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
|||||||
{
|
{
|
||||||
internal static class QueryDispatcher
|
internal static class QueryDispatcher
|
||||||
{
|
{
|
||||||
private static IQueryDispatcher pluginCmd = new UserPluginQueryDispatcher();
|
private static IQueryDispatcher pluginCmd = new RegularPluginQueryDispatcher();
|
||||||
private static IQueryDispatcher systemCmd = new SystemPluginQueryDispatcher();
|
private static IQueryDispatcher systemCmd = new WildcardPluginQueryDispatcher();
|
||||||
|
|
||||||
public static void Dispatch(Wox.Plugin.Query query)
|
public static void Dispatch(Wox.Plugin.Query query)
|
||||||
{
|
{
|
||||||
if (PluginManager.IsUserPluginQuery(query))
|
if (PluginManager.IsRegularPluginQuery(query))
|
||||||
{
|
{
|
||||||
pluginCmd.Dispatch(query);
|
pluginCmd.Dispatch(query);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ using Wox.Plugin;
|
|||||||
|
|
||||||
namespace Wox.Core.Plugin.QueryDispatcher
|
namespace Wox.Core.Plugin.QueryDispatcher
|
||||||
{
|
{
|
||||||
public class UserPluginQueryDispatcher : IQueryDispatcher
|
public class RegularPluginQueryDispatcher : IQueryDispatcher
|
||||||
{
|
{
|
||||||
public void Dispatch(Query query)
|
public void Dispatch(Query query)
|
||||||
{
|
{
|
||||||
PluginPair userPlugin = PluginManager.AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.ActionName);
|
PluginPair regularPlugin = PluginManager.AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.ActionName);
|
||||||
if (userPlugin != null && !string.IsNullOrEmpty(userPlugin.Metadata.ActionKeyword))
|
if (regularPlugin != null && !string.IsNullOrEmpty(regularPlugin.Metadata.ActionKeyword))
|
||||||
{
|
{
|
||||||
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == userPlugin.Metadata.ID);
|
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == regularPlugin.Metadata.ID);
|
||||||
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
|
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
|
||||||
{
|
{
|
||||||
//need to stop the loading animation
|
//need to stop the loading animation
|
||||||
@@ -28,12 +28,12 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<Result> results = userPlugin.Plugin.Query(query) ?? new List<Result>();
|
List<Result> results = regularPlugin.Plugin.Query(query) ?? new List<Result>();
|
||||||
PluginManager.API.PushResults(query,userPlugin.Metadata,results);
|
PluginManager.API.PushResults(query,regularPlugin.Metadata,results);
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
{
|
{
|
||||||
throw new WoxPluginException(userPlugin.Metadata.Name, e);
|
throw new WoxPluginException(regularPlugin.Metadata.Name, e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,12 @@ using Wox.Core.Exception;
|
|||||||
using Wox.Core.UserSettings;
|
using Wox.Core.UserSettings;
|
||||||
using Wox.Infrastructure.Logger;
|
using Wox.Infrastructure.Logger;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
//using Wox.Plugin.SystemPlugins;
|
|
||||||
|
|
||||||
namespace Wox.Core.Plugin.QueryDispatcher
|
namespace Wox.Core.Plugin.QueryDispatcher
|
||||||
{
|
{
|
||||||
public class SystemPluginQueryDispatcher : IQueryDispatcher
|
public class WildcardPluginQueryDispatcher : IQueryDispatcher
|
||||||
{
|
{
|
||||||
private IEnumerable<PluginPair> allSytemPlugins = PluginManager.AllPlugins.Where(o => PluginManager.IsSystemPlugin(o.Metadata));
|
private IEnumerable<PluginPair> allSytemPlugins = PluginManager.AllPlugins.Where(o => PluginManager.IsWildcardPlugin(o.Metadata));
|
||||||
|
|
||||||
public void Dispatch(Query query)
|
public void Dispatch(Query query)
|
||||||
{
|
{
|
||||||
Reference in New Issue
Block a user