コード例 #1
0
        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);
        }
コード例 #2
0
 public void Dispose()
 {
     if (!disposed)
     {
         logger($"{nameof(MessageHandler)} is being disposed.");
         IGC.UnicastListener.DisableMessageCallback();
         foreach (var listener in broadcastListeners)
         {
             IGC.DisableBroadcastListener(listener);
         }
         disposed = true;
     }
 }