Пример #1
0
        public void LoadNetwork(TreeNodeCollection root, string name, DhtNetwork network)
        {
            StructureNode netItem = new StructureNode(name, new ShowDelegate(ShowNetwork), network);

            // cache
            netItem.Nodes.Add(new StructureNode("Cache", new ShowDelegate(ShowCache), network));

            // logs
            StructureNode logsNode = new StructureNode("Logs", new ShowDelegate(UpdateLogs), network);
            AddLogs(logsNode, network);
            netItem.Nodes.Add(logsNode);

            // routing
            netItem.Nodes.Add(new StructureNode("Routing", new ShowDelegate(ShowRouting), network));

            // search
            StructureNode searchNode = new StructureNode("Searches", new ShowDelegate(ShowNone), null);

            StructureNode pendingNode = new StructureNode("Pending", new ShowDelegate(UpdateSearches), network.Searches.Pending);
            StructureNode activeNode = new StructureNode("Active", new ShowDelegate(UpdateSearches), network.Searches.Active);

            AddSearchNodes(pendingNode, network.Searches.Pending);
            AddSearchNodes(activeNode, network.Searches.Active);

            searchNode.Nodes.Add(pendingNode);
            searchNode.Nodes.Add(activeNode);

            netItem.Nodes.Add(searchNode);

            // store
            StructureNode storeNode = new StructureNode("Store", new ShowDelegate(ShowStore), network);

            netItem.Nodes.Add(storeNode);

            // tcp
            StructureNode connectionsNode = new StructureNode("Tcp", new ShowDelegate(ShowTcp), network);
            AddConnectionNodes(connectionsNode, network);
            netItem.Nodes.Add(connectionsNode);

            // identity
            netItem.Nodes.Add(new StructureNode("Rudp", new ShowDelegate(ShowRudp), network));

            root.Add(netItem);
        }
Пример #2
0
        public InternalsForm(CoreUI ui)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            UI = ui;
            Core = ui.Core;

            Boards = Core.GetService(ServiceIDs.Board) as BoardService;
            Mail = Core.GetService(ServiceIDs.Mail) as MailService;
            Profiles = Core.GetService(ServiceIDs.Profile) as ProfileService;

            Text = "Internals (" + Core.Network.GetLabel() + ")";

            treeStructure.Nodes.Add( new StructureNode("", new ShowDelegate(ShowNone), null));

            // core
                // identity
                // networks (global/operation)
                    // cache
                    // logs
                    // routing
                    // search
                    // store
                    // tcp
                // Components
                    // Link
                    // Location
                    // ...
                // rudp
                    // sessions[]

            // core
            StructureNode coreNode = new StructureNode("Core", new ShowDelegate(ShowCore), null);

            // identity
            coreNode.Nodes.Add( new StructureNode(".Identity", new ShowDelegate(ShowIdentity), null));

            // networks
            if(Core.Context.Lookup != null)
                LoadNetwork(coreNode.Nodes, "Lookup", Core.Context.Lookup.Network);

            LoadNetwork(coreNode.Nodes, "Organization", Core.Network);

            // components
            StructureNode componentsNode = new StructureNode("Components", new ShowDelegate(ShowNone), null);
            LoadComponents(componentsNode);
            coreNode.Nodes.Add(componentsNode);

            treeStructure.Nodes.Add(coreNode);
            coreNode.Expand();
        }
Пример #3
0
        public void AddSearchNodes(StructureNode parentNode, List<DhtSearch> searchList)
        {
            parentNode.Nodes.Clear();

            foreach(DhtSearch search in searchList)
                parentNode.Nodes.Add( new StructureNode(search.Name, new ShowDelegate(ShowSearch), search));
        }
Пример #4
0
        public void AddLogs(StructureNode parentNode, DhtNetwork network)
        {
            parentNode.Nodes.Clear();

            lock(network.LogTable)
                foreach (string name in network.LogTable.Keys)
                    parentNode.Nodes.Add( new StructureNode(name, new ShowDelegate(ShowLog), new LogInfo(name, network)));
        }
Пример #5
0
        public void AddConnectionNodes(StructureNode parentNode, DhtNetwork network)
        {
            parentNode.Nodes.Clear();

            lock(network.TcpControl.SocketList)
                foreach (TcpConnect connect in network.TcpControl.SocketList)
                    parentNode.Nodes.Add( new StructureNode(connect.ToString(), new ShowDelegate(ShowTcpConnect), connect));
        }
Пример #6
0
        private void LoadComponents(StructureNode componentsNode)
        {
            foreach (ushort id in Core.ServiceMap.Keys)
            {
                switch (id)
                {
                    case 1://ServiceID.Trust:
                        StructureNode linkNode = new StructureNode("Links", new ShowDelegate(ShowLinks), null);
                        linkNode.Nodes.Add(new StructureNode("Index", new ShowDelegate(ShowLinkMap), null));
                        linkNode.Nodes.Add(new StructureNode("Roots", new ShowDelegate(ShowLinkRoots), null));
                        linkNode.Nodes.Add(new StructureNode("Projects", new ShowDelegate(ShowLinkProjects), null));
                        componentsNode.Nodes.Add(linkNode);
                        break;

                    case 2://ServiceID.Location:
                        StructureNode locNode = new StructureNode("Locations", new ShowDelegate(ShowLocations), null);
                        locNode.Nodes.Add(new StructureNode("Lookup", new ShowDelegate(ShowLocGlobal), null));
                        locNode.Nodes.Add(new StructureNode("Organization", new ShowDelegate(ShowLocOperation), null));
                        componentsNode.Nodes.Add(locNode);
                        break;

                    case 3://ServiceID.Transfer:
                        StructureNode transNode = new StructureNode("Transfers", new ShowDelegate(ShowTransfers), null);
                        transNode.Nodes.Add(new StructureNode("Uploads", new ShowDelegate(ShowUploads), null));
                        transNode.Nodes.Add(new StructureNode("Downloads", new ShowDelegate(ShowDownloads), null));
                        componentsNode.Nodes.Add(transNode);
                        break;

                    case 4://ServiceID.Profile:
                        StructureNode profileNode = new StructureNode("Profiles", new ShowDelegate(ShowProfiles), null);
                        componentsNode.Nodes.Add(profileNode);
                        break;

                    case 7://ServiceID.Mail:
                        StructureNode mailNode = new StructureNode("Mail", new ShowDelegate(ShowMail), null);
                        mailNode.Nodes.Add(new StructureNode("Mail", new ShowDelegate(ShowMailMap), null));
                        mailNode.Nodes.Add(new StructureNode("Acks", new ShowDelegate(ShowAckMap), null));
                        mailNode.Nodes.Add(new StructureNode("Pending", new ShowDelegate(ShowPendingMap), null));
                        mailNode.Nodes.Add(new StructureNode("My Pending Mail", new ShowDelegate(ShowPendingMail), null));
                        mailNode.Nodes.Add(new StructureNode("My Pending Acks", new ShowDelegate(ShowPendingAcks), null));
                        componentsNode.Nodes.Add(mailNode);
                        break;

                    case 8://ServiceID.Board:
                        StructureNode boardNode = new StructureNode("Board", new ShowDelegate(ShowBoard), null);
                        componentsNode.Nodes.Add(boardNode);
                        break;

                    case 11: // ServiceID.LocalSync
                        StructureNode syncNode = new StructureNode("LocalSync", new ShowDelegate(ShowLocalSync), null);
                        componentsNode.Nodes.Add(syncNode);
                        break;
                }
            }
        }
Пример #7
0
        public void AddBoardNodes(StructureNode parentNode)
        {
            parentNode.Nodes.Clear();

            Boards.BoardMap.LockReading(delegate()
            {
                foreach (OpBoard board in Boards.BoardMap.Values)
                    parentNode.Nodes.Add(new StructureNode(GetLinkName(board.UserID), new ShowDelegate(ShowTargetBoard), board));
            });
        }