DP-PatMe2Mqtt/PatMe2Mqtt/PatMeProxyApi/EmoteCountersList.cs

22 lines
686 B
C#
Raw Normal View History

2023-05-26 15:26:16 +02:00
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();
}
}