Exemplo n.º 1
0
        private void UpdateCountersList(ref PageFragment pf)
        {
            MainForm.UpdateSemaphoresStatus(semaphore.CurrentCount);
            MainForm.UpdateVisitedPagesStatus(visitedPages, pagesTovisit);

            foreach (var title in pf.Titles)
            {
                if (title.TitleLength > TitleCharMax || title.TitleLength < TitleCharMin)
                {
                    MainForm.IncreaseTitleCharProblemsCounter();
                }
                if (title.TitlePixelWidth > TitlePixMax || title.TitlePixelWidth < TitlePixMin)
                {
                    MainForm.IncreaseTitlePixelProblemsCounter();
                }
            }
            foreach (var desc in pf.MetaDescriptions)
            {
                if (desc.MetaDescriptionLength > TitleCharMax || desc.MetaDescriptionLength < TitleCharMin)
                {
                    MainForm.IncreaseDescCharProblemsCounter();
                }
                if (desc.MetaDescriptionPixelWidth > TitlePixMax || desc.MetaDescriptionPixelWidth < TitlePixMin)
                {
                    MainForm.IncreaseDescPixelProblemsCounter();
                }
            }

            if (pf.Address.Length > UrlCharMax)
            {
                MainForm.IncreaseUrlProblemsCounter();
            }

            foreach (var heading in pf.HeadingsOne)
            {
                if (heading.HeadingOneLength > H1CharMax)
                {
                    MainForm.IncreaseHeadOneProblemsCounter();
                }
            }

            foreach (var heading in pf.HeadingsTwo)
            {
                if (heading.HeadingTwoLength > H2CharMax)
                {
                    MainForm.IncreaseHeadTwoProblemsCounter();
                }
            }

            if (pf.Size > ImgSizeMax && pf.ContentType.Contains("image"))
            {
                MainForm.IncreaseImgProblemsCounter(); Debug.WriteLine("Imageee: " + pf.Address);
            }
            visitedPages++;
        }