From 8fc6cb326bacb54fd74e0d2e0daaf6d4b84de144 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 21 Mar 2025 20:31:59 +0100 Subject: [PATCH] Simplify NoPlugin --- app/MindWork AI Studio/Tools/PluginSystem/NoPlugin.cs | 3 +-- .../Tools/PluginSystem/PluginFactory.cs | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/MindWork AI Studio/Tools/PluginSystem/NoPlugin.cs b/app/MindWork AI Studio/Tools/PluginSystem/NoPlugin.cs index a6030603..a21ab819 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/NoPlugin.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/NoPlugin.cs @@ -5,6 +5,5 @@ namespace AIStudio.Tools.PluginSystem; /// /// Represents a plugin that could not be loaded. /// -/// The Lua state that the plugin was loaded into. /// The error message that occurred while parsing the plugin. -public sealed class NoPlugin(LuaState state, string parsingError) : PluginBase(string.Empty, state, PluginType.NONE, parsingError); \ No newline at end of file +public sealed class NoPlugin(string parsingError) : PluginBase(string.Empty, LuaState.Create(), PluginType.NONE, parsingError); \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/PluginSystem/PluginFactory.cs b/app/MindWork AI Studio/Tools/PluginSystem/PluginFactory.cs index 054d4e8d..b9658154 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/PluginFactory.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/PluginFactory.cs @@ -100,23 +100,23 @@ public static class PluginFactory } catch (LuaParseException e) { - return new NoPlugin(state, $"Was not able to parse the plugin: {e.Message}"); + return new NoPlugin($"Was not able to parse the plugin: {e.Message}"); } if (!state.Environment["TYPE"].TryRead(out var typeText)) - return new NoPlugin(state, "TYPE does not exist or is not a valid string."); + return new NoPlugin("TYPE does not exist or is not a valid string."); if (!Enum.TryParse(typeText, out var type)) - return new NoPlugin(state, $"TYPE is not a valid plugin type. Valid types are: {CommonTools.GetAllEnumValues()}"); + return new NoPlugin($"TYPE is not a valid plugin type. Valid types are: {CommonTools.GetAllEnumValues()}"); if(type is PluginType.NONE) - return new NoPlugin(state, $"TYPE is not a valid plugin type. Valid types are: {CommonTools.GetAllEnumValues()}"); + return new NoPlugin($"TYPE is not a valid plugin type. Valid types are: {CommonTools.GetAllEnumValues()}"); return type switch { PluginType.LANGUAGE => new PluginLanguage(path, state, type), - _ => new NoPlugin(state, "This plugin type is not supported yet. Please try again with a future version of AI Studio.") + _ => new NoPlugin("This plugin type is not supported yet. Please try again with a future version of AI Studio.") }; } } \ No newline at end of file