diff --git a/Backend/Engine.cs b/Backend/Engine.cs index a9c11fa2..cf390284 100644 --- a/Backend/Engine.cs +++ b/Backend/Engine.cs @@ -2,45 +2,35 @@ using Slipstream.Shared; using Slipstream.Shared.Events.Internal; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using static Slipstream.Shared.IEventFactory; #nullable enable namespace Slipstream.Backend { - partial class Engine : Worker, IEngine, IDisposable + class Engine : Worker, IEngine, IDisposable { private readonly IEventFactory EventFactory; private readonly IEventBus EventBus; private readonly IPluginManager PluginManager; private readonly IEventBusSubscription Subscription; private readonly IPluginFactory PluginFactory; - private readonly IEventSerdeService EventSerdeService; private readonly Shared.EventHandler EventHandler = new Shared.EventHandler(); - private DateTime? BootupEventsDeadline; - private readonly List CapturedBootupEvents = new List(); - - public Engine(IEventFactory eventFactory, IEventBus eventBus, IPluginFactory pluginFactory, IPluginManager pluginManager, ILuaSevice luaService, IApplicationVersionService applicationVersionService, IEventSerdeService eventSerdeService) : base("engine") + public Engine(IEventFactory eventFactory, IEventBus eventBus, IPluginFactory pluginFactory, IPluginManager pluginManager, ILuaSevice luaService, IApplicationVersionService applicationVersionService) : base("engine") { EventFactory = eventFactory; EventBus = eventBus; PluginFactory = pluginFactory; PluginManager = pluginManager; - EventSerdeService = eventSerdeService; Subscription = EventBus.RegisterListener(); EventHandler.OnInternalCommandPluginRegister += (s, e) => OnCommandPluginRegister(e.Event); EventHandler.OnInternalCommandPluginUnregister += (s, e) => OnCommandPluginUnregister(e.Event); EventHandler.OnInternalCommandPluginStates += (s, e) => OnCommandPluginStates(e.Event); - EventHandler.OnInternalReconfigured += (s, e) => OnInternalReconfigured(); - EventHandler.OnInternalBootupEvents += (s, e) => OnInternalBootupEvents(e.Event); - - BootupEventsDeadline = DateTime.Now.AddMilliseconds(500); + EventHandler.OnInternalCommandReconfigure += (s, e) => OnInternalReconfigured(); // Plugins.. { @@ -71,12 +61,12 @@ public Engine(IEventFactory eventFactory, IEventBus eventBus, IPluginFactory plu -- register_plugin(""TransmitterPlugin"", ""TransmitterPlugin"") -- register_plugin(""ReceiverPlugin"", ""ReceiverPlugin"") --- FileTriggerPlugin listens for FileMonitorPlugin events and acts on them. --- Currently it will only act on files ending with .lua, which it launches --- a plugin for. If the file is modified, it will take down the plugin and +-- LuaManagerPlugin listens for FileMonitorPlugin events and acts on them. +-- It will only act on files ending with .lua, which it launches +-- a LuaPlugin for. If the file is modified, it will take down the plugin and -- launch a new one with the same file. If files are moved out of the directory -- it is consider as if it were deleted. Deleted files are taken down. -register_plugin(""FileTriggerPlugin"", ""FileTriggerPlugin"") +register_plugin(""LuaManagerPlugin"", ""LuaManagerPlugin"") -- FileMonitorPlugin monitors the script directory and sends out events -- every time a file is created, renamed, modified or deleted @@ -91,17 +81,6 @@ public Engine(IEventFactory eventFactory, IEventBus eventBus, IPluginFactory plu EventBus.Enabled = true; } - private void OnInternalBootupEvents(InternalBootupEvents @event) - { - foreach(var e in EventSerdeService.DeserializeMultiple(@event.Events)) - { - CapturedBootupEvents.Add(e); - } - - // Postponing deadline - BootupEventsDeadline = DateTime.Now.AddMilliseconds(500); - } - private void OnInternalReconfigured() { PluginManager.RestartReconfigurablePlugins(); @@ -134,20 +113,6 @@ protected override void Main() { while (!Stopped) { - if(BootupEventsDeadline != null && BootupEventsDeadline <= DateTime.Now) - { - // We have collected the events published when LuaScripts were booting. To avoid - // publishing the same events multiple times, we remove duplicates and then publish it - foreach (var e in CapturedBootupEvents.Distinct()) - { - EventBus.PublishEvent(e); - } - - CapturedBootupEvents.Clear(); - - BootupEventsDeadline = null; - } - EventHandler.HandleEvent(Subscription.NextEvent(10)); } } diff --git a/Backend/PluginManager.cs b/Backend/PluginManager.cs index a30c1abe..3bb6cfaa 100644 --- a/Backend/PluginManager.cs +++ b/Backend/PluginManager.cs @@ -18,14 +18,15 @@ public class PluginManager : IPluginManager, IPluginFactory private readonly IApplicationConfiguration ApplicationConfiguration; private readonly IStateService StateService; private readonly ITxrxService TxrxService; - - public PluginManager(IEventFactory eventFactory, IEventBus eventBus, IApplicationConfiguration applicationConfiguration, IStateService stateService, ITxrxService txrxService) + private readonly IEventSerdeService EventSerdeService; + public PluginManager(IEventFactory eventFactory, IEventBus eventBus, IApplicationConfiguration applicationConfiguration, IStateService stateService, ITxrxService txrxService, IEventSerdeService eventSerdeService) { EventFactory = eventFactory; EventBus = eventBus; ApplicationConfiguration = applicationConfiguration; StateService = stateService; TxrxService = txrxService; + EventSerdeService = eventSerdeService; } private void UnregisterPluginsWithoutLock() @@ -173,7 +174,7 @@ public IPlugin CreatePlugin(string id, string name, IEventBus eventBus) return name switch { "FileMonitorPlugin" => new FileMonitorPlugin(id, EventFactory, eventBus, ApplicationConfiguration), - "FileTriggerPlugin" => new FileTriggerPlugin(id, EventFactory, eventBus, this, this), + "LuaManagerPlugin" => new LuaManagerPlugin(id, EventFactory, eventBus, this, this, EventSerdeService), "AudioPlugin" => new AudioPlugin(id, EventFactory, eventBus, ApplicationConfiguration), "IRacingPlugin" => new IRacingPlugin(id, EventFactory, eventBus), "TwitchPlugin" => new TwitchPlugin(id, EventFactory, eventBus, ApplicationConfiguration), diff --git a/Backend/Plugins/FileTriggerPlugin.cs b/Backend/Plugins/LuaManagerPlugin.cs similarity index 73% rename from Backend/Plugins/FileTriggerPlugin.cs rename to Backend/Plugins/LuaManagerPlugin.cs index ad88958b..afda895e 100644 --- a/Backend/Plugins/FileTriggerPlugin.cs +++ b/Backend/Plugins/LuaManagerPlugin.cs @@ -1,18 +1,23 @@ -using Slipstream.Shared; +using Slipstream.Backend.Services; +using Slipstream.Shared; +using Slipstream.Shared.Events.LuaManager; +using System; using System.Collections.Generic; using System.IO; +using System.Linq; using EventHandler = Slipstream.Shared.EventHandler; #nullable enable namespace Slipstream.Backend.Plugins { - internal class FileTriggerPlugin : BasePlugin + internal class LuaManagerPlugin : BasePlugin { private readonly IEventFactory EventFactory; private readonly IEventBus EventBus; private readonly IPluginManager PluginManager; private readonly IPluginFactory PluginFactory; + private readonly IEventSerdeService EventSerdeService; private readonly IDictionary Scripts = new Dictionary(); // At bootup we will receive zero or more FileCreated events ending with a ScanCompleted. @@ -22,12 +27,16 @@ internal class FileTriggerPlugin : BasePlugin private readonly List WaitingForLuaScripts = new List(); - public FileTriggerPlugin(string id, IEventFactory eventFactory, IEventBus eventBus, IPluginManager pluginManager, IPluginFactory pluginFactory) : base(id, "FileTriggerPlugin", "FileTriggerPlugin", "Core") + private DateTime? BootupEventsDeadline; + private readonly List CapturedBootupEvents = new List(); + + public LuaManagerPlugin(string id, IEventFactory eventFactory, IEventBus eventBus, IPluginManager pluginManager, IPluginFactory pluginFactory, IEventSerdeService eventSerdeService) : base(id, "LuaManagerPlugin", "LuaManagerPlugin", "Core") { EventFactory = eventFactory; EventBus = eventBus; PluginManager = pluginManager; PluginFactory = pluginFactory; + EventSerdeService = eventSerdeService; EventHandler.OnFileMonitorFileCreated += EventHandler_OnFileMonitorFileCreated; EventHandler.OnFileMonitorFileDeleted += EventHandler_OnFileMonitorFileDeleted; @@ -35,10 +44,24 @@ public FileTriggerPlugin(string id, IEventFactory eventFactory, IEventBus eventB EventHandler.OnFileMonitorFileRenamed += EventHandler_OnFileMonitorFileRenamed; EventHandler.OnFileMonitorScanCompleted += EventHandler_OnFileMonitorScanCompleted; EventHandler.OnInternalPluginState += EventHandler_OnInternalPluginState; + EventHandler.OnLuaManagerCommandDeduplicateEvents += (s, e) => EventHandler_OnInternalCommandDeduplicateEvents(e.Event); + + BootupEventsDeadline = DateTime.Now.AddMilliseconds(500); EventBus.PublishEvent(EventFactory.CreateFileMonitorCommandScan()); } + private void EventHandler_OnInternalCommandDeduplicateEvents(LuaManagerCommandDeduplicateEvents @event) + { + foreach (var e in EventSerdeService.DeserializeMultiple(@event.Events)) + { + CapturedBootupEvents.Add(e); + } + + // Postponing deadline + BootupEventsDeadline = DateTime.Now.AddMilliseconds(500); + } + private void EventHandler_OnInternalPluginState(EventHandler source, EventHandler.EventHandlerArgs e) { if (e.Event.PluginStatus == "Registered" && e.Event.PluginName == "LuaPlugin") @@ -133,5 +156,22 @@ private bool IsApplicable(string FilePath) { return Path.GetExtension(FilePath) == ".lua"; } + + public override void Loop() + { + if (BootupEventsDeadline != null && BootupEventsDeadline <= DateTime.Now) + { + // We have collected the events published when LuaScripts were booting. To avoid + // publishing the same events multiple times, we remove duplicates and then publish it + foreach (var e in CapturedBootupEvents.Distinct()) + { + EventBus.PublishEvent(e); + } + + CapturedBootupEvents.Clear(); + + BootupEventsDeadline = null; + } + } } } \ No newline at end of file diff --git a/Backend/Plugins/LuaPlugin.cs b/Backend/Plugins/LuaPlugin.cs index ddd39a7a..a31df2f4 100644 --- a/Backend/Plugins/LuaPlugin.cs +++ b/Backend/Plugins/LuaPlugin.cs @@ -51,7 +51,7 @@ private void StartLua() var eventsCaptured = EventBus.CapturedEvents; EventBus.StopCapturing(); - EventBus.PublishEvent(EventFactory.CreateInternalBootupEvents(eventsCaptured)); + EventBus.PublishEvent(EventFactory.CreateLuaManagerCommandDeduplicateEvents(eventsCaptured)); } private void HandleLuaException(LuaException e) diff --git a/Backend/Services/LuaServiceLib/CoreMethodCollection.cs b/Backend/Services/LuaServiceLib/CoreMethodCollection.cs index a0bf2011..35ef4fe5 100644 --- a/Backend/Services/LuaServiceLib/CoreMethodCollection.cs +++ b/Backend/Services/LuaServiceLib/CoreMethodCollection.cs @@ -23,7 +23,6 @@ public DelayedExecution(LuaFunction luaFunction, DateTime triggersAt) } } - private readonly string Prefix; private readonly IEventFactory EventFactory; private readonly IEventBus EventBus; private readonly IEventSerdeService EventSerdeService; @@ -31,18 +30,17 @@ public DelayedExecution(LuaFunction luaFunction, DateTime triggersAt) private readonly IDictionary DebounceDelayedFunctions = new Dictionary(); private readonly IDictionary WaitDelayedFunctions = new Dictionary(); - public static CoreMethodCollection Register(IEventFactory eventFactory, IEventBus eventBus, string logPrefix, IEventSerdeService eventSerdeService, Lua lua) + public static CoreMethodCollection Register(IEventFactory eventFactory, IEventBus eventBus, IEventSerdeService eventSerdeService, Lua lua) { - var m = new CoreMethodCollection(eventFactory, eventBus, logPrefix, eventSerdeService); + var m = new CoreMethodCollection(eventFactory, eventBus, eventSerdeService); m.Register(lua); return m; } - public CoreMethodCollection(IEventFactory eventFactory, IEventBus eventBus, string logPrefix, IEventSerdeService eventSerdeService) + public CoreMethodCollection(IEventFactory eventFactory, IEventBus eventBus, IEventSerdeService eventSerdeService) { - Prefix = logPrefix; EventFactory = eventFactory; EventBus = eventBus; EventSerdeService = eventSerdeService; @@ -54,19 +52,12 @@ public void Register(Lua lua) // Make old Lua script work as before lua.DoString(@" -function print(s); core:print(s); end function debounce(a, b, c); core:debounce(a, b, c); end function wait(a, b, c); core:wait(a, b, c); end function event_to_json(a); return core:event_to_json(a); end "); } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "This is expose in Lua, so we want to keep that naming style")] - public void print(string s) - { - EventBus.PublishEvent(EventFactory.CreateUICommandWriteToConsole($"{Prefix}: {s}")); - } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "This is expose in Lua, so we want to keep that naming style")] public void debounce(string name, LuaFunction func, float debounceLength) { @@ -74,10 +65,6 @@ public void debounce(string name, LuaFunction func, float debounceLength) { DebounceDelayedFunctions[name] = new DelayedExecution(func, DateTime.Now.AddSeconds(debounceLength)); } - else - { - print("Can't debounce without a function"); - } } [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "This is expose in Lua, so we want to keep that naming style")] @@ -88,10 +75,6 @@ public void wait(string name, LuaFunction func, float duration) if (!WaitDelayedFunctions.ContainsKey(name)) WaitDelayedFunctions[name] = new DelayedExecution(func, DateTime.Now.AddSeconds(duration)); } - else - { - print("Can't wait without a function"); - } } [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "This is expose in Lua, so we want to keep that naming style")] diff --git a/Backend/Services/LuaServiceLib/LuaContext.cs b/Backend/Services/LuaServiceLib/LuaContext.cs index 6bc51d8d..6c7f85b1 100644 --- a/Backend/Services/LuaServiceLib/LuaContext.cs +++ b/Backend/Services/LuaServiceLib/LuaContext.cs @@ -19,11 +19,11 @@ public LuaContext(IEventFactory eventFactory, IEventBus eventBus, IStateService { Lua = new Lua(); - CoreMethodCollection_ = CoreMethodCollection.Register(eventFactory, eventBus, logPrefix, new EventSerdeService(), Lua); + CoreMethodCollection_ = CoreMethodCollection.Register(eventFactory, eventBus, new EventSerdeService(), Lua); AudioMethodCollection.Register(eventBus, eventFactory, Lua); TwitchMethodCollection.Register(eventBus, eventFactory, Lua); StateMethodCollection.Register(stateService, Lua); - UIMethodCollection.Register(eventBus, eventFactory, Lua); + UIMethodCollection.Register(eventBus, eventFactory, logPrefix, Lua); InternalMethodCollection.Register(eventBus, eventFactory, Lua); HttpMethodCollection.Register(eventBus, eventFactory, Lua); IRacingMethodCollection.Register(eventBus, eventFactory, Lua); diff --git a/Backend/Services/LuaServiceLib/UIMethodCollection.cs b/Backend/Services/LuaServiceLib/UIMethodCollection.cs index 6526d9ca..0e01bc0a 100644 --- a/Backend/Services/LuaServiceLib/UIMethodCollection.cs +++ b/Backend/Services/LuaServiceLib/UIMethodCollection.cs @@ -11,31 +11,40 @@ public class UIMethodCollection { private readonly IEventBus EventBus; private readonly IEventFactory EventFactory; + private readonly string Prefix; - public static UIMethodCollection Register(IEventBus eventBus, IEventFactory eventFactory, Lua lua) + public static UIMethodCollection Register(IEventBus eventBus, IEventFactory eventFactory, string logPrefix, Lua lua) { - var m = new UIMethodCollection(eventBus, eventFactory); + var m = new UIMethodCollection(eventBus, eventFactory, logPrefix); m.Register(lua); return m; } - public UIMethodCollection(IEventBus eventBus, IEventFactory eventFactory) + public UIMethodCollection(IEventBus eventBus, IEventFactory eventFactory, string logPrefix) { EventBus = eventBus; EventFactory = eventFactory; + Prefix = logPrefix; } public void Register(Lua lua) { lua["ui"] = this; lua.DoString(@" +function print(s); ui:print(s); end function create_button(a); ui:create_button(a); end function delete_button(a); ui:delete_button(a); end "); } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "This is expose in Lua, so we want to keep that naming style")] + public void print(string s) + { + EventBus.PublishEvent(EventFactory.CreateUICommandWriteToConsole($"{Prefix}: {s}")); + } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "This is expose in Lua, so we want to keep that naming style")] public void create_button(string text) { diff --git a/CHANGELOG.md b/CHANGELOG.md index f860bd5e..6ff556a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ - Lua: Add iracing_send_race_flags() that will make IRacingPlugin send race flags - InternalInitialized event removed. Refactored to avoid having it - Lua: Removed plugin_enable(), plugin_disable(). Register/Unregister them instead + - Renamed Events: + - UICommandWriteToConsole is now UIMethodCollection + - InternalReconfigured is now InternalCommandReconfigure + - InternalBootupEvents is now InternalCommandDeduplicateEvents + - InternalCommandDeduplicateEvents is now LuaManagerCommandDeduplicateEvents + - Plugin renamed: FileTriggerPlugin to LuaManagerPlugin - UI: Stores/restores Window position and size - Event: Adds TwitchReceivedMessage event (captures all messages, not only commands) - Event: Removes TwitchReceivedCommand event as this is already sent as a TwitchReceivedMessage diff --git a/Frontend/MainWindow.cs b/Frontend/MainWindow.cs index 344d17d2..9fbfe4e1 100644 --- a/Frontend/MainWindow.cs +++ b/Frontend/MainWindow.cs @@ -228,7 +228,7 @@ private void SettingsToolStripMenuItem_Click(object sender, EventArgs e) { if(new SettingsForm().ShowDialog(this) == DialogResult.OK) { - EventBus.PublishEvent(EventFactory.CreateInternalReconfigured()); + EventBus.PublishEvent(EventFactory.CreateInternalCommandReconfigure()); } } } diff --git a/Shared/EventFactory.cs b/Shared/EventFactory.cs index 5bf6f6d7..dffe293b 100644 --- a/Shared/EventFactory.cs +++ b/Shared/EventFactory.cs @@ -3,6 +3,7 @@ using Slipstream.Shared.Events.FileMonitor; using Slipstream.Shared.Events.Internal; using Slipstream.Shared.Events.IRacing; +using Slipstream.Shared.Events.LuaManager; using Slipstream.Shared.Events.Twitch; using Slipstream.Shared.Events.UI; using System; @@ -70,12 +71,12 @@ public InternalPluginState CreateInternalPluginState(string pluginId, string plu return new InternalPluginState { Id = pluginId, PluginName = pluginName, DisplayName = displayName, PluginStatus = pluginStatus.ToString() }; } - public InternalReconfigured CreateInternalReconfigured() + public InternalCommandReconfigure CreateInternalCommandReconfigure() { - return new InternalReconfigured(); + return new InternalCommandReconfigure(); } - public InternalBootupEvents CreateInternalBootupEvents(IEvent[] events) + public LuaManagerCommandDeduplicateEvents CreateLuaManagerCommandDeduplicateEvents(IEvent[] events) { string json = ""; @@ -84,7 +85,7 @@ public InternalBootupEvents CreateInternalBootupEvents(IEvent[] events) json += EventSerdeService.Serialize(e) + "\n"; } - return new InternalBootupEvents + return new LuaManagerCommandDeduplicateEvents { Events = json }; diff --git a/Shared/EventHandler.cs b/Shared/EventHandler.cs index 0cad3e88..494c08e5 100644 --- a/Shared/EventHandler.cs +++ b/Shared/EventHandler.cs @@ -35,11 +35,13 @@ public EventHandlerArgs(T e) public delegate void OnInternalCommandPluginStatesHandler(EventHandler source, EventHandlerArgs e); public event OnInternalCommandPluginStatesHandler? OnInternalCommandPluginStates; - public delegate void OnInternalReconfiguredHandler(EventHandler source, EventHandlerArgs e); - public event OnInternalReconfiguredHandler? OnInternalReconfigured; + public delegate void OnInternalCommandReconfigureHandler(EventHandler source, EventHandlerArgs e); + public event OnInternalCommandReconfigureHandler? OnInternalCommandReconfigure; + #endregion - public delegate void OnInternalBootupEventsHandler(EventHandler source, EventHandlerArgs e); - public event OnInternalBootupEventsHandler? OnInternalBootupEvents; + #region Events: LuaManager + public delegate void OnInternalCommandDeduplicateEventsHandler(EventHandler source, EventHandlerArgs e); + public event OnInternalCommandDeduplicateEventsHandler? OnLuaManagerCommandDeduplicateEvents; #endregion @@ -201,17 +203,20 @@ public void HandleEvent(IEvent? ev) else OnInternalCommandPluginStates.Invoke(this, new EventHandlerArgs(tev)); break; - case Shared.Events.Internal.InternalReconfigured tev: - if (OnInternalReconfigured == null) + case Shared.Events.Internal.InternalCommandReconfigure tev: + if (OnInternalCommandReconfigure == null) OnDefault?.Invoke(this, new EventHandlerArgs(tev)); else - OnInternalReconfigured.Invoke(this, new EventHandlerArgs(tev)); + OnInternalCommandReconfigure.Invoke(this, new EventHandlerArgs(tev)); break; - case Shared.Events.Internal.InternalBootupEvents tev: - if (OnInternalBootupEvents == null) + + // LuaManager + + case Shared.Events.LuaManager.LuaManagerCommandDeduplicateEvents tev: + if (OnLuaManagerCommandDeduplicateEvents == null) OnDefault?.Invoke(this, new EventHandlerArgs(tev)); else - OnInternalBootupEvents.Invoke(this, new EventHandlerArgs(tev)); + OnLuaManagerCommandDeduplicateEvents.Invoke(this, new EventHandlerArgs(tev)); break; // File Monitor diff --git a/Shared/Events/Internal/InternalReconfigured.cs b/Shared/Events/Internal/InternalCommandReconfigure.cs similarity index 78% rename from Shared/Events/Internal/InternalReconfigured.cs rename to Shared/Events/Internal/InternalCommandReconfigure.cs index c2a486e5..213b65bb 100644 --- a/Shared/Events/Internal/InternalReconfigured.cs +++ b/Shared/Events/Internal/InternalCommandReconfigure.cs @@ -4,14 +4,14 @@ namespace Slipstream.Shared.Events.Internal { - public class InternalReconfigured : IEvent + public class InternalCommandReconfigure : IEvent { - public string EventType => "InternalReconfigured"; + public string EventType => "InternalCommandReconfigure"; public bool ExcludeFromTxrx => true; public override bool Equals(object? obj) { - return obj is InternalReconfigured reconfigured && + return obj is InternalCommandReconfigure reconfigured && EventType == reconfigured.EventType && ExcludeFromTxrx == reconfigured.ExcludeFromTxrx; } diff --git a/Shared/Events/Internal/InternalBootupEvents.cs b/Shared/Events/LuaManager/LuaManagerCommandDeduplicateEvents.cs similarity index 76% rename from Shared/Events/Internal/InternalBootupEvents.cs rename to Shared/Events/LuaManager/LuaManagerCommandDeduplicateEvents.cs index e4cb91ac..1c3a1729 100644 --- a/Shared/Events/Internal/InternalBootupEvents.cs +++ b/Shared/Events/LuaManager/LuaManagerCommandDeduplicateEvents.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; -namespace Slipstream.Shared.Events.Internal +namespace Slipstream.Shared.Events.LuaManager { - public class InternalBootupEvents : IEvent + public class LuaManagerCommandDeduplicateEvents : IEvent { - public string EventType => "InternalBootupEvents"; + public string EventType => "LuaManagerCommandDeduplicateEvents"; public bool ExcludeFromTxrx => true; @@ -12,7 +12,7 @@ public class InternalBootupEvents : IEvent public override bool Equals(object obj) { - return obj is InternalBootupEvents events && + return obj is LuaManagerCommandDeduplicateEvents events && EventType == events.EventType && ExcludeFromTxrx == events.ExcludeFromTxrx && Events == events.Events; diff --git a/Shared/IEventFactory.cs b/Shared/IEventFactory.cs index bb7d32f7..ecc09a34 100644 --- a/Shared/IEventFactory.cs +++ b/Shared/IEventFactory.cs @@ -2,6 +2,7 @@ using Slipstream.Shared.Events.FileMonitor; using Slipstream.Shared.Events.Internal; using Slipstream.Shared.Events.IRacing; +using Slipstream.Shared.Events.LuaManager; using Slipstream.Shared.Events.Twitch; using Slipstream.Shared.Events.UI; @@ -38,8 +39,8 @@ public enum IRacingSessionStateEnum InternalCommandPluginStates CreateInternalCommandPluginStates(); InternalCommandPluginUnregister CreateInternalCommandPluginUnregister(string pluginId); InternalPluginState CreateInternalPluginState(string pluginId, string pluginName, string displayName, PluginStatusEnum pluginStatus); - InternalReconfigured CreateInternalReconfigured(); - InternalBootupEvents CreateInternalBootupEvents(IEvent[] events); + InternalCommandReconfigure CreateInternalCommandReconfigure(); + LuaManagerCommandDeduplicateEvents CreateLuaManagerCommandDeduplicateEvents(IEvent[] events); IRacingCarCompletedLap CreateIRacingCarCompletedLap(double sessionTime, long carIdx, double time, int lapsCompleted, float? fuelDiff, bool localUser); IRacingCarInfo CreateIRacingCarInfo( diff --git a/Slipstream.csproj b/Slipstream.csproj index e1856337..68615558 100644 --- a/Slipstream.csproj +++ b/Slipstream.csproj @@ -171,8 +171,8 @@ - - + + @@ -200,7 +200,7 @@ - +