コード例 #1
0
        /**************************************************************************/

        private void RenderTreeViewSummary(MacroscopeDocumentCollection DocCollection)
        {
            MacroscopeJobMaster JobMaster = this.MainForm.GetJobMaster();

            this.tvTreeView.BeginUpdate();

            try
            {
                {
                    SortedDictionary <string, double> DataPoints = new SortedDictionary <string, double>();

                    {
                        TreeNode[] Leaf  = this.tvTreeView.Nodes.Find("UrlsFound", true);
                        int        Count = JobMaster.GetPagesFound();
                        if (Leaf.Length > 0)
                        {
                            Leaf[0].Text = string.Format("Total URLs Found: {0}", Count);
                        }
                        DataPoints.Add("URLs Found", (double)Count);
                    }

                    {
                        TreeNode[] Leaf  = this.tvTreeView.Nodes.Find("UrlsCrawled", true);
                        int        Count = DocCollection.CountDocuments();
                        if (Leaf.Length > 0)
                        {
                            Leaf[0].Text = string.Format("Total URLs Crawled: {0}", Count);
                        }
                        DataPoints.Add("URLs Crawled", (double)Count);
                    }

                    {
                        TreeNode[] Leaf  = this.tvTreeView.Nodes.Find("UrlsInternal", true);
                        ulong      Count = DocCollection.CountUrlsInternal();
                        if (Leaf.Length > 0)
                        {
                            Leaf[0].Text = string.Format("Total Internal URLs: {0}", Count);
                        }
                        DataPoints.Add("Internal URLs", (double)Count);
                    }

                    {
                        TreeNode[] Leaf  = this.tvTreeView.Nodes.Find("UrlsExternal", true);
                        ulong      Count = DocCollection.CountUrlsExternal();
                        if (Leaf.Length > 0)
                        {
                            Leaf[0].Text = string.Format("Total External URLs: {0}", Count);
                        }
                        DataPoints.Add("External URLs", (double)Count);
                    }

                    this.SiteStructurePanelCharts.UpdateSiteSummary(DataPoints: DataPoints);
                }

                {
                    SortedDictionary <string, double> DataPoints = new SortedDictionary <string, double>();
                    decimal Fastest = DocCollection.GetStatsDurationsFastest();
                    decimal Slowest = DocCollection.GetStatsDurationsSlowest();
                    decimal Average = DocCollection.GetStatsDurationAverage();

                    {
                        TreeNode[] Leaf = this.tvTreeView.Nodes.Find("FASTESTPAGERESPONSE", true);
                        if (Leaf.Length > 0)
                        {
                            Leaf[0].Text = string.Format("Fastest Page Response: {0:0.00} secs", Fastest);
                            DataPoints.Add("Fastest Page Response", (double)Fastest);
                        }
                        else
                        {
                            DataPoints.Add("Fastest Page Response", 0);
                        }
                    }

                    {
                        TreeNode[] Leaf = this.tvTreeView.Nodes.Find("SLOWESTPAGERESPONSE", true);
                        if (Leaf.Length > 0)
                        {
                            Leaf[0].Text = string.Format("Slowest Page Response: {0:0.00} secs", Slowest);
                            DataPoints.Add("Slowest Page Response", (double)Slowest);
                        }
                        else
                        {
                            DataPoints.Add("Slowest Page Response", 0);
                        }
                    }

                    {
                        TreeNode[] Leaf = this.tvTreeView.Nodes.Find("AVERAGEPAGEDURATION", true);
                        if (Leaf.Length > 0)
                        {
                            Leaf[0].Text = string.Format("Average Page Duration: {0:0.00} secs", Average);
                            DataPoints.Add("Average Page Duration", (double)Average);
                        }
                        else
                        {
                            DataPoints.Add("Average Page Duration", 0);
                        }
                    }

                    this.SiteStructurePanelCharts.UpdateResponseTimes(DataPoints: DataPoints);
                }

                {
                    TreeNode[] Leaf  = this.tvTreeView.Nodes.Find("UrlsRobotsBlocked", true);
                    int        Count = JobMaster.GetBlockedByRobotsList().Count;
                    if (Leaf.Length > 0)
                    {
                        Leaf[0].Text = string.Format("URLs Blocked by Robots.txt: {0}", Count);
                    }
                }

                {
                    TreeNode[] Leaf  = this.tvTreeView.Nodes.Find("SitemapsFound", true);
                    ulong      Count = DocCollection.CountUrlsSitemaps();
                    if (Leaf.Length > 0)
                    {
                        Leaf[0].Text = string.Format("Sitemaps Found: {0}", Count);
                    }
                }

                {
                    TreeNode[] Leaves = this.tvTreeView.Nodes.Find("FETCH_WARNINGS", true);
                    if (Leaves.Length > 0)
                    {
                        TreeNode Leaf = Leaves[0];
                        if (Leaf != null)
                        {
                            Dictionary <string, int> dicMessages = DocCollection.GetStatsWarningsCount();
                            Leaf.Nodes.Clear();
                            foreach (string MessagesKey in dicMessages.Keys)
                            {
                                Leaf.Nodes.Add(string.Format("{0}: {1}", MessagesKey, dicMessages[MessagesKey]));
                            }
                        }
                    }
                }

                {
                    TreeNode[] Leaves = this.tvTreeView.Nodes.Find("FETCH_ERRORS", true);
                    if (Leaves.Length > 0)
                    {
                        TreeNode Leaf = Leaves[0];
                        if (Leaf != null)
                        {
                            Dictionary <string, int> dicMessages = DocCollection.GetStatsErrorsCount();
                            Leaf.Nodes.Clear();
                            foreach (string MessagesKey in dicMessages.Keys)
                            {
                                Leaf.Nodes.Add(string.Format("{0}: {1}", MessagesKey, dicMessages[MessagesKey]));
                            }
                        }
                    }
                }

                {
                    Dictionary <bool, int> Canonicals = DocCollection.GetStatsCanonicalsCount();
                    {
                        TreeNode[] Leaf = this.tvTreeView.Nodes.Find("CANONICALS_SPECIFIED_SPECIFIED", true);
                        if ((Leaf.Length > 0) && (Canonicals.ContainsKey(true)))
                        {
                            Leaf[0].Text = string.Format("Specified: {0}", Canonicals[true]);
                        }
                        else
                        {
                            Leaf[0].Text = string.Format("Specified: {0}", 0);
                        }
                    }
                    {
                        TreeNode[] Leaf = this.tvTreeView.Nodes.Find("CANONICALS_SPECIFIED_NOT_SPECIFIED", true);
                        if ((Leaf.Length > 0) && (Canonicals.ContainsKey(false)))
                        {
                            Leaf[0].Text = string.Format("Not Specified: {0}", Canonicals[false]);
                        }
                        else
                        {
                            Leaf[0].Text = string.Format("Not Specified: {0}", 0);
                        }
                    }
                }

                {
                    {
                        TreeNode[] Leaves = this.tvTreeView.Nodes.Find("DOCUMENT_TYPES_FOUND_INTERNAL", true);
                        if (Leaves.Length > 0)
                        {
                            TreeNode Leaf = Leaves[0];
                            if (Leaf != null)
                            {
                                Dictionary <string, int> Stats = DocCollection.GetStatsDocumentTypesInternalCount();
                                Leaf.Nodes.Clear();
                                foreach (string ContentKey in Stats.Keys)
                                {
                                    TreeNode LeafNode = Leaf.Nodes.Add(string.Format("{0}: {1}", ContentKey, Stats[ContentKey]));
                                    LeafNode.Tag = "DOCUMENT_TYPES_FOUND_INTERNAL_TYPE"; // For graph selection click
                                }
                            }
                        }
                    }
                    {
                        TreeNode[] Leaves = this.tvTreeView.Nodes.Find("DOCUMENT_TYPES_FOUND_EXTERNAL", true);
                        if (Leaves.Length > 0)
                        {
                            TreeNode Leaf = Leaves[0];
                            if (Leaf != null)
                            {
                                Dictionary <string, int> Stats = DocCollection.GetStatsDocumentTypesExternalCount();
                                Leaf.Nodes.Clear();
                                foreach (string ContentKey in Stats.Keys)
                                {
                                    TreeNode LeafNode = Leaf.Nodes.Add(string.Format("{0}: {1}", ContentKey, Stats[ContentKey]));
                                    LeafNode.Tag = "DOCUMENT_TYPES_FOUND_EXTERNAL_TYPE"; // For graph selection click
                                }
                            }
                        }
                    }
                }

                {
                    SortedDictionary <string, double> DataPoints = new SortedDictionary <string, double>();
                    TreeNode[] Leaves = this.tvTreeView.Nodes.Find("LANGUAGES_SPECIFIED_PAGES", true);
                    if (Leaves.Length > 0)
                    {
                        TreeNode Leaf = Leaves[0];
                        if (Leaf != null)
                        {
                            Dictionary <string, int> dicContents = DocCollection.GetStatsLanguagesPagesCount();
                            Leaf.Nodes.Clear();
                            foreach (string ContentKey in dicContents.Keys)
                            {
                                TreeNode LeafNode = Leaf.Nodes.Add(string.Format("{0}: {1}", ContentKey, dicContents[ContentKey]));
                                LeafNode.Tag = "LANGUAGES_SPECIFIED_PAGES_LANG";
                                DataPoints.Add(ContentKey, (double)dicContents[ContentKey]);
                            }
                        }
                        this.SiteStructurePanelCharts.UpdateLanguagesSpecified(DataPoints: DataPoints);
                    }
                }

                {
                    TreeNode[] Leaves = this.tvTreeView.Nodes.Find("LANGUAGES_DETECTED_TITLES", true);

                    if (Leaves.Length > 0)
                    {
                        TreeNode Leaf = Leaves[0];

                        if (Leaf != null)
                        {
                            Dictionary <string, int> dicContents = DocCollection.GetStatsLanguagesTitlesCount();

                            Leaf.Nodes.Clear();

                            foreach (string ContentKey in dicContents.Keys)
                            {
                                Leaf.Nodes.Add(string.Format("{0}: {1}", ContentKey, dicContents[ContentKey]));
                            }
                        }
                    }
                }

                {
                    TreeNode[] Leaves = this.tvTreeView.Nodes.Find("LANGUAGES_DETECTED_DESCRIPTIONS", true);

                    if (Leaves.Length > 0)
                    {
                        TreeNode Leaf = Leaves[0];

                        if (Leaf != null)
                        {
                            Dictionary <string, int> dicContents = DocCollection.GetStatsLanguagesDescriptionsCount();

                            Leaf.Nodes.Clear();

                            foreach (string ContentKey in dicContents.Keys)
                            {
                                Leaf.Nodes.Add(string.Format("{0}: {1}", ContentKey, dicContents[ContentKey]));
                            }
                        }
                    }
                }

                {
                    TreeNode[] Leaves = this.tvTreeView.Nodes.Find("LANGUAGES_DETECTED_BODYTEXTS", true);

                    if (Leaves.Length > 0)
                    {
                        TreeNode Leaf = Leaves[0];

                        if (Leaf != null)
                        {
                            Dictionary <string, int> dicContents = DocCollection.GetStatsLanguagesBodyTextsCount();

                            Leaf.Nodes.Clear();

                            foreach (string ContentKey in dicContents.Keys)
                            {
                                Leaf.Nodes.Add(string.Format("{0}: {1}", ContentKey, dicContents[ContentKey]));
                            }
                        }
                    }
                }

                {
                    SortedDictionary <string, double> DataPoints = new SortedDictionary <string, double>();

                    TreeNode[] Leaves = this.tvTreeView.Nodes.Find("TEXT_READABILITY", true);

                    if (Leaves.Length > 0)
                    {
                        TreeNode Leaf = Leaves[0];

                        if (Leaf != null)
                        {
                            SortedDictionary <string, int> dicContents = DocCollection.GetStatsReadabilityGradeStringsCount();

                            Leaf.Nodes.Clear();

                            foreach (string ContentKey in dicContents.Keys)
                            {
                                TreeNode LeafLeaf = Leaf.Nodes.Add(string.Format("{0}: {1}", ContentKey, dicContents[ContentKey]));

                                LeafLeaf.Tag = "TEXT_READABILITY_NODE";

                                DataPoints.Add(ContentKey, (double)dicContents[ContentKey]);
                            }
                        }

                        this.SiteStructurePanelCharts.UpdateReadability(DataPoints: DataPoints);
                    }
                }
            }
            catch (Exception ex)
            {
                this.DebugMsg(ex.Message);
                this.DebugMsg(ex.Source);
            }

            this.tvTreeView.EndUpdate();
        }