2019-08-04 11:47:05 +00:00
|
|
|
|
using System;
|
2020-02-21 21:12:58 +00:00
|
|
|
|
using System.Collections.Concurrent;
|
2015-11-03 05:09:54 +00:00
|
|
|
|
using System.Collections.Generic;
|
2014-12-26 11:36:43 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
2021-01-02 07:52:41 +00:00
|
|
|
|
using System.Threading;
|
2016-05-05 20:15:13 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2020-04-21 09:12:17 +00:00
|
|
|
|
using Flow.Launcher.Infrastructure;
|
|
|
|
|
|
using Flow.Launcher.Infrastructure.Logger;
|
|
|
|
|
|
using Flow.Launcher.Infrastructure.UserSettings;
|
|
|
|
|
|
using Flow.Launcher.Plugin;
|
2021-06-21 11:56:20 +00:00
|
|
|
|
using ISavable = Flow.Launcher.Plugin.ISavable;
|
2014-12-26 11:36:43 +00:00
|
|
|
|
|
2020-04-21 09:12:17 +00:00
|
|
|
|
namespace Flow.Launcher.Core.Plugin
|
2014-12-26 11:36:43 +00:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2020-04-22 10:26:09 +00:00
|
|
|
|
/// The entry for managing Flow Launcher plugins
|
2014-12-26 11:36:43 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static class PluginManager
|
|
|
|
|
|
{
|
2016-01-08 01:13:36 +00:00
|
|
|
|
private static IEnumerable<PluginPair> _contextMenuPlugins;
|
2014-12-26 14:51:04 +00:00
|
|
|
|
|
2016-04-21 00:53:21 +00:00
|
|
|
|
public static List<PluginPair> AllPlugins { get; private set; }
|
2021-05-28 09:06:58 +00:00
|
|
|
|
public static readonly HashSet<PluginPair> GlobalPlugins = new();
|
2021-07-01 07:58:50 +00:00
|
|
|
|
public static readonly Dictionary<string, PluginPair> NonGlobalPlugins = new();
|
2015-11-05 20:44:14 +00:00
|
|
|
|
|
2015-11-01 22:59:56 +00:00
|
|
|
|
public static IPublicAPI API { private set; get; }
|
2016-06-20 23:14:32 +00:00
|
|
|
|
|
2016-05-12 01:45:35 +00:00
|
|
|
|
// todo happlebao, this should not be public, the indicator function should be embeded
|
|
|
|
|
|
public static PluginsSettings Settings;
|
2016-05-05 15:08:44 +00:00
|
|
|
|
private static List<PluginMetadata> _metadatas;
|
2015-11-01 22:59:56 +00:00
|
|
|
|
|
2020-06-25 00:40:29 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Directories that will hold Flow Launcher plugin directory
|
|
|
|
|
|
/// </summary>
|
2021-07-01 07:58:50 +00:00
|
|
|
|
private static readonly string[] Directories =
|
|
|
|
|
|
{
|
|
|
|
|
|
Constant.PreinstalledDirectory, DataLocation.PluginsDirectory
|
|
|
|
|
|
};
|
2016-06-21 23:42:24 +00:00
|
|
|
|
|
|
|
|
|
|
private static void DeletePythonBinding()
|
|
|
|
|
|
{
|
2020-04-21 12:54:41 +00:00
|
|
|
|
const string binding = "flowlauncher.py";
|
2020-06-25 00:40:29 +00:00
|
|
|
|
foreach (var subDirectory in Directory.GetDirectories(DataLocation.PluginsDirectory))
|
2016-06-21 23:42:24 +00:00
|
|
|
|
{
|
2020-06-25 00:40:29 +00:00
|
|
|
|
File.Delete(Path.Combine(subDirectory, binding));
|
2014-12-26 11:36:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-05-02 21:37:01 +00:00
|
|
|
|
public static void Save()
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var plugin in AllPlugins)
|
|
|
|
|
|
{
|
2021-06-21 11:56:20 +00:00
|
|
|
|
var savable = plugin.Plugin as ISavable;
|
2016-05-02 21:37:01 +00:00
|
|
|
|
savable?.Save();
|
|
|
|
|
|
}
|
2021-06-21 02:34:07 +00:00
|
|
|
|
|
2021-05-13 12:49:41 +00:00
|
|
|
|
API.SavePluginSettings();
|
2016-05-02 21:37:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-02 07:52:41 +00:00
|
|
|
|
public static async Task ReloadData()
|
2019-10-06 01:49:47 +00:00
|
|
|
|
{
|
2021-01-06 11:11:58 +00:00
|
|
|
|
await Task.WhenAll(AllPlugins.Select(plugin => plugin.Plugin switch
|
2019-10-06 01:49:47 +00:00
|
|
|
|
{
|
2021-01-06 11:11:58 +00:00
|
|
|
|
IReloadable p => Task.Run(p.ReloadData),
|
|
|
|
|
|
IAsyncReloadable p => p.ReloadDataAsync(),
|
|
|
|
|
|
_ => Task.CompletedTask,
|
|
|
|
|
|
}).ToArray());
|
2019-10-06 01:49:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-05-05 15:08:44 +00:00
|
|
|
|
static PluginManager()
|
|
|
|
|
|
{
|
2020-06-25 00:40:29 +00:00
|
|
|
|
// validate user directory
|
|
|
|
|
|
Directory.CreateDirectory(DataLocation.PluginsDirectory);
|
2016-06-21 23:42:24 +00:00
|
|
|
|
// force old plugins use new python binding
|
|
|
|
|
|
DeletePythonBinding();
|
2016-05-05 15:08:44 +00:00
|
|
|
|
}
|
2016-05-10 00:08:54 +00:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// because InitializePlugins needs API, so LoadPlugins needs to be called first
|
|
|
|
|
|
/// todo happlebao The API should be removed
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="settings"></param>
|
|
|
|
|
|
public static void LoadPlugins(PluginsSettings settings)
|
2016-03-28 00:09:40 +00:00
|
|
|
|
{
|
2016-05-10 00:08:54 +00:00
|
|
|
|
_metadatas = PluginConfig.Parse(Directories);
|
2016-05-12 01:45:35 +00:00
|
|
|
|
Settings = settings;
|
|
|
|
|
|
Settings.UpdatePluginSettings(_metadatas);
|
|
|
|
|
|
AllPlugins = PluginsLoader.Plugins(_metadatas, Settings);
|
2016-05-10 00:08:54 +00:00
|
|
|
|
}
|
2020-02-21 21:12:58 +00:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Call initialize for all plugins
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>return the list of failed to init plugins or null for none</returns>
|
2021-01-02 07:52:41 +00:00
|
|
|
|
public static async Task InitializePlugins(IPublicAPI api)
|
2016-05-10 00:08:54 +00:00
|
|
|
|
{
|
2016-03-28 00:09:40 +00:00
|
|
|
|
API = api;
|
2020-02-21 21:12:58 +00:00
|
|
|
|
var failedPlugins = new ConcurrentQueue<PluginPair>();
|
2021-01-02 07:52:41 +00:00
|
|
|
|
|
|
|
|
|
|
var InitTasks = AllPlugins.Select(pair => Task.Run(async delegate
|
2014-12-26 11:36:43 +00:00
|
|
|
|
{
|
2020-02-21 21:12:58 +00:00
|
|
|
|
try
|
2014-12-26 11:36:43 +00:00
|
|
|
|
{
|
2021-03-23 09:25:46 +00:00
|
|
|
|
var milliseconds = await Stopwatch.DebugAsync($"|PluginManager.InitializePlugins|Init method time cost for <{pair.Metadata.Name}>",
|
2021-07-01 07:58:50 +00:00
|
|
|
|
() => pair.Plugin.InitAsync(new PluginInitContext(pair.Metadata, API)));
|
2021-03-23 09:25:46 +00:00
|
|
|
|
|
2020-02-21 21:12:58 +00:00
|
|
|
|
pair.Metadata.InitTime += milliseconds;
|
2021-01-02 07:52:41 +00:00
|
|
|
|
Log.Info(
|
|
|
|
|
|
$"|PluginManager.InitializePlugins|Total init cost for <{pair.Metadata.Name}> is <{pair.Metadata.InitTime}ms>");
|
2020-02-21 21:12:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Log.Exception(nameof(PluginManager), $"Fail to Init plugin: {pair.Metadata.Name}", e);
|
2021-01-02 14:30:56 +00:00
|
|
|
|
pair.Metadata.Disabled = true;
|
2020-02-21 21:12:58 +00:00
|
|
|
|
failedPlugins.Enqueue(pair);
|
|
|
|
|
|
}
|
2021-01-02 07:52:41 +00:00
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
await Task.WhenAll(InitTasks);
|
2015-01-27 14:59:03 +00:00
|
|
|
|
|
2016-05-05 20:15:13 +00:00
|
|
|
|
_contextMenuPlugins = GetPluginsForInterface<IContextMenu>();
|
|
|
|
|
|
foreach (var plugin in AllPlugins)
|
2015-02-04 15:16:41 +00:00
|
|
|
|
{
|
2021-05-27 22:44:06 +00:00
|
|
|
|
// set distinct on each plugin's action keywords helps only firing global(*) and action keywords once where a plugin
|
|
|
|
|
|
// has multiple global and action keywords because we will only add them here once.
|
|
|
|
|
|
foreach (var actionKeyword in plugin.Metadata.ActionKeywords.Distinct())
|
2021-01-02 07:52:41 +00:00
|
|
|
|
{
|
|
|
|
|
|
switch (actionKeyword)
|
|
|
|
|
|
{
|
|
|
|
|
|
case Query.GlobalPluginWildcardSign:
|
|
|
|
|
|
GlobalPlugins.Add(plugin);
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
NonGlobalPlugins[actionKeyword] = plugin;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-05-05 20:15:13 +00:00
|
|
|
|
}
|
2016-05-05 15:08:44 +00:00
|
|
|
|
|
2020-02-21 21:12:58 +00:00
|
|
|
|
if (failedPlugins.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
var failed = string.Join(",", failedPlugins.Select(x => x.Metadata.Name));
|
2021-01-02 07:52:41 +00:00
|
|
|
|
API.ShowMsg($"Fail to Init Plugins",
|
|
|
|
|
|
$"Plugins: {failed} - fail to load and would be disabled, please contact plugin creator for help",
|
|
|
|
|
|
"", false);
|
2020-02-21 21:12:58 +00:00
|
|
|
|
}
|
2014-12-26 11:36:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-05-28 09:06:58 +00:00
|
|
|
|
public static ICollection<PluginPair> ValidPluginsForQuery(Query query)
|
2015-11-01 17:25:44 +00:00
|
|
|
|
{
|
2016-03-28 00:09:40 +00:00
|
|
|
|
if (NonGlobalPlugins.ContainsKey(query.ActionKeyword))
|
2015-11-01 17:25:44 +00:00
|
|
|
|
{
|
2016-03-28 00:09:40 +00:00
|
|
|
|
var plugin = NonGlobalPlugins[query.ActionKeyword];
|
2021-07-01 07:58:50 +00:00
|
|
|
|
return new List<PluginPair>
|
|
|
|
|
|
{
|
|
|
|
|
|
plugin
|
|
|
|
|
|
};
|
2016-03-28 00:09:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return GlobalPlugins;
|
2015-01-26 09:46:55 +00:00
|
|
|
|
}
|
2014-12-26 14:51:04 +00:00
|
|
|
|
}
|
2016-04-21 00:53:21 +00:00
|
|
|
|
|
2021-06-11 04:40:07 +00:00
|
|
|
|
public static async Task<List<Result>> QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token)
|
2014-12-26 11:36:43 +00:00
|
|
|
|
{
|
2020-06-25 00:40:29 +00:00
|
|
|
|
var results = new List<Result>();
|
2015-11-01 22:59:56 +00:00
|
|
|
|
try
|
2014-12-26 11:36:43 +00:00
|
|
|
|
{
|
2016-05-05 15:08:44 +00:00
|
|
|
|
var metadata = pair.Metadata;
|
2021-01-03 02:19:33 +00:00
|
|
|
|
|
|
|
|
|
|
long milliseconds = -1L;
|
|
|
|
|
|
|
2021-03-23 09:25:46 +00:00
|
|
|
|
milliseconds = await Stopwatch.DebugAsync($"|PluginManager.QueryForPlugin|Cost for {metadata.Name}",
|
|
|
|
|
|
async () => results = await pair.Plugin.QueryAsync(query, token).ConfigureAwait(false));
|
|
|
|
|
|
|
2021-01-03 02:19:33 +00:00
|
|
|
|
token.ThrowIfCancellationRequested();
|
2021-02-03 09:50:21 +00:00
|
|
|
|
if (results == null)
|
2021-06-11 04:40:07 +00:00
|
|
|
|
return null;
|
2021-01-03 02:19:33 +00:00
|
|
|
|
UpdatePluginMetadata(results, metadata, query);
|
|
|
|
|
|
|
2016-05-22 04:30:38 +00:00
|
|
|
|
metadata.QueryCount += 1;
|
2021-01-02 07:52:41 +00:00
|
|
|
|
metadata.AvgQueryTime =
|
|
|
|
|
|
metadata.QueryCount == 1 ? milliseconds : (metadata.AvgQueryTime + milliseconds) / 2;
|
2021-01-03 02:19:33 +00:00
|
|
|
|
token.ThrowIfCancellationRequested();
|
|
|
|
|
|
}
|
2021-01-03 02:37:36 +00:00
|
|
|
|
catch (OperationCanceledException)
|
2021-01-03 02:19:33 +00:00
|
|
|
|
{
|
2021-01-06 11:33:55 +00:00
|
|
|
|
// null will be fine since the results will only be added into queue if the token hasn't been cancelled
|
2021-02-16 02:50:48 +00:00
|
|
|
|
return null;
|
2015-11-01 22:59:56 +00:00
|
|
|
|
}
|
2021-01-02 07:52:41 +00:00
|
|
|
|
|
2021-01-03 02:19:33 +00:00
|
|
|
|
return results;
|
2014-12-26 11:36:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-05-05 15:08:44 +00:00
|
|
|
|
public static void UpdatePluginMetadata(List<Result> results, PluginMetadata metadata, Query query)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var r in results)
|
|
|
|
|
|
{
|
|
|
|
|
|
r.PluginDirectory = metadata.PluginDirectory;
|
|
|
|
|
|
r.PluginID = metadata.ID;
|
|
|
|
|
|
r.OriginQuery = query;
|
2020-03-31 11:00:09 +00:00
|
|
|
|
|
|
|
|
|
|
// ActionKeywordAssigned is used for constructing MainViewModel's query text auto-complete suggestions
|
|
|
|
|
|
// Plugins may have multi-actionkeywords eg. WebSearches. In this scenario it needs to be overriden on the plugin level
|
|
|
|
|
|
if (metadata.ActionKeywords.Count == 1)
|
|
|
|
|
|
r.ActionKeywordAssigned = query.ActionKeyword;
|
2016-05-05 15:08:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-12-26 11:36:43 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// get specified plugin, return null if not found
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2015-11-05 20:44:14 +00:00
|
|
|
|
public static PluginPair GetPluginForId(string id)
|
2014-12-26 11:36:43 +00:00
|
|
|
|
{
|
2015-11-01 23:32:17 +00:00
|
|
|
|
return AllPlugins.FirstOrDefault(o => o.Metadata.ID == id);
|
2014-12-26 11:36:43 +00:00
|
|
|
|
}
|
2015-02-05 10:43:05 +00:00
|
|
|
|
|
2015-11-05 20:44:14 +00:00
|
|
|
|
public static IEnumerable<PluginPair> GetPluginsForInterface<T>() where T : IFeatures
|
2015-02-05 14:20:42 +00:00
|
|
|
|
{
|
2015-11-05 20:44:14 +00:00
|
|
|
|
return AllPlugins.Where(p => p.Plugin is T);
|
2015-02-05 14:20:42 +00:00
|
|
|
|
}
|
2015-02-07 15:49:46 +00:00
|
|
|
|
|
2015-11-05 20:44:14 +00:00
|
|
|
|
public static List<Result> GetContextMenusForPlugin(Result result)
|
2015-02-07 15:49:46 +00:00
|
|
|
|
{
|
2021-07-01 07:58:50 +00:00
|
|
|
|
List<Result> results;
|
2016-01-08 01:13:36 +00:00
|
|
|
|
var pluginPair = _contextMenuPlugins.FirstOrDefault(o => o.Metadata.ID == result.PluginID);
|
2016-03-26 01:20:42 +00:00
|
|
|
|
if (pluginPair != null)
|
2015-02-07 15:49:46 +00:00
|
|
|
|
{
|
2021-01-02 14:30:56 +00:00
|
|
|
|
var plugin = (IContextMenu)pluginPair.Plugin;
|
2016-03-26 01:20:42 +00:00
|
|
|
|
|
2015-02-07 15:49:46 +00:00
|
|
|
|
try
|
|
|
|
|
|
{
|
2021-07-01 07:58:50 +00:00
|
|
|
|
results = plugin.LoadContextMenus(result) ?? new List<Result>();
|
2016-03-26 01:20:42 +00:00
|
|
|
|
foreach (var r in results)
|
|
|
|
|
|
{
|
2020-06-25 00:40:29 +00:00
|
|
|
|
r.PluginDirectory = pluginPair.Metadata.PluginDirectory;
|
|
|
|
|
|
r.PluginID = pluginPair.Metadata.ID;
|
2016-03-26 01:20:42 +00:00
|
|
|
|
r.OriginQuery = result.OriginQuery;
|
|
|
|
|
|
}
|
2015-02-07 15:49:46 +00:00
|
|
|
|
}
|
2015-11-09 03:20:02 +00:00
|
|
|
|
catch (Exception e)
|
2015-02-07 15:49:46 +00:00
|
|
|
|
{
|
2021-01-02 07:52:41 +00:00
|
|
|
|
Log.Exception(
|
|
|
|
|
|
$"|PluginManager.GetContextMenusForPlugin|Can't load context menus for plugin <{pluginPair.Metadata.Name}>",
|
|
|
|
|
|
e);
|
2015-02-07 15:49:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-01-02 07:52:41 +00:00
|
|
|
|
|
2020-06-25 00:40:29 +00:00
|
|
|
|
return results;
|
2015-02-07 15:49:46 +00:00
|
|
|
|
}
|
2015-11-09 03:20:02 +00:00
|
|
|
|
|
2016-06-20 23:14:32 +00:00
|
|
|
|
public static bool ActionKeywordRegistered(string actionKeyword)
|
2015-11-09 03:20:02 +00:00
|
|
|
|
{
|
2021-06-05 08:44:16 +00:00
|
|
|
|
// this method is only checking for action keywords (defined as not '*') registration
|
|
|
|
|
|
// hence the actionKeyword != Query.GlobalPluginWildcardSign logic
|
2020-06-25 00:40:29 +00:00
|
|
|
|
return actionKeyword != Query.GlobalPluginWildcardSign
|
2021-01-02 07:52:41 +00:00
|
|
|
|
&& NonGlobalPlugins.ContainsKey(actionKeyword);
|
2016-06-20 23:14:32 +00:00
|
|
|
|
}
|
2015-11-09 03:20:02 +00:00
|
|
|
|
|
2016-06-22 23:03:01 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// used to add action keyword for multiple action keyword plugin
|
|
|
|
|
|
/// e.g. web search
|
|
|
|
|
|
/// </summary>
|
2016-06-20 23:14:32 +00:00
|
|
|
|
public static void AddActionKeyword(string id, string newActionKeyword)
|
|
|
|
|
|
{
|
|
|
|
|
|
var plugin = GetPluginForId(id);
|
|
|
|
|
|
if (newActionKeyword == Query.GlobalPluginWildcardSign)
|
2015-11-09 03:20:02 +00:00
|
|
|
|
{
|
2016-06-20 23:14:32 +00:00
|
|
|
|
GlobalPlugins.Add(plugin);
|
2015-11-09 03:20:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2016-06-20 23:14:32 +00:00
|
|
|
|
NonGlobalPlugins[newActionKeyword] = plugin;
|
2015-11-09 03:20:02 +00:00
|
|
|
|
}
|
2021-01-02 07:52:41 +00:00
|
|
|
|
|
2016-06-20 23:14:32 +00:00
|
|
|
|
plugin.Metadata.ActionKeywords.Add(newActionKeyword);
|
2015-11-09 03:20:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-06-22 23:03:01 +00:00
|
|
|
|
/// <summary>
|
2021-05-29 12:00:10 +00:00
|
|
|
|
/// used to remove action keyword for multiple action keyword plugin
|
2016-06-22 23:03:01 +00:00
|
|
|
|
/// e.g. web search
|
|
|
|
|
|
/// </summary>
|
2016-06-20 23:14:32 +00:00
|
|
|
|
public static void RemoveActionKeyword(string id, string oldActionkeyword)
|
|
|
|
|
|
{
|
|
|
|
|
|
var plugin = GetPluginForId(id);
|
2019-08-04 11:44:56 +00:00
|
|
|
|
if (oldActionkeyword == Query.GlobalPluginWildcardSign
|
|
|
|
|
|
&& // Plugins may have multiple ActionKeywords that are global, eg. WebSearch
|
|
|
|
|
|
plugin.Metadata.ActionKeywords
|
2021-05-28 09:06:58 +00:00
|
|
|
|
.Count(x => x == Query.GlobalPluginWildcardSign) == 1)
|
2016-06-20 23:14:32 +00:00
|
|
|
|
{
|
|
|
|
|
|
GlobalPlugins.Remove(plugin);
|
|
|
|
|
|
}
|
2021-01-02 14:30:56 +00:00
|
|
|
|
|
2020-06-25 00:40:29 +00:00
|
|
|
|
if (oldActionkeyword != Query.GlobalPluginWildcardSign)
|
2016-06-20 23:14:32 +00:00
|
|
|
|
NonGlobalPlugins.Remove(oldActionkeyword);
|
2021-01-02 14:30:56 +00:00
|
|
|
|
|
2019-08-04 11:44:56 +00:00
|
|
|
|
|
2016-06-20 23:14:32 +00:00
|
|
|
|
plugin.Metadata.ActionKeywords.Remove(oldActionkeyword);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void ReplaceActionKeyword(string id, string oldActionKeyword, string newActionKeyword)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (oldActionKeyword != newActionKeyword)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddActionKeyword(id, newActionKeyword);
|
|
|
|
|
|
RemoveActionKeyword(id, oldActionKeyword);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-12-26 11:36:43 +00:00
|
|
|
|
}
|
2021-07-01 07:58:50 +00:00
|
|
|
|
}
|