using System; namespace TyphoonEvent { internal class ProxyGroup { public uint ID { get; set; } public IEventProxy[] Proxies { get; set; } public ProxyGroup(uint id, IEventProxy[] proxies) { ID = id; Proxies = proxies ?? Array.Empty(); EventKit.Register(Proxies); } //注销 public void Release() { EventKit.ReleaseGroup(ID); foreach (var proxy in Proxies) { proxy.Release(); } Proxies = null; } public void EnableAll() { foreach (var proxy in Proxies) { proxy.Enable(); } } public void DisableAll() { foreach (var proxy in Proxies) { proxy.Disable(); } } public void Enable() { var type = typeof(T); foreach (var proxy in Proxies) { if (proxy.MessageType == type) { proxy.Enable(); } } } public void Disable() { var type = typeof(T); foreach (var proxy in Proxies) { if (proxy.MessageType == type) { proxy.Disable(); } } } } }