예제 #1
0
        private void _StopNotify(string channel, string item, string value)
        {
            if (m_StopNotifies == null)
            {
                return;
            }
            string         key  = $"{channel}.{item}";
            StopNotifyInfo info = null;

            foreach (var allow in m_StopNotifies)
            {
                if (allow.isAllow(channel, item))
                {
                    info = allow;
                    break;
                }
            }
            if (info == null)
            {
                return;
            }

            if (!m_Channels.ContainsKey(key))
            {
                TimerChannel cinfo = new TimerChannel(Server, info.Style, info.Interval, channel, item, value);
                m_Channels.TryAdd(key, cinfo);
            }
            else
            {
                m_Channels[key].Value = value;
            }
        }
예제 #2
0
        private Monitor(ServerInfo server)
        {
            Server = server;

            //Channel, Item非空的, 直接先建ChannelInfo
            if (m_StopNotifies != null && m_StopNotifies.Count > 0)
            {
                foreach (var item in m_StopNotifies)
                {
                    if (string.IsNullOrEmpty(item.Channel) || string.IsNullOrEmpty(item.Item))
                    {
                        continue;
                    }
                    var key = $"{item.Channel}.{item.Item}";
                    if (!m_Channels.ContainsKey(key))
                    {
                        TimerChannel cinfo = new TimerChannel(Server, item.Style, item.Interval, item.Channel, item.Item, string.Empty);
                        m_Channels.TryAdd(key, cinfo);
                    }
                }
            }
        }