예제 #1
0
        public static MPProtectedChannel GetChannel(string channelName, int waitTime)
        {
            if (MPChannelSettings.Find(channelName) == null)
            {
                return(null);
            }

            if (waitTime <= 0)
            {
                waitTime = 20 * 1000;
            }
            ManualTimer        timer = new ManualTimer(waitTime);
            MPProtectedChannel pc    = GetChannel(channelName, true);

            while (!timer.Timeout)
            {
                if (pc != null)
                {
                    return(pc);
                }
                pc = GetChannel(channelName, false);
                System.Threading.Thread.Sleep(200);
            }
            MPChannels.Log(string.Format("Cannot open channel to {0}", channelName));
            return(null);
        }
예제 #2
0
        public static MPProtectedChannel CreateChannel(string channelName)
        {
            MPChannelSettings settings = MPChannelSettings.Find(channelName);

            if (settings == null)
            {
                return(null);
            }
            return(new MPProtectedChannel(settings));
        }
예제 #3
0
        public static bool IsAvailable(string channelName)
        {
            MPChannelSettings cs = MPChannelSettings.Find(channelName);

            if (cs == null)
            {
                return(false);
            }
            return(cs.Available);
        }