diff --git a/PROMS/Baseline/frmBaseline.Designer.cs b/PROMS/Baseline/frmBaseline.Designer.cs index 949a6aed..dc32932b 100644 --- a/PROMS/Baseline/frmBaseline.Designer.cs +++ b/PROMS/Baseline/frmBaseline.Designer.cs @@ -89,7 +89,7 @@ this.panel1.Size = new System.Drawing.Size(707, 80); this.panel1.TabIndex = 0; // - // cbUseTruncatedData + // cbUseTruncatedData // C2026-041 // this.cbUseTruncatedData.AutoSize = true; this.cbUseTruncatedData.Location = new System.Drawing.Point(456, 56); @@ -99,6 +99,7 @@ this.cbUseTruncatedData.Text = "Use Truncated Data"; this.tt.SetToolTip(this.cbUseTruncatedData, "Set the Search to be Case Sensitive\r\nUppercase and Lowercase will not match"); this.cbUseTruncatedData.UseVisualStyleBackColor = true; + this.cbUseTruncatedData.Click += new System.EventHandler(this.cbUseTruncatedData_Click); // // btnUC // diff --git a/PROMS/Baseline/frmBaseline.cs b/PROMS/Baseline/frmBaseline.cs index 15cf0cd4..1cd4f18d 100644 --- a/PROMS/Baseline/frmBaseline.cs +++ b/PROMS/Baseline/frmBaseline.cs @@ -43,15 +43,16 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; using System.IO; -using System.Text.RegularExpressions; -using System.Xml.Serialization; -using System.Xml.Schema; -using System.Xml; +using System.Linq; using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using System.Xml; +using System.Xml.Schema; +using System.Xml.Serialization; namespace Baseline { @@ -67,12 +68,13 @@ namespace Baseline StartsWith, EndsWith, Regex - } + } public partial class frmBaseline : Form { - public IgnoreLines MyIgnore { get; set; } = new IgnoreLines(); - private LastWas myLast = LastWas.Search; + public IgnoreLines MyIgnore { get; set; } = new IgnoreLines(); + private LastWas myLast = LastWas.Search; private Settings MySettings; + public bool TruncatedDataFg { get; set; } = false; public string MyStatus { get { return tsslStatus.Text; } @@ -141,13 +143,13 @@ namespace Baseline this.Location = Properties.Settings.Default.Location; this.Size = Properties.Settings.Default.Size; this.WindowState = Properties.Settings.Default.WidnowState; - if(Properties.Settings.Default.Ignore != null && Properties.Settings.Default.Ignore != "") + if (Properties.Settings.Default.Ignore != null && Properties.Settings.Default.Ignore != "") MyIgnore = IgnoreLines.Get(Properties.Settings.Default.Ignore); - MySettings = new Settings - { - IgnoreLines = new BindingList() - }; - splitContainer1.SplitterDistance = Properties.Settings.Default.Split1; + MySettings = new Settings + { + IgnoreLines = new BindingList() + }; + splitContainer1.SplitterDistance = Properties.Settings.Default.Split1; splitContainer2.SplitterDistance = Properties.Settings.Default.Split2; splitContainer3.SplitterDistance = Properties.Settings.Default.Split3; if (Properties.Settings.Default.MRU1 != null && Properties.Settings.Default.MRU1.Count > 0) @@ -202,6 +204,13 @@ namespace Baseline MyIgnore = IgnoreLines.Get(saveOriginal); } } + private void cbUseTruncatedData_Click(object sender, EventArgs e) + { + System.Windows.Forms.CheckBox item = (System.Windows.Forms.CheckBox)sender; + TruncatedDataFg = item.Checked; + + } + //} /// /// Process DebugPagination.txt in all sub-folders /// @@ -218,7 +227,7 @@ namespace Baseline lbResults2.Items.Clear(); MyStatus = "Searching..."; // Perform DebugPagination Comparison - FindFiles fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugPagination.txt",MyIgnore); + FindFiles fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugPagination.txt",MyIgnore, cbUseTruncatedData.Checked); lbDifferent.DataSource = fnd; lbDifferent.DisplayMember = "File1"; MyStatus = string.Format("{0} Differences Found", fnd.Count); @@ -708,25 +717,9 @@ namespace Baseline lbResults1.Items.Clear(); lbResults2.Items.Clear(); MyStatus = "Searching..."; - FindFiles fnd; - // Perform code to find DebugMeta files with diffences - if (cbUseTruncatedData.Checked) - { - string filename; - if (File.Exists(cbFile1.Text + "\\VEPROMS_BGE\\DebugMeta_Truncate.txt")) - { - filename = "DebugMeta_Truncate.txt"; - } - else - { - filename = "DebugMeta.txt"; - } - fnd = new FindFiles(cbFile1.Text, cbFile2.Text, filename, MyIgnore); - } - else - { - fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugMeta.txt", MyIgnore); - } + + FindFiles fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugMeta.txt", MyIgnore, cbUseTruncatedData.Checked); + lbDifferent.DataSource = fnd; lbDifferent.DisplayMember = "File1"; MyStatus = string.Format("{0} Differences Found", fnd.Count); @@ -747,28 +740,10 @@ namespace Baseline lbDifferent.Items.Clear(); lbResults1.Items.Clear(); lbResults2.Items.Clear(); - FindFiles fnd; MyStatus = "Searching..."; //Perform Search - if (cbUseTruncatedData.Checked) - { - string filename; - if (File.Exists(cbFile1.Text + "\\VEPROMS_BGE\\DebugMeta_Truncate.txt")) - { - filename = "DebugMeta_Truncate.txt"; - } - else - { - filename = "DebugMeta.txt"; - } - fnd = new FindFiles(cbFile1.Text, cbFile2.Text, filename, tbSearch.Text, SearchType.Contains, cbCaseSensitive.Checked); - } - else - { - fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugMeta.txt", tbSearch.Text, SearchType.Contains, cbCaseSensitive.Checked); - } + FindFiles fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugMeta.txt", tbSearch.Text, SearchType.Contains, cbCaseSensitive.Checked, cbUseTruncatedData.Checked); lbDifferent.DataSource = fnd; - lbDifferent.DisplayMember = "File1"; MyStatus = string.Format("{0} Differences Found", fnd.Count); } @@ -874,20 +849,25 @@ namespace Baseline public partial class FindFiles : List { private readonly string _FileName; - public string FileName => _FileName; - /// - /// Build list of DocVersion Folders with differences - /// - /// Base path - /// Compare path - /// filename - /// Ignore list - public FindFiles(string path1, string path2, string fileName,IgnoreLines myIgnore) + private object _fileName; + + public string FileName => _FileName; + + //public bool TruncatedDataFg { get; set; } = false; + + /// + /// Build list of DocVersion Folders with differences + /// + /// Base path + /// Compare path + /// filename + /// Ignore list + public FindFiles(string path1, string path2, string fileName,IgnoreLines myIgnore, bool TruncatedDataFg) { DirectoryInfo di1 = new DirectoryInfo(path1); DirectoryInfo di2 = new DirectoryInfo(path2); _FileName = fileName; - FillByCompare(di1, di2, fileName, myIgnore); + FillByCompare(di1, di2, fileName, myIgnore, TruncatedDataFg, false); } /// /// Fill for a search @@ -898,12 +878,12 @@ namespace Baseline /// /// /// - public FindFiles(string path1, string path2, string fileName, string searchText, SearchType searchType, bool caseSensitive) + public FindFiles(string path1, string path2, string fileName, string searchText, SearchType searchType, bool caseSensitive, bool useTruncatedData) { DirectoryInfo di1 = new DirectoryInfo(path1); DirectoryInfo di2 = new DirectoryInfo(path2); _FileName = fileName; - FillByCompare(di1, di2, fileName,searchText,searchType, caseSensitive); + FillByCompare(di1, di2, fileName,searchText,searchType, caseSensitive, useTruncatedData); } /// /// Fill results by search @@ -914,13 +894,13 @@ namespace Baseline /// /// /// - private void FillByCompare(DirectoryInfo di1, DirectoryInfo di2, string fileName, string searchText, SearchType searchType, bool caseSensitive) + private void FillByCompare(DirectoryInfo di1, DirectoryInfo di2, string fileName, string searchText, SearchType searchType, bool caseSensitive, bool UseTruncatedData) { foreach (DirectoryInfo diChild1 in di1.GetDirectories()) { DirectoryInfo diChild2 = new DirectoryInfo(di2.FullName + "\\" + diChild1.Name); if (diChild2.Exists) - FillByCompare(diChild1, diChild2, fileName,searchText,searchType,caseSensitive); + FillByCompare(diChild1, diChild2, fileName,searchText,searchType,caseSensitive, UseTruncatedData); } foreach (FileInfo fiChild1 in di1.GetFiles(fileName)) { @@ -994,17 +974,25 @@ namespace Baseline } return false; } - private void FillByCompare(DirectoryInfo di1, DirectoryInfo di2, string fileName, IgnoreLines myIgnore) + private void FillByCompare(DirectoryInfo di1, DirectoryInfo di2, string fileName, IgnoreLines myIgnore, bool TruncatedDataFg = false, bool foundFileFg = false) { + if (TruncatedDataFg) // C2026-041 is the "Use Truncated Data" checked + { + if (!foundFileFg) // flag to indicate if the correct DebugMeta file has been found. + { + fileName = getDebubMetaFile(di1, di2, ref foundFileFg); // C2026-041 Check if the DebugMeta_Truncate.txt file is found in the baseline bench mark and the new release being tested. + } + } + foreach (DirectoryInfo diChild1 in di1.GetDirectories()) { - DirectoryInfo diChild2 = new DirectoryInfo(di2.FullName + "\\" + diChild1.Name); + DirectoryInfo diChild2 = new DirectoryInfo(Path.Combine(di2.FullName + "\\" + diChild1.Name)); if (diChild2.Exists) - FillByCompare(diChild1, diChild2, fileName,myIgnore);// Recursively work on Sub-Folders + FillByCompare(diChild1, diChild2, fileName,myIgnore, TruncatedDataFg, foundFileFg);// Recursively work on Sub-Folders } foreach (FileInfo fiChild1 in di1.GetFiles(fileName)) { - FileInfo fiChild2 = new FileInfo(di2.FullName + "\\" + fiChild1.Name); + FileInfo fiChild2 = new FileInfo(Path.Combine(di2.FullName, fiChild1.Name)); if (fiChild2.Exists) { if (CompareFile(fiChild1, fiChild2,myIgnore)) @@ -1012,6 +1000,29 @@ namespace Baseline } } } + private string getDebubMetaFile(DirectoryInfo di1, DirectoryInfo di2, ref bool foundFileFg) // C2026-041 + { + string flnm = ""; + DirectoryInfo dr1 = di1.GetDirectories()[0]; // get first folder for test of which DebugMeta file to use. The DebugMeta files are found only ineach proc set folder. + if (!dr1.Name.Substring(0, 8).Contains("VEPROMS_") && !foundFileFg) + { + if (File.Exists(Path.Combine(dr1.FullName, "DebugMeta_Truncated.txt")) && File.Exists(Path.Combine(di2.FullName, dr1.Name, "DebugMeta_Truncated.txt"))) // if DebugMeta_Truncate.txt file is found. + { + flnm = "DebugMeta_Truncated.txt"; + foundFileFg = true; + } + else + { + flnm = "DebugMeta.txt"; + foundFileFg = true; + } + } + else + { + flnm = "DebugMeta.txt"; + } + return flnm; + } private bool CompareFile(FileInfo fiChild1, FileInfo fiChild2,IgnoreLines myIgnore) { if (fiChild1.Name == "DebugMeta.txt") diff --git a/PROMS/Volian.Base.Library/DebugPrint.cs b/PROMS/Volian.Base.Library/DebugPrint.cs index b0bdc91a..5c7297d9 100644 --- a/PROMS/Volian.Base.Library/DebugPrint.cs +++ b/PROMS/Volian.Base.Library/DebugPrint.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Text; -using System.Windows.Forms; namespace Volian.Base.Library { @@ -161,54 +160,24 @@ namespace Volian.Base.Library } public static void Write(string format, params object[] args) { - if (args.GetUpperBound(0) != -1) // are there arguments? - { - if (args[args.GetUpperBound(0)] == "truncate_false") // if there is a 9th element test the value for truncated data. - { - _MyDebugPrint.Write(format, args); // only save to DebugMeta.txt if there is different truncate data. - } - else - { - _MyDebugPrint_Truncated.Write(format, args); // Save to both files if there is no special truncate data. - _MyDebugPrint.Write(format, args); - } - } - else - { - _MyDebugPrint_Truncated.Write(format, args); _MyDebugPrint.Write(format, args); - } } + public static void WriteLine(string format, params object[] args) { - if (args.GetUpperBound(0) != -1) // are there arguments? - { - if (args[args.GetUpperBound(0)] == "truncate_false") // if there is a 9th element test the value for truncated data. - { - _MyDebugPrint.WriteLine(format, args); // only save to DebugMeta.txt if there is different truncate data. - } - else - { - _MyDebugPrint_Truncated.WriteLine(format, args); // Save to both files if there is no special truncate data. - _MyDebugPrint.WriteLine(format, args); - } - } - else - { _MyDebugPrint_Truncated.WriteLine(format, args); _MyDebugPrint.WriteLine(format, args); - } } - public static void TruncateWriteLine(string format, params object[] args) + public static void WriteLineTruncate(string format, params object[] args) { _MyDebugPrint_Truncated.WriteLine(format, args); } - public static void TruncateWrite(string format, params object[] args) + public static void WriteLineLegacy(string format, params object[] args) { - _MyDebugPrint_Truncated.Write(format, args); // SaveFileDialog special truncate data + _MyDebugPrint.WriteLine(format, args); } - public static void Show() + public static void Show() { _MyDebugPrint.Show(); _MyDebugPrint_Truncated.Show(); } diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 1e3ee32e..791f8b81 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -1419,9 +1419,9 @@ namespace Volian.Print.Library if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin; // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("WD Height={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6} ScPgNum {7}", fgPage.Height, fgPage.Width, sectPageCount, locEndOfWordDoc, pdfSize, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff, pageNumber, "truncate_false"); + Volian.Base.Library.BaselineMetaFile.WriteLineLegacy("WD Height={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6} ScPgNum {7}", fgPage.Height, fgPage.Width, sectPageCount, locEndOfWordDoc, pdfSize, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff, pageNumber, "truncate_false"); - Volian.Base.Library.BaselineMetaFile.TruncateWriteLine("WD Height={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6} ScPgNum {7}", fgPage.Height, fgPage.Width, sectPageCount, Truncate(locEndOfWordDoc, 2), Truncate(pdfSize, 2), (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff, pageNumber); + Volian.Base.Library.BaselineMetaFile.WriteLineTruncate("WD Height={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6} ScPgNum {7}", fgPage.Height, fgPage.Width, sectPageCount, Truncate(locEndOfWordDoc, 2), Truncate(pdfSize, 2), (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff, pageNumber); AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0) + yoff); // B2019-102 Handle PDF Destinations for Word Sections