Beispiel #1
0
        private void SafeNotifyListener(string content, string md5, ManagerListenerWrap wrap)
        {
            var listener = wrap.Listener;

            wrap.LastContent = content;
            wrap.LastCallMd5 = md5;

            listener.ReceiveConfigInfo(content);
        }
Beispiel #2
0
        public void AddListener(IListener listener)
        {
            if (listener == null)
            {
                throw new ArgumentException("listener is null");
            }

            ManagerListenerWrap wrap = new ManagerListenerWrap(listener, Md5, Content);

            Listeners.Add(wrap);
        }
Beispiel #3
0
        public void RemoveListener(IListener listener)
        {
            if (listener == null)
            {
                throw new ArgumentException("listener is null");
            }

            ManagerListenerWrap wrap = new ManagerListenerWrap(listener);

            if (Listeners.Remove(wrap))
            {
                Console.WriteLine($"[{Name}] [remove-listener] ok, dataId={DataId}, group={Group}, cnt={Listeners.Count}");
            }
        }
Beispiel #4
0
        private void SafeNotifyListener(string dataId, string group, string content, string type,
                                        string md5, string encryptedDataKey, ManagerListenerWrap wrap)
        {
            var listener = wrap.Listener;

            ConfigResponse cr = new ConfigResponse();

            cr.SetDataId(dataId);
            cr.SetGroup(group);
            cr.SetContent(content);
            cr.SetEncryptedDataKey(encryptedDataKey);
            ConfigFilterChainManager.DoFilter(null, cr);

            // after filter, such as decrypted value
            string contentTmp = cr.GetContent();

            wrap.LastContent = content;
            wrap.LastCallMd5 = md5;

            // should pass the value after filter
            listener.ReceiveConfigInfo(contentTmp);
        }