Beispiel #1
0
        public void Reload()
        {
            List <Link> allLinks = _rpc.GetLinks(_peerId, _channel);
            Dictionary <long, Dictionary <long, Link> > links = new Dictionary <long, Dictionary <long, Link> >();

            foreach (Link link in allLinks)
            {
                if (!links.ContainsKey(link.RemotePeerID))
                {
                    links.Add(link.RemotePeerID, new Dictionary <long, Link>());
                }

                if (links[link.RemotePeerID].ContainsKey(link.RemoteChannel))
                {
                    continue;
                }

                links[link.RemotePeerID].Add(link.RemoteChannel, link);
            }
            Dictionary <long, ReadOnlyDictionary <long, Link> > links2 = new Dictionary <long, ReadOnlyDictionary <long, Link> >();

            foreach (KeyValuePair <long, Dictionary <long, Link> > pair in links)
            {
                links2.Add(pair.Key, new ReadOnlyDictionary <long, Link>(pair.Value));
            }
            _dictionary = links2;
        }