VEPROMS_UI / remove BouncyCastle

This commit is contained in:
2026-08-21 06:11:06 -04:00
parent 23a296df86
commit 0c3e4bb3e9
41 changed files with 2298 additions and 4704 deletions
+54 -152
View File
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Volian.Print.Library;
using VEPROMS.CSLA.Library;
@@ -14,90 +11,24 @@ namespace VEPROMS
{
public partial class frmPDFStatusForm : Form
{
private bool _CancelPrinting = false;
public bool CancelPrinting
{
get { return _CancelPrinting; }
set { _CancelPrinting = value; }
}
private bool _CloseWhenDone = false;
public bool CloseWhenDone
{
get { return _CloseWhenDone; }
set { _CloseWhenDone = value; }
}
private bool _CancelStop = false;
public bool CancelStop
{
get { return _CancelStop; }
set { _CancelStop = value; }
}
private bool _Stop = false;
public bool Stop
{
get { return _Stop; }
set { _Stop = value; }
}
private string _PDFPath;
public bool CancelPrinting { get; set; } = false;
public bool CloseWhenDone { get; set; } = false;
public bool CancelStop { get; set; } = false;
public bool Stop { get; set; } = false;
public string PDFPath
{
get { return _PDFPath; }
set { _PDFPath = value; }
}
private PromsPrinter _MyPromsPrinter;
public string PDFPath { get; set; }
public PromsPrinter MyPromsPrinter
{
get { return _MyPromsPrinter; }
set { _MyPromsPrinter = value; }
}
public PromsPrinter MyPromsPrinter { get; set; }
private bool _OpenPDF;
public bool OpenPDF { get; set; }
private Point _NewLocation;
public bool OpenPDF
{
get { return _OpenPDF; }
set { _OpenPDF = value; }
}
private Point _NewLocation;
private string _Prefix = ""; // RHM20150506 Multiline ItemID TextBox
public string Prefix
{
get { return _Prefix; }
set { _Prefix = value; }
}
// this flag is used when the Continuous Action Sumamry is printed from the tree or ribbon button
// it will prevent the temporary PDF (generated with printing - needed to get page numbers) from being displayed
// and will delete that temporary PDF file
private bool _OnlyShowContinuousActionSummary = false;
public bool OnlyShowContinuousActionSummary
{
get { return _OnlyShowContinuousActionSummary; }
set { _OnlyShowContinuousActionSummary = value; }
}
// F2022-024 this flag is used when the Time Critical Action Sumamry is printed from the tree or ribbon button
// it will prevent the temporary PDF (generated with printing - needed to get page numbers) from being displayed
// and will delete that temporary PDF file
private bool _OnlyShowTimeCriticalActionSummary = false;
public bool OnlyShowTimeCriticalActionSummary
{
get { return _OnlyShowTimeCriticalActionSummary; }
set { _OnlyShowTimeCriticalActionSummary = value; }
}
private bool _DidAll = false;
public bool DidAll
{
get { return _DidAll; }
set { _DidAll = value; }
}
private int _prtSectID = -1;
public int PrtSectID
{
get { return _prtSectID; }
set { _prtSectID = value; }
}
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf, string watermarkColor, int PrtSectID = -1)
public string Prefix { get; set; } = "";
public bool OnlyShowContinuousActionSummary { get; set; } = false;
public bool OnlyShowTimeCriticalActionSummary { get; set; } = false;
public bool DidAll { get; set; } = false;
public int PrtSectID { get; set; } = -1;
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf, string watermarkColor, int PrtSectID = -1)
{
// B2021-088 moved this if/else from CreatePDF() so that the Approval logic will have access to this logic
ProcedureInfo MyProcedure = myItem as ProcedureInfo;
@@ -114,28 +45,29 @@ namespace VEPROMS
// B2021-102 moved the baseline meta file write here too - should have been done with B2021-088 fix
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine($"!! {MyProcedure.SearchDVPath.Replace("\a", " | ")}");
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine($"!! {MyProcedure.DisplayNumber} | {MyProcedure.DisplayText}");
myItem = MyProcedure;
Prefix = prefix;
OpenPDF = openPDF;
DidAll = didAll;
_prtSectID = PrtSectID;
this.PrtSectID = PrtSectID;
InitializeComponent();
// if the version number of PROMS is 1.0, then we are running a Demo version.
// When running a Demo version, force a "Sample" watermark when printing.
// B2020-022 append a ".pdf" extension if the file name does on have one.
MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\Compare", false, overWrite, cbd, (pdfFile.ToUpper().EndsWith(".PDF"))?pdfFile:pdfFile+".pdf", insertBlankPages, allOrAuto,Prefix,saveLinks,removeTrailingHardReturnsAndManualPageBreaks, blankPageText, DidAll, mergedPdf, watermarkColor);
MyPromsPrinter.PromsVersion = (showPROMSVer) ? AboutVEPROMS.PROMSVersion : ""; //C2018-009 print PROMS version
PDFPath = pdfPath;
this.Text = "Creating PDF of " + myItem.DisplayNumber;
// if the version number of PROMS is 1.0, then we are running a Demo version.
// When running a Demo version, force a "Sample" watermark when printing.
// B2020-022 append a ".pdf" extension if the file name does on have one.
MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\Compare", false, overWrite, cbd, (pdfFile.ToUpper().EndsWith(".PDF")) ? pdfFile : $"{pdfFile}.pdf", insertBlankPages, allOrAuto, Prefix, saveLinks, removeTrailingHardReturnsAndManualPageBreaks, blankPageText, DidAll, mergedPdf, watermarkColor)
{
PromsVersion = (showPROMSVer) ? AboutVEPROMS.PROMSVersion : "" //C2018-009 print PROMS version
};
PDFPath = pdfPath;
Text = $"Creating PDF of {myItem.DisplayNumber}";
_NewLocation = newLocation;
DialogResult = DialogResult.OK;
@@ -162,24 +94,18 @@ namespace VEPROMS
if (waterMarkText.ToUpper() == "[U-TEXT]")
{
string utxt = (procInfo.MyDocVersion.MultiUnitCount > 1) ? procInfo.MyDocVersion.DocVersionConfig.Unit_Text : "";
waterMarkText = (utxt == null) ? "" : utxt;
waterMarkText = utxt ?? "";
}
else if (waterMarkText.ToUpper() == "[U-NUMBER]")
{
string uNum = (procInfo.MyDocVersion.MultiUnitCount > 1) ? procInfo.MyDocVersion.DocVersionConfig.Unit_Number : "";
waterMarkText = (uNum == null) ? "" : uNum;
waterMarkText = uNum ?? "";
}
}
}
// used when the approved function creates an export file with unlinked ROs and Transitons. Word sections that have RO tokens are saved with the RO Vaules in DocReplace
// DocReplace is passed on to the Export functions.
private Dictionary<int, byte[]> _DocReplace;
public Dictionary<int, byte[]> DocReplace
{
get { return _DocReplace; }
set { _DocReplace = value; }
}
public bool AllowAllWatermarks
public Dictionary<int, byte[]> DocReplace { get; set; }
public bool AllowAllWatermarks
{
get { return MyPromsPrinter.AllowAllWatermarks; }
set { MyPromsPrinter.AllowAllWatermarks = value; }
@@ -195,7 +121,7 @@ namespace VEPROMS
if (args.Progress == pb.Maximum)
pb.Text = args.MyStatus;
else
pb.Text = string.Format("Processing {0} ({1} of {2})", args.MyStatus, args.Progress + 1, pb.Maximum);
pb.Text = $"Processing {args.MyStatus} ({args.Progress + 1} of {pb.Maximum})";
}
MyStatus = args.MyStatus;
Application.DoEvents();
@@ -217,38 +143,15 @@ namespace VEPROMS
Text = Text.Replace("PDF", "Time Critical Action Summary"); // F2022-024 Time Critical Action
}
private string _PdfFile;
public string PdfFile
{
get { return _PdfFile; }
set { _PdfFile = value; }
}
private bool _MakePlaceKeeper = false;
public string PdfFile { get; set; }
public bool MakePlaceKeeper
{
get { return _MakePlaceKeeper; }
set { _MakePlaceKeeper = value; }
}
public bool MakePlaceKeeper { get; set; } = false;
private bool _MakeContinuousActionSummary = false;
public bool MakeContinuousActionSummary { get; set; } = false;
public bool MakeContinuousActionSummary
{
get { return _MakeContinuousActionSummary; }
set { _MakeContinuousActionSummary = value; }
}
public bool MakeTimeCriticalActionSummary { get; set; } = false;
// F2022-024 Time Critical Action Summary
private bool _MakeTimeCriticalActionSummary = false;
public bool MakeTimeCriticalActionSummary
{
get { return _MakeTimeCriticalActionSummary; }
set { _MakeTimeCriticalActionSummary = value; }
}
private void tmrRun_Tick(object sender, EventArgs e)
private void tmrRun_Tick(object sender, EventArgs e)
{
tmrRun.Enabled = false;
if (CancelStop) btnCancel.Visible = true;
@@ -293,7 +196,7 @@ namespace VEPROMS
if (OnlyShowTimeCriticalActionSummary)
{ MyPromsPrinter.PromsPrinterPrintType = PromsPrinterPrintType.TCAS_only; }
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary, MakeTimeCriticalActionSummary, PrtSectID);
PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary, MakeTimeCriticalActionSummary, PrtSectID);
ProfileTimer.Pop(profileDepth);
@@ -307,13 +210,13 @@ namespace VEPROMS
}
// B2024-062 Added check for EmptyProcedure. We don't need to show the Try Again message if the procedure
// is empty, as it would be just be a waste of time for the user.
while (!MyPromsPrinter.MergeNotIncluded && _PdfFile == null && !MyPromsPrinter.EmptyProcedure &&
while (!MyPromsPrinter.MergeNotIncluded && PdfFile == null && !MyPromsPrinter.EmptyProcedure &&
MessageBox.Show("Try Again?", "PDF Creation Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
if (_PdfFile == null)
if (PdfFile == null)
{
this.Close();
Close();
return;
}
@@ -329,13 +232,13 @@ namespace VEPROMS
}
DateTime tEnd = DateTime.Now;
MyStatus = _PdfFile + " created.";
MyStatus = string.Format("{0} created in {1:0.} milliseconds", _PdfFile, (TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds));
MyStatus = $"{PdfFile} created.";
MyStatus = $"{PdfFile} created in {(TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds):0.} milliseconds";
if (OpenPDF)
{
OpenPDFandPlacekeeper(_PdfFile);
this.Close();
OpenPDFandPlacekeeper(PdfFile);
Close();
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. Ask if user wants to save chanages
// if they were found.
@@ -362,15 +265,15 @@ namespace VEPROMS
if (CloseWhenDone)
{
OpenPDFandPlacekeeper(null);
this.Close();
Close();
return;
}
}
private void btnOpenPDF_Click(object sender, EventArgs e)
{
OpenPDFandPlacekeeper(_PdfFile);
this.Close();
OpenPDFandPlacekeeper(PdfFile);
Close();
}
// set a delay so that the word document containing the newly generated placekeeper will appear on top of everything else.
@@ -383,8 +286,7 @@ namespace VEPROMS
{
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile);
if (sdp != null)
sdp.WaitForInputIdle();
sdp?.WaitForInputIdle();
}
if (OnlyShowContinuousActionSummary || OnlyShowTimeCriticalActionSummary) // F2022-024 Time Critical Action Summary
@@ -441,16 +343,16 @@ namespace VEPROMS
}
catch (Exception ex)
{
string str = string.Format("{0} - {1} - {2}",pdffile,ex.GetType().Name,ex.Message);
string str = $"{pdffile} - {ex.GetType().Name} - {ex.Message}";
MessageBox.Show(str, "Error Opening PDFFile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
private void btnOpenFolder_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("Explorer", "/select," + _PdfFile);
System.Diagnostics.Process.Start("Explorer", $"/select,{PdfFile}");
OpenPDFandPlacekeeper(null);
this.Close();
Close();
}
private void btnCancel_Click(object sender, EventArgs e)