mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-13 19:54:59 +00:00
feat: move MC into Essentials
In order to solve some dependency issues that keep cropping up, MC should be moved back into the Essentials repo and loaded automatically on startup. This will allow for all plugins that use the MC Messengers library to use the same version without fear of overwriting a dll due to loading of plugin libraries.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
public class IDspPresetsMessenger : MessengerBase
|
||||
{
|
||||
private IDspPresets _device;
|
||||
|
||||
public IDspPresetsMessenger(string key, string messagePath, IDspPresets device)
|
||||
: base(key, messagePath, device as Device)
|
||||
{
|
||||
_device = device;
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) =>
|
||||
{
|
||||
var message = new IHasDspPresetsStateMessage
|
||||
{
|
||||
Presets = _device.Presets
|
||||
};
|
||||
|
||||
PostStatusMessage(message);
|
||||
});
|
||||
|
||||
AddAction("/recallPreset", (id, content) =>
|
||||
{
|
||||
var presetKey = content.ToObject<string>();
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(presetKey))
|
||||
{
|
||||
_device.RecallPreset(presetKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class IHasDspPresetsStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("presets")]
|
||||
public Dictionary<string, IKeyName> Presets { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user