DP-PatMe2Mqtt/PatMe2Mqtt/PatMeProxyApi/EmoteCountersList.cs
2023-05-26 15:31:36 +02:00

22 lines
686 B
C#

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
// This could be optimized in a thousand different ways (better dynamic methods, source-gen this class), but eh.
namespace PatMe2Mqtt.PatMeProxyApi
{
public readonly record struct EmoteCountersList(PatMe PatMe, object ProxiedValue) : IPatMeProxy, IEnumerable<EmoteCounter>
{
public IEnumerator<EmoteCounter> GetEnumerator()
{
foreach (var value in (IList) ProxiedValue)
{
yield return new EmoteCounter(PatMe, value);
}
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}