mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Node picker - Allow searching with ! and !! for starts-with and exact-match respectively
This commit is contained in:
1 parent
3819a6e3be
commit
a66cc26f29
3 files changed
+45
-19
No files matched your search
@@ -5,6 +5,7 @@ using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.DeviceProviders;
|
||||
using Artemis.Core.Ninject;
|
||||
@@ -334,13 +335,16 @@ internal class PluginManagementService : IPluginManagementService
|
||||
throw new ArtemisPluginException(plugin, "Plugin main entry casing mismatch at " + plugin.Info.Main);
|
||||
|
||||
// Load the plugin, all types implementing Plugin and register them with DI
|
||||
plugin.PluginLoader = PluginLoader.CreateFromAssemblyFile(mainFile!, configure =>
|
||||
plugin.PluginLoader = PluginLoader.CreateFromAssemblyFile(mainFile, configure =>
|
||||
{
|
||||
configure.IsUnloadable = true;
|
||||
configure.LoadInMemory = true;
|
||||
configure.PreferSharedTypes = true;
|
||||
|
||||
// Resolving failed, try a loaded assembly but ignoring the version
|
||||
configure.DefaultContext.Resolving += (context, assemblyName) => context.Assemblies.FirstOrDefault(a => a.GetName().Name == assemblyName.Name);
|
||||
});
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
plugin.Assembly = plugin.PluginLoader.LoadDefaultAssembly();
|
||||
@@ -402,7 +406,7 @@ internal class PluginManagementService : IPluginManagementService
|
||||
OnPluginLoaded(new PluginEventArgs(plugin));
|
||||
return plugin;
|
||||
}
|
||||
|
||||
|
||||
public void EnablePlugin(Plugin plugin, bool saveState, bool ignorePluginLock)
|
||||
{
|
||||
if (!plugin.Info.IsCompatible)
|
||||
|
||||
@@ -78,10 +78,17 @@ public class NodeData
|
||||
/// </returns>
|
||||
public bool MatchesSearch(string text)
|
||||
{
|
||||
text = text.Trim();
|
||||
return Name.Contains(text, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
Description.Contains(text, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
Category.Contains(text, StringComparison.InvariantCultureIgnoreCase);
|
||||
string rawText = text.Trim();
|
||||
text = text.Trim().TrimStart('!');
|
||||
|
||||
if (rawText.StartsWith("!!"))
|
||||
return Name.Equals(text, StringComparison.InvariantCultureIgnoreCase);
|
||||
else if (rawText.StartsWith("!"))
|
||||
return Name.StartsWith(text, StringComparison.InvariantCultureIgnoreCase);
|
||||
else
|
||||
return Name.Contains(text, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
Description.Contains(text, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
Category.Contains(text, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
Reference in new issue
Block a user