using System; using System.Collections.Generic; using System.Linq; using RGB.NET.Core; using SimpleTCP; namespace RGB.NET.Devices.SoIP.Server { /// /// /// Represents the update-queue performing updates for E131-DMX devices. /// public class SoIPServerUpdateQueue : UpdateQueue { #region Properties & Fields private readonly SimpleTcpServer _tcpServer; #endregion #region Constructors /// /// /// Initializes a new instance of the class. /// /// The update trigger used by this queue. /// The hostname of the device this queue is performing updates for. public SoIPServerUpdateQueue(IDeviceUpdateTrigger updateTrigger, SimpleTcpServer tcpServer) : base(updateTrigger) { this._tcpServer = tcpServer; } #endregion #region Methods /// protected override void Update(Dictionary dataSet) { if ((dataSet != null) && (dataSet.Count > 0)) { string m = GetLedString(dataSet); _tcpServer.BroadcastLine(m); } } private string GetLedString(Dictionary dataSet) => string.Join(";", dataSet.Select(x => x.Key.ToString() + "|" + x.Value.AsARGBHexString())); #endregion } }