mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
make some renames
This commit is contained in:
parent
cb41a4c386
commit
42d86fab8e
7 changed files with 22 additions and 20 deletions
|
|
@ -1,3 +1,4 @@
|
|||
echo "start clean"
|
||||
cd /d %~dp0
|
||||
|
||||
REM Clean Plugins
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Wox.Plugin.PluginIndicator
|
|||
|
||||
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))
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ namespace Wox.Plugin.PluginManagement
|
|||
private List<Result> ListUnInstalledPlugins(Query query)
|
||||
{
|
||||
List<Result> results = new List<Result>();
|
||||
List<PluginMetadata> allInstalledPlugins = ParseUserPlugins();
|
||||
List<PluginMetadata> allInstalledPlugins = ParseRegularPlugins();
|
||||
if (query.ActionParameters.Count > 1)
|
||||
{
|
||||
string pluginName = query.ActionParameters[1];
|
||||
|
|
@ -235,7 +235,7 @@ namespace Wox.Plugin.PluginManagement
|
|||
private List<Result> ListInstalledPlugins()
|
||||
{
|
||||
List<Result> results = new List<Result>();
|
||||
foreach (PluginMetadata plugin in ParseUserPlugins())
|
||||
foreach (PluginMetadata plugin in ParseRegularPlugins())
|
||||
{
|
||||
results.Add(new Result()
|
||||
{
|
||||
|
|
@ -247,7 +247,7 @@ namespace Wox.Plugin.PluginManagement
|
|||
return results;
|
||||
}
|
||||
|
||||
private static List<PluginMetadata> ParseUserPlugins()
|
||||
private static List<PluginMetadata> ParseRegularPlugins()
|
||||
{
|
||||
List<PluginMetadata> pluginMetadatas = new List<PluginMetadata>();
|
||||
if (!Directory.Exists(PluginPath))
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ namespace Wox.Core.Plugin
|
|||
/// </summary>
|
||||
public static class PluginManager
|
||||
{
|
||||
public const string ActionKeywordWildcard = "*";
|
||||
|
||||
public static String DebuggerMode { 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;
|
||||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
|||
{
|
||||
internal static class QueryDispatcher
|
||||
{
|
||||
private static IQueryDispatcher pluginCmd = new UserPluginQueryDispatcher();
|
||||
private static IQueryDispatcher systemCmd = new SystemPluginQueryDispatcher();
|
||||
private static IQueryDispatcher pluginCmd = new RegularPluginQueryDispatcher();
|
||||
private static IQueryDispatcher systemCmd = new WildcardPluginQueryDispatcher();
|
||||
|
||||
public static void Dispatch(Wox.Plugin.Query query)
|
||||
{
|
||||
if (PluginManager.IsUserPluginQuery(query))
|
||||
if (PluginManager.IsRegularPluginQuery(query))
|
||||
{
|
||||
pluginCmd.Dispatch(query);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ using Wox.Plugin;
|
|||
|
||||
namespace Wox.Core.Plugin.QueryDispatcher
|
||||
{
|
||||
public class UserPluginQueryDispatcher : IQueryDispatcher
|
||||
public class RegularPluginQueryDispatcher : IQueryDispatcher
|
||||
{
|
||||
public void Dispatch(Query query)
|
||||
{
|
||||
PluginPair userPlugin = PluginManager.AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.ActionName);
|
||||
if (userPlugin != null && !string.IsNullOrEmpty(userPlugin.Metadata.ActionKeyword))
|
||||
PluginPair regularPlugin = PluginManager.AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.ActionName);
|
||||
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)
|
||||
{
|
||||
//need to stop the loading animation
|
||||
|
|
@ -28,12 +28,12 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
|||
{
|
||||
try
|
||||
{
|
||||
List<Result> results = userPlugin.Plugin.Query(query) ?? new List<Result>();
|
||||
PluginManager.API.PushResults(query,userPlugin.Metadata,results);
|
||||
List<Result> results = regularPlugin.Plugin.Query(query) ?? new List<Result>();
|
||||
PluginManager.API.PushResults(query,regularPlugin.Metadata,results);
|
||||
}
|
||||
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.Infrastructure.Logger;
|
||||
using Wox.Plugin;
|
||||
//using Wox.Plugin.SystemPlugins;
|
||||
|
||||
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)
|
||||
{
|
||||
Loading…
Reference in a new issue