Ejemplo n.º 1
0
        private static Boolean IsInterfaceSubscribedToChannel(short _channel, ISubspaceInterface _subspaceInterface)
        {
            if (ChannelMap.ContainsKey(_channel) == false) return false; //If the channel key does not exist then no interfaces have subscribed.

            if (ChannelMap[_channel].Contains(_subspaceInterface) == false) return false; //If the channel has been created but the interface has not subscribed yet.
            else return true; //The interface is subscribed.
        }
Ejemplo n.º 2
0
        /**
         * Subscribes an interface to the specified channel. Returns true if the interface
         * is not already subscribed.
         */
        public static Boolean SubscribeToChannel(short _channel, ISubspaceInterface _subspaceInterface)
        {
            if (IsInterfaceSubscribedToChannel(_channel, _subspaceInterface)) return false;

            if (ChannelMap.ContainsKey(_channel))
            {
                ChannelMap[_channel].Add(_subspaceInterface);

            }
            else
            {
                ChannelMap.Add(_channel, new List<ISubspaceInterface>());
                ChannelMap[_channel].Add(_subspaceInterface);
            }

            return true;
        }