public static void UnregisterBroadcastListener(this IMyIntergridCommunicationSystem src, string tag) { var listeners = src.GetBroadcastListeners(); var taggedListener = listeners.FirstOrDefault(l => l.Tag == tag); if (taggedListener == null) { return; } src.DisableBroadcastListener(taggedListener); }
public void Dispose() { if (!disposed) { logger($"{nameof(MessageHandler)} is being disposed."); IGC.UnicastListener.DisableMessageCallback(); foreach (var listener in broadcastListeners) { IGC.DisableBroadcastListener(listener); } disposed = true; } }