/**************************************************************************/ private void BuildWorksheetPageDuplicateTitles( MacroscopeJobMaster JobMaster, XLWorkbook wb, string WorksheetLabel ) { var ws = wb.Worksheets.Add(WorksheetLabel); int iRow = 1; int iCol = 1; int iColMax = 1; decimal Count = 0; decimal DocCount = 0; MacroscopeDocumentCollection DocCollection = JobMaster.GetDocCollection(); MacroscopeAllowedHosts AllowedHosts = JobMaster.GetAllowedHosts(); DocCount = ( decimal )DocCollection.CountDocuments(); { ws.Cell(iRow, iCol).Value = "URL"; iCol++; ws.Cell(iRow, iCol).Value = "Occurrences"; iCol++; ws.Cell(iRow, iCol).Value = "Title"; } iColMax = iCol; iRow++; foreach (MacroscopeDocument msDoc in DocCollection.IterateDocuments()) { bool Proceed = false; if (DocCount > 0) { Count++; this.ProgressForm.UpdatePercentages( Title: null, Message: null, MajorPercentage: -1, ProgressLabelMajor: string.Format("Documents Processed: {0}", Count), MinorPercentage: (( decimal )100 / DocCount) * Count, ProgressLabelMinor: msDoc.GetUrl(), SubMinorPercentage: -1, ProgressLabelSubMinor: null ); } if (AllowedHosts.IsInternalUrl(Url: msDoc.GetUrl())) { switch (msDoc.GetDocumentType()) { case MacroscopeConstants.DocumentType.HTML: Proceed = true; break; case MacroscopeConstants.DocumentType.PDF: Proceed = true; break; default: Proceed = false; break; } } if (Proceed) { string Title = msDoc.GetTitle(); int Occurrences = DocCollection.GetStatsTitleCount(msDoc: msDoc); if (Occurrences > 1) { iCol = 1; this.InsertAndFormatUrlCell(ws, iRow, iCol, msDoc); if (msDoc.GetIsInternal()) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Green); } else { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Gray); } iCol++; this.InsertAndFormatContentCell(ws, iRow, iCol, Occurrences); if (Occurrences > 1) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Orange); } else { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Green); } iCol++; this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(Title)); iRow++; } } } { var rangeData = ws.Range(1, 1, iRow - 1, iColMax); var excelTable = rangeData.CreateTable(); } }
/**************************************************************************/ private void BuildWorksheetPageDuplicateTitles( MacroscopeJobMaster JobMaster, CsvWriter ws ) { decimal Count = 0; decimal DocCount = 0; MacroscopeDocumentCollection DocCollection = JobMaster.GetDocCollection(); MacroscopeAllowedHosts AllowedHosts = JobMaster.GetAllowedHosts(); DocCount = ( decimal )DocCollection.CountDocuments(); { ws.WriteField("URL"); ws.WriteField("Occurrences"); ws.WriteField("Title"); ws.NextRecord(); } foreach (MacroscopeDocument msDoc in DocCollection.IterateDocuments()) { bool Proceed = false; if (DocCount > 0) { Count++; this.ProgressForm.UpdatePercentages( Title: null, Message: null, MajorPercentage: -1, ProgressLabelMajor: string.Format("Documents Processed: {0}", Count), MinorPercentage: (( decimal )100 / DocCount) * Count, ProgressLabelMinor: msDoc.GetUrl(), SubMinorPercentage: -1, ProgressLabelSubMinor: null ); } if (AllowedHosts.IsInternalUrl(Url: msDoc.GetUrl())) { switch (msDoc.GetDocumentType()) { case MacroscopeConstants.DocumentType.HTML: Proceed = true; break; case MacroscopeConstants.DocumentType.PDF: Proceed = true; break; default: Proceed = false; break; } } if (Proceed) { string Title = msDoc.GetTitle(); int Occurrences = DocCollection.GetStatsTitleCount(msDoc: msDoc); if (Occurrences > 1) { this.InsertAndFormatUrlCell(ws, msDoc); this.InsertAndFormatContentCell(ws, Occurrences); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(Title)); ws.NextRecord(); } } } }
/**************************************************************************/ private void BuildWorksheetPageTitles( MacroscopeJobMaster JobMaster, XLWorkbook wb, string WorksheetLabel ) { var ws = wb.Worksheets.Add(WorksheetLabel); int iRow = 1; int iCol = 1; int iColMax = 1; MacroscopeDocumentCollection DocCollection = JobMaster.GetDocCollection(); { ws.Cell(iRow, iCol).Value = "URL"; iCol++; ws.Cell(iRow, iCol).Value = "Page Language"; iCol++; ws.Cell(iRow, iCol).Value = "Detected Language"; iCol++; ws.Cell(iRow, iCol).Value = "Occurrences"; iCol++; ws.Cell(iRow, iCol).Value = "Title"; iCol++; ws.Cell(iRow, iCol).Value = "Title Length"; iCol++; ws.Cell(iRow, iCol).Value = "Pixel Width"; } iColMax = iCol; iRow++; foreach (MacroscopeDocument msDoc in DocCollection.IterateDocuments()) { bool Proceed = false; if (msDoc.GetIsExternal()) { continue; } if (msDoc.GetIsRedirect()) { continue; } switch (msDoc.GetDocumentType()) { case MacroscopeConstants.DocumentType.HTML: Proceed = true; break; case MacroscopeConstants.DocumentType.PDF: Proceed = true; break; default: break; } if (Proceed) { iCol = 1; string PageLanguage = msDoc.GetIsoLanguageCode(); string DetectedLanguage = msDoc.GetTitleLanguage(); string Title = msDoc.GetTitle(); int Occurrences = 0; int TitleLength = msDoc.GetTitleLength(); int TitlePixelWidth = msDoc.GetTitlePixelWidth(); if (TitleLength > 0) { Occurrences = DocCollection.GetStatsTitleCount(msDoc: msDoc); } this.InsertAndFormatUrlCell(ws, iRow, iCol, msDoc); if (msDoc.GetIsInternal()) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Green); } else { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Gray); } iCol++; switch (msDoc.GetDocumentType()) { case MacroscopeConstants.DocumentType.HTML: this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(PageLanguage)); break; case MacroscopeConstants.DocumentType.PDF: this.InsertAndFormatContentCell(ws, iRow, iCol, PageLanguage); break; default: break; } if (PageLanguage != DetectedLanguage) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Red); } else { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Green); } iCol++; this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(DetectedLanguage)); if (PageLanguage != DetectedLanguage) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Red); } else { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Green); } iCol++; this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(Occurrences.ToString())); if (Occurrences > 1) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Orange); } else { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Green); } iCol++; this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(Title)); if (TitleLength <= 0) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Red); ws.Cell(iRow, iCol).Value = "MISSING"; } else { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Green); } iCol++; this.InsertAndFormatContentCell(ws, iRow, iCol, TitleLength); if (TitleLength < MacroscopePreferencesManager.GetTitleMinLen()) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Red); } else if (TitleLength > MacroscopePreferencesManager.GetTitleMaxLen()) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Red); } else { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Green); } iCol++; this.InsertAndFormatContentCell(ws, iRow, iCol, TitlePixelWidth); if (TitlePixelWidth > MacroscopePreferencesManager.GetTitleMaxPixelWidth()) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Red); } else if (TitlePixelWidth >= (MacroscopePreferencesManager.GetTitleMaxPixelWidth() - 20)) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Red); } else if (TitlePixelWidth <= 0) { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Orange); } else { ws.Cell(iRow, iCol).Style.Font.SetFontColor(XLColor.Green); } iRow++; } } { var rangeData = ws.Range(1, 1, iRow - 1, iColMax); var excelTable = rangeData.CreateTable(); } }
/**************************************************************************/ protected override void RenderListView( List <ListViewItem> ListViewItems, MacroscopeDocumentCollection DocCollection, MacroscopeDocument msDoc, string Url ) { bool Proceed = false; if (msDoc.GetIsExternal()) { return; } if (msDoc.GetIsRedirect()) { return; } switch (msDoc.GetDocumentType()) { case MacroscopeConstants.DocumentType.HTML: Proceed = true; break; case MacroscopeConstants.DocumentType.PDF: Proceed = true; break; default: break; } if (Proceed) { string PageLanguage = msDoc.GetIsoLanguageCode(); string DetectedLanguage = msDoc.GetTitleLanguage(); string Text = msDoc.GetTitle(); string TextLabel = Text; int TextOccurences = 0; int TextLength = Text.Length; int TextPixelWidth = msDoc.GetTitlePixelWidth(); string PairKey = string.Join(":", UrlToDigest(Url), UrlToDigest(Text)); ListViewItem lvItem = null; if (string.IsNullOrEmpty(PageLanguage)) { PageLanguage = ""; } if (string.IsNullOrEmpty(DetectedLanguage)) { DetectedLanguage = ""; } if (TextLength > 0) { TextOccurences = DocCollection.GetStatsTitleCount(msDoc: msDoc); } else { TextLabel = "MISSING"; } if (this.DisplayListView.Items.ContainsKey(PairKey)) { try { lvItem = this.DisplayListView.Items[PairKey]; lvItem.SubItems[COL_URL].Text = Url; lvItem.SubItems[COL_PAGE_LANGUAGE].Text = PageLanguage; lvItem.SubItems[COL_DETECTED_LANGUAGE].Text = DetectedLanguage; lvItem.SubItems[COL_OCCURENCES].Text = TextOccurences.ToString(); lvItem.SubItems[COL_TITLE_TEXT].Text = TextLabel; lvItem.SubItems[COL_LENGTH].Text = TextLength.ToString(); lvItem.SubItems[COL_PIXEL_WIDTH].Text = TextPixelWidth.ToString(); } catch (Exception ex) { DebugMsg(string.Format("MacroscopeDisplayTitles 1: {0}", ex.Message)); } } else { try { lvItem = new ListViewItem(PairKey); lvItem.UseItemStyleForSubItems = false; lvItem.Name = PairKey; lvItem.SubItems[COL_URL].Text = Url; lvItem.SubItems.Add(PageLanguage); lvItem.SubItems.Add(DetectedLanguage); lvItem.SubItems.Add(TextOccurences.ToString()); lvItem.SubItems.Add(TextLabel); lvItem.SubItems.Add(TextLength.ToString()); lvItem.SubItems.Add(TextPixelWidth.ToString()); ListViewItems.Add(lvItem); } catch (Exception ex) { DebugMsg(string.Format("MacroscopeDisplayTitles 2: {0}", ex.Message)); } } if (lvItem != null) { lvItem.ForeColor = Color.Blue; // URL -------------------------------------------------------------// if (msDoc.GetIsInternal()) { lvItem.SubItems[COL_URL].ForeColor = Color.Green; } else { lvItem.SubItems[COL_URL].ForeColor = Color.Gray; } // Title Language --------------------------------------------------// if (msDoc.GetIsInternal()) { lvItem.SubItems[COL_PAGE_LANGUAGE].ForeColor = Color.Green; lvItem.SubItems[COL_DETECTED_LANGUAGE].ForeColor = Color.Green; if (DetectedLanguage != PageLanguage) { lvItem.SubItems[COL_PAGE_LANGUAGE].ForeColor = Color.Red; lvItem.SubItems[COL_DETECTED_LANGUAGE].ForeColor = Color.Red; } } else { lvItem.SubItems[COL_PAGE_LANGUAGE].ForeColor = Color.Gray; lvItem.SubItems[COL_DETECTED_LANGUAGE].ForeColor = Color.Gray; } // Check Missing Title ---------------------------------------------// if (TextLength <= 0) { lvItem.SubItems[COL_TITLE_TEXT].Text = "MISSING"; lvItem.SubItems[COL_TITLE_TEXT].ForeColor = Color.Red; } else if (TextLength < MacroscopePreferencesManager.GetTitleMinLen()) { lvItem.SubItems[COL_TITLE_TEXT].ForeColor = Color.Red; } else if (TextLength > MacroscopePreferencesManager.GetTitleMaxLen()) { lvItem.SubItems[COL_TITLE_TEXT].ForeColor = Color.Red; } else { lvItem.SubItems[COL_TITLE_TEXT].ForeColor = Color.Green; } // Check Title Length ----------------------------------------------// if (TextLength < MacroscopePreferencesManager.GetTitleMinLen()) { lvItem.SubItems[COL_LENGTH].ForeColor = Color.Red; } else if (TextLength > MacroscopePreferencesManager.GetTitleMaxLen()) { lvItem.SubItems[COL_LENGTH].ForeColor = Color.Red; } else { lvItem.SubItems[COL_LENGTH].ForeColor = Color.Green; } // Check Pixel Width -----------------------------------------------// if (TextPixelWidth > MacroscopePreferencesManager.GetTitleMaxPixelWidth()) { lvItem.SubItems[COL_PIXEL_WIDTH].ForeColor = Color.Red; } else if (TextPixelWidth >= (MacroscopePreferencesManager.GetTitleMaxPixelWidth() - 20)) { lvItem.SubItems[COL_PIXEL_WIDTH].ForeColor = Color.Goldenrod; } else if (TextPixelWidth <= 0) { lvItem.SubItems[COL_PIXEL_WIDTH].ForeColor = Color.Orange; } else { lvItem.SubItems[COL_PIXEL_WIDTH].ForeColor = Color.Green; } } } }
/**************************************************************************/ private void BuildWorksheetPageDuplicateTitles( MacroscopeJobMaster JobMaster, CsvWriter ws ) { decimal Count = 0; decimal DocCount = 0; MacroscopeDocumentCollection DocCollection = JobMaster.GetDocCollection(); MacroscopeAllowedHosts AllowedHosts = JobMaster.GetAllowedHosts(); DocCount = ( decimal )DocCollection.CountDocuments(); { ws.WriteField("URL"); ws.WriteField("Occurrences"); ws.WriteField("Title"); ws.NextRecord(); } foreach (string Url in DocCollection.DocumentKeys()) { MacroscopeDocument msDoc = DocCollection.GetDocument(Url); Boolean Proceed = false; if (DocCount > 0) { Count++; this.ProgressForm.UpdatePercentages( Title: null, Message: null, MajorPercentage: -1, ProgressLabelMajor: string.Format("Documents Processed: {0}", Count), MinorPercentage: (( decimal )100 / DocCount) * Count, ProgressLabelMinor: Url, SubMinorPercentage: -1, ProgressLabelSubMinor: null ); } if (AllowedHosts.IsInternalUrl(Url: Url)) { if (msDoc.GetIsHtml()) { Proceed = true; } else if (msDoc.GetIsPdf()) { Proceed = true; } else { Proceed = false; } } if (Proceed) { string Title = msDoc.GetTitle(); int Occurrences = DocCollection.GetStatsTitleCount(msDoc: msDoc); if (Occurrences > 1) { this.InsertAndFormatUrlCell(ws, msDoc); this.InsertAndFormatContentCell(ws, Occurrences); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(Title)); ws.NextRecord(); } } } }
/**************************************************************************/ private void BuildWorksheetPageTitles( MacroscopeJobMaster JobMaster, CsvWriter ws ) { MacroscopeDocumentCollection DocCollection = JobMaster.GetDocCollection(); { ws.WriteField("URL"); ws.WriteField("Page Language"); ws.WriteField("Detected Language"); ws.WriteField("Occurrences"); ws.WriteField("Title"); ws.WriteField("Title Length"); ws.WriteField("Pixel Width"); ws.NextRecord(); } foreach (string Url in DocCollection.DocumentKeys()) { MacroscopeDocument msDoc = DocCollection.GetDocument(Url); Boolean Proceed = false; if (msDoc.GetIsExternal()) { continue; } if (msDoc.GetIsRedirect()) { continue; } if (msDoc.GetIsHtml()) { Proceed = true; } else if (msDoc.GetIsPdf()) { Proceed = true; } if (Proceed) { string Title = msDoc.GetTitle(); string PageLanguage = msDoc.GetIsoLanguageCode(); string DetectedLanguage = msDoc.GetTitleLanguage(); int Occurrences = 0; int TitleLength = msDoc.GetTitleLength(); int TitlePixelWidth = msDoc.GetTitlePixelWidth(); if (TitleLength > 0) { Occurrences = DocCollection.GetStatsTitleCount(msDoc: msDoc); } this.InsertAndFormatUrlCell(ws, msDoc); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(PageLanguage)); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(DetectedLanguage)); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(Occurrences.ToString())); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(Title)); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(TitleLength.ToString())); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(TitlePixelWidth.ToString())); ws.NextRecord(); } } }
/**************************************************************************/ private void BuildWorksheetPageTitles( MacroscopeJobMaster JobMaster, CsvWriter ws ) { MacroscopeDocumentCollection DocCollection = JobMaster.GetDocCollection(); { ws.WriteField("URL"); ws.WriteField("Page Language"); ws.WriteField("Detected Language"); ws.WriteField("Occurrences"); ws.WriteField("Title"); ws.WriteField("Title Length"); ws.WriteField("Pixel Width"); ws.NextRecord(); } foreach (MacroscopeDocument msDoc in DocCollection.IterateDocuments()) { bool Proceed = false; if (msDoc.GetIsExternal()) { continue; } if (msDoc.GetIsRedirect()) { continue; } switch (msDoc.GetDocumentType()) { case MacroscopeConstants.DocumentType.HTML: Proceed = true; break; case MacroscopeConstants.DocumentType.PDF: Proceed = true; break; default: break; } if (Proceed) { string Title = msDoc.GetTitle(); string PageLanguage = msDoc.GetIsoLanguageCode(); string DetectedLanguage = msDoc.GetTitleLanguage(); int Occurrences = 0; int TitleLength = msDoc.GetTitleLength(); int TitlePixelWidth = msDoc.GetTitlePixelWidth(); if (TitleLength > 0) { Occurrences = DocCollection.GetStatsTitleCount(msDoc: msDoc); } this.InsertAndFormatUrlCell(ws, msDoc); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(PageLanguage)); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(DetectedLanguage)); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(Occurrences.ToString())); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(Title)); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(TitleLength.ToString())); this.InsertAndFormatContentCell(ws, this.FormatIfMissing(TitlePixelWidth.ToString())); ws.NextRecord(); } } }
/**************************************************************************/ protected override void RenderListView( List <ListViewItem> ListViewItems, MacroscopeDocument msDoc, string Url ) { Boolean Proceed = false; if (msDoc.GetIsExternal()) { return; } if (msDoc.GetIsRedirect()) { return; } if (msDoc.GetIsHtml()) { Proceed = true; } else if (msDoc.GetIsPdf()) { Proceed = true; } if (Proceed) { MacroscopeDocumentCollection DocCollection = this.MainForm.GetJobMaster().GetDocCollection(); string PageLanguage = msDoc.GetIsoLanguageCode(); string DetectedLanguage = msDoc.GetTitleLanguage(); string Text = msDoc.GetTitle(); string TextLabel = Text; int TextOccurences = 0; int TextLength = Text.Length; int TextPixelWidth = msDoc.GetTitlePixelWidth(); string PairKey = string.Join("", Url, Text); ListViewItem lvItem = null; if (string.IsNullOrEmpty(PageLanguage)) { PageLanguage = ""; } if (string.IsNullOrEmpty(DetectedLanguage)) { DetectedLanguage = ""; } if (TextLength > 0) { TextOccurences = DocCollection.GetStatsTitleCount(msDoc: msDoc); } else { TextLabel = "MISSING"; } if (this.DisplayListView.Items.ContainsKey(PairKey)) { try { lvItem = this.DisplayListView.Items[PairKey]; lvItem.SubItems[ColUrl].Text = Url; lvItem.SubItems[ColPageLanguage].Text = PageLanguage; lvItem.SubItems[ColDetectedLanguage].Text = DetectedLanguage; lvItem.SubItems[ColOccurences].Text = TextOccurences.ToString(); lvItem.SubItems[ColTitleText].Text = TextLabel; lvItem.SubItems[ColLength].Text = TextLength.ToString(); lvItem.SubItems[ColPixelWidth].Text = TextPixelWidth.ToString(); } catch (Exception ex) { DebugMsg(string.Format("MacroscopeDisplayTitles 1: {0}", ex.Message)); } } else { try { lvItem = new ListViewItem(PairKey); lvItem.UseItemStyleForSubItems = false; lvItem.Name = PairKey; lvItem.SubItems[ColUrl].Text = Url; lvItem.SubItems.Add(PageLanguage); lvItem.SubItems.Add(DetectedLanguage); lvItem.SubItems.Add(TextOccurences.ToString()); lvItem.SubItems.Add(TextLabel); lvItem.SubItems.Add(TextLength.ToString()); lvItem.SubItems.Add(TextPixelWidth.ToString()); ListViewItems.Add(lvItem); } catch (Exception ex) { DebugMsg(string.Format("MacroscopeDisplayTitles 2: {0}", ex.Message)); } } if (lvItem != null) { lvItem.ForeColor = Color.Blue; // URL -------------------------------------------------------------// if (msDoc.GetIsInternal()) { lvItem.SubItems[ColUrl].ForeColor = Color.Green; } else { lvItem.SubItems[ColUrl].ForeColor = Color.Gray; } // Title Language --------------------------------------------------// if (msDoc.GetIsInternal()) { lvItem.SubItems[ColPageLanguage].ForeColor = Color.Green; lvItem.SubItems[ColDetectedLanguage].ForeColor = Color.Green; if (DetectedLanguage != PageLanguage) { lvItem.SubItems[ColPageLanguage].ForeColor = Color.Red; lvItem.SubItems[ColDetectedLanguage].ForeColor = Color.Red; } } else { lvItem.SubItems[ColPageLanguage].ForeColor = Color.Gray; lvItem.SubItems[ColDetectedLanguage].ForeColor = Color.Gray; } // Check Missing Title ---------------------------------------------// if (TextLength <= 0) { lvItem.SubItems[ColTitleText].Text = "MISSING"; lvItem.SubItems[ColTitleText].ForeColor = Color.Red; } else if (TextLength < MacroscopePreferencesManager.GetTitleMinLen()) { lvItem.SubItems[ColTitleText].ForeColor = Color.Red; } else if (TextLength > MacroscopePreferencesManager.GetTitleMaxLen()) { lvItem.SubItems[ColTitleText].ForeColor = Color.Red; } else { lvItem.SubItems[ColTitleText].ForeColor = Color.Green; } // Check Title Length ----------------------------------------------// if (TextLength < MacroscopePreferencesManager.GetTitleMinLen()) { lvItem.SubItems[ColLength].ForeColor = Color.Red; } else if (TextLength > MacroscopePreferencesManager.GetTitleMaxLen()) { lvItem.SubItems[ColLength].ForeColor = Color.Red; } else { lvItem.SubItems[ColLength].ForeColor = Color.Green; } // Check Pixel Width -----------------------------------------------// if (TextPixelWidth > MacroscopePreferencesManager.GetTitleMaxPixelWidth()) { lvItem.SubItems[ColPixelWidth].ForeColor = Color.Red; } else if (TextPixelWidth >= (MacroscopePreferencesManager.GetTitleMaxPixelWidth() - 20)) { lvItem.SubItems[ColPixelWidth].ForeColor = Color.Goldenrod; } else if (TextPixelWidth <= 0) { lvItem.SubItems[ColPixelWidth].ForeColor = Color.Orange; } else { lvItem.SubItems[ColPixelWidth].ForeColor = Color.Green; } } } }