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
+162 -183
View File
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
using Volian.Base.Library;
using System.Xml;
using System.IO;
@@ -20,14 +18,9 @@ namespace VEPROMS
{
#region Log4Net
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
frmVEPROMS _MyFrmVEPROMS = null;// Save frmVEPROMS for Import to shutoff SessionPing
public frmVEPROMS MyFrmVEPROMS
{
get { return _MyFrmVEPROMS; }
set { _MyFrmVEPROMS = value; }
}
private bool _ConvertROsToTextDuringImport = false;
#endregion
public frmVEPROMS MyFrmVEPROMS { get; set; } = null;
private bool _ConvertROsToTextDuringImport = false;
private bool _ConvertROsAndTransitionsToText = false; // set to true when Approval creates an Export file
protected bool _ExportBothConvertedandNot = false; // set to true when Electronic Procedure export
@@ -40,32 +33,18 @@ namespace VEPROMS
//this will hold if a specific unit was selected
readonly protected int _UnitIndex;
private ItemInfo _ExternalTransitionItem = null;
public ItemInfo ExternalTransitionItem
{
get { return _ExternalTransitionItem; }
set { _ExternalTransitionItem = value; }
}
private Dictionary<int, int> floatFoldout;
public ItemInfo ExternalTransitionItem { get; set; } = null;
private Dictionary<int, int> floatFoldout;
private Dictionary<int, string> importedFormat;
private Dictionary<string, int> existingFormat;
private Dictionary<string, string> renamedUCFFormatName; // if format is renamed, this is its new name so references to it can be made
private Dictionary<int, int> renamedUCFFormatId; // if format is renamed, this is its old->new formatid
private int oldRODbID;
private int newRODbID;
private FolderInfo _MyNewFolder;
public FolderInfo MyNewFolder
{
get { return _MyNewFolder; }
}
private ProcedureInfo _MyNewProcedure;
public ProcedureInfo MyNewProcedure
{
get { return _MyNewProcedure; }
set { _MyNewProcedure = value; }
}
private string PEIPath;
private string _MyMode;
public FolderInfo MyNewFolder => _MyNewFolder;
public ProcedureInfo MyNewProcedure { get; set; }
private string PEIPath;
private readonly string _MyMode;
protected FolderInfo MyFolder = null;
protected DocVersionInfo MyDocVersion = null;
protected ProcedureInfo MyProcedure = null;
@@ -81,7 +60,7 @@ namespace VEPROMS
_MyMode = mode;
MyFolder = folderInfo;
InitializeComponent();
this.Text = mode + " Dialog for " + folderInfo.Name;
Text = $"{mode} Dialog for {folderInfo.Name}";
_UnitIndex = unitIndex;
if (_UnitIndex > 0)
@@ -103,9 +82,9 @@ namespace VEPROMS
MyDocVersion = docVersionInfo;
InitializeComponent();
if (mode.ToUpper().Contains("FORMAT"))
this.Text = mode;
Text = mode;
else
this.Text = mode + " Dialog for " + docVersionInfo.Name + " of " + docVersionInfo.MyFolder.Name;
Text = $"{mode} Dialog for {docVersionInfo.Name} of {docVersionInfo.MyFolder.Name}";
_UnitIndex = unitIndex;
if (_UnitIndex > 0)
@@ -124,7 +103,7 @@ namespace VEPROMS
_MyMode = mode;
MyProcedure = procedureInfo;
InitializeComponent();
this.Text = mode + " Dialog for " + procedureInfo.DisplayNumber;
Text = $"{mode} Dialog for {procedureInfo.DisplayNumber}";
_UnitIndex = unitIndex;
if (_UnitIndex > 0)
@@ -173,7 +152,7 @@ namespace VEPROMS
ofd.InitialDirectory = PEIPath;
pnlImport.BringToFront();
}
this.Height = this.Height / formsize;
Height /= formsize;
}
private void btnExport_Click(object sender, EventArgs e)
{
@@ -220,19 +199,19 @@ namespace VEPROMS
string msg = "Finished Exporting:\n\n";
if (_MyMode.ToUpper().Contains("FORMAT"))
{
this.Cursor = Cursors.WaitCursor;
Cursor = Cursors.WaitCursor;
MyStart = DateTime.Now;
btnDoExport.Enabled = false;
lblExportStatus.Text = "Performing Export of UC Formats";
SaveExportUCF();
TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
lblExportStatus.Text = "Format Export Completed in " + elapsed.ToString();
this.Cursor = Cursors.Default;
lblExportStatus.Text = $"Format Export Completed in {elapsed}";
Cursor = Cursors.Default;
}
else if (MyFolder != null)
{
this.Cursor = Cursors.WaitCursor;
Cursor = Cursors.WaitCursor;
MyStart = DateTime.Now;
btnDoExport.Enabled = false;
lblExportStatus.Text = "Performing Export";
@@ -240,7 +219,7 @@ namespace VEPROMS
TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
lblExportStatus.Text = "Export Completed in " + elapsed.ToString();
this.Cursor = Cursors.Default;
Cursor = Cursors.Default;
msg += MyFolder.Name;
}
else if (MyProcedure != null)
@@ -281,7 +260,7 @@ namespace VEPROMS
}
this.Cursor = Cursors.WaitCursor;
Cursor = Cursors.WaitCursor;
MyStart = DateTime.Now;
btnDoExport.Enabled = false;
lblExportStatus.Text = "Performing Export";
@@ -294,7 +273,7 @@ namespace VEPROMS
xd.Save(fileLocation);
TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
lblExportStatus.Text = "Export Completed in " + elapsed.ToString();
this.Cursor = Cursors.Default;
Cursor = Cursors.Default;
}
// added message to user when export of a procedure or procedure set has completed
if (successfullExport)
@@ -338,7 +317,7 @@ namespace VEPROMS
bool isImported = false;
bool canceledPressed = false;
btnImport.Enabled = false;
this.Cursor = Cursors.WaitCursor;
Cursor = Cursors.WaitCursor;
MyStart = DateTime.Now;
btnDoImport.Enabled = false;
lblImportStatus.Text = "Performing Import";
@@ -350,13 +329,13 @@ namespace VEPROMS
{
TurnChangeManagerOff.Execute();
MyFrmVEPROMS.DisablePing = true;// Turn-off SessionPing
bool result = TryToImportUCFs(ref isImported, ref canceledPressed);
bool result = TryToImportUCFs(ref isImported);
MyFrmVEPROMS.DisablePing = false;// Turn-on SessionPing
TurnChangeManagerOn.Execute();
if (!result) // B2019-006: let user know there was an error during import:
{
MessageBox.Show("Error occurred during import. Format(s) not imported.");
this.Cursor = Cursors.Default;
Cursor = Cursors.Default;
btnCloseImport.Enabled = true;
return;
}
@@ -400,7 +379,7 @@ namespace VEPROMS
if (isImported)
{
TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
lblImportStatus.Text = "Import Completed in " + elapsed.ToString();
lblImportStatus.Text = $"Import Completed in {elapsed}";
}
else
{
@@ -408,7 +387,7 @@ namespace VEPROMS
btnDoImport.Enabled = true;
}
}
this.Cursor = Cursors.Default;
Cursor = Cursors.Default;
btnCloseImport.Enabled = true;
if (isImported)
{
@@ -436,7 +415,7 @@ namespace VEPROMS
}
}
private bool TryToImportUCFs(ref bool isImported, ref bool canceledPressed)
private bool TryToImportUCFs(ref bool isImported)
{
try
{
@@ -450,7 +429,7 @@ namespace VEPROMS
if (nl == null || nl.Count == 0) // B2019-014: Check contents of import file for compatible operation
{
MessageBox.Show("A Procedure export file can only be imported from the Tree View.", "Import Failed", MessageBoxButtons.OK);
this.Close();
Close();
isImported = false;
return false;
}
@@ -504,7 +483,7 @@ namespace VEPROMS
{
MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
_MyLog.Warn("Failed during UC Formats Import", ex);
this.Close();
Close();
isImported = false;
return false;
}
@@ -519,7 +498,7 @@ namespace VEPROMS
{
MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
_MyLog.Warn("Failed during Procedure Import", ex);
this.Close();
Close();
return false;
}
}
@@ -528,11 +507,9 @@ namespace VEPROMS
private bool _ImportingApprovedExportFile = false;
private bool ImportingApprovedExport(string fnAndPath)
{
bool rtnval = false;
int idx = fnAndPath.LastIndexOf("//") + 1;
int idx = fnAndPath.LastIndexOf("//") + 1;
string tmp = fnAndPath.Substring(idx);
rtnval = tmp.ToUpper().Contains("APPROVED_REV_");
return rtnval;
return tmp.ToUpper().Contains("APPROVED_REV_");
}
private bool ImportProcedure(ref bool isImported, ref bool canceledPressed)
{
@@ -544,15 +521,17 @@ namespace VEPROMS
if (ucf != null)
{
MessageBox.Show("A User Control of Format export file can only be imported from Administration on the V-Button.", "Import Failed", MessageBoxButtons.OK);
this.Cursor = Cursors.Default;
this.btnImport.Enabled = true; // allow user to select a different export file to import
this.btnCloseImport.Enabled = true; // allow user to close import dialog
Cursor = Cursors.Default;
btnImport.Enabled = true; // allow user to select a different export file to import
btnCloseImport.Enabled = true; // allow user to close import dialog
return false;
}
string rofolderpath = xd.DocumentElement.Attributes.GetNamedItem("rofolderpath").InnerText;
int rodbid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rodbid").InnerText);
int rofstid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rofstid").InnerText);
if (MyDocVersion.DocVersionAssociationCount > 0)
#pragma warning disable IDE0059 // Unnecessary assignment of a value - rofstid for Debugging/future use
int rofstid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rofstid").InnerText);
#pragma warning restore IDE0059 // Unnecessary assignment of a value
if (MyDocVersion.DocVersionAssociationCount > 0)
{
// use current ROPath
MyRODb = RODb.GetJustRoDb(MyDocVersion.DocVersionAssociations[0].MyROFst.MyRODb.RODbID);
@@ -560,15 +539,17 @@ namespace VEPROMS
// then ask if we should import using the current workingdraft RO Path, convert the ROs to text, or cancel the import
if (MyRODb.FolderPath != rofolderpath && !_ImportingApprovedExportFile) //B2020-095 don't display dialog if importing approved procedure export file
{
dlgImpHowToHandleROs dlg = new dlgImpHowToHandleROs();
dlg.ImportedROFolder = rofolderpath;
dlg.WorkingDraftROFolder = MyRODb.FolderPath;
dlg.ShowDialog(this);
dlgImpHowToHandleROs dlg = new dlgImpHowToHandleROs
{
ImportedROFolder = rofolderpath,
WorkingDraftROFolder = MyRODb.FolderPath
};
dlg.ShowDialog(this);
if (dlg.CancelImport)
{
this.Cursor = Cursors.Default;
this.btnImport.Enabled = true; // allow user to select a different export file to import
this.btnDoImport.Enabled = true; // allow user to change mind and perform the import
Cursor = Cursors.Default;
btnImport.Enabled = true; // allow user to select a different export file to import
btnDoImport.Enabled = true; // allow user to change mind and perform the import
return false; // Return False to Indicate that the Import did not succeed
}
_ConvertROsToTextDuringImport = dlg.ConvertROsToText;
@@ -612,16 +593,18 @@ namespace VEPROMS
if (localROPaths.Count == 0)
{
MessageBox.Show("There has been no RO folder defined for this database.\r\n\r\nIn order to import a procedure, you need to assign a RO folder path.\r\n\r\nImport process will terminate.");
this.Cursor = Cursors.Default;
Cursor = Cursors.Default;
return false;// Return False to Indicate that the Import did not succeed
}
else
{
this.Cursor = Cursors.Default;
dlgPickROFolder dlg = new dlgPickROFolder();
dlg.ImportedROFolder = rofolderpath;
dlg.LocalROFolders = localROPaths;
dlg.ShowDialog(this);
Cursor = Cursors.Default;
dlgPickROFolder dlg = new dlgPickROFolder
{
ImportedROFolder = rofolderpath,
LocalROFolders = localROPaths
};
dlg.ShowDialog(this);
if ((dlg.SelectedROFolder ?? string.Empty) != string.Empty) // B2015-216 If the return value is null treat it like an empty string
{
MyRODb = RODb.GetByFolderPath(dlg.SelectedROFolder);
@@ -645,7 +628,7 @@ namespace VEPROMS
else
{
MessageBox.Show("Since you did not pick an existing RO folder defined for this database, the import process will terminate.");
this.Close();// Close the Import Window
Close();// Close the Import Window
return false;// Return False to Indicate that the Import did not succeed
}
}
@@ -655,9 +638,9 @@ namespace VEPROMS
bool didImp = LoadFormats(xd, "procedure/formats/format");
if (!didImp)
{
this.Cursor = Cursors.Default;
this.btnImport.Enabled = true; // allow user to select a different export file to import
this.btnDoImport.Enabled = true; // allow user to change mind and perform the import
Cursor = Cursors.Default;
btnImport.Enabled = true; // allow user to select a different export file to import
btnDoImport.Enabled = true; // allow user to change mind and perform the import
return false; // Return False to Indicate that the Import did not succeed
}
// use resolvedProcNum to determine if procedure is 'unique', i.e. if the procedure number exists
@@ -763,7 +746,7 @@ namespace VEPROMS
ProcedureInfo lastProcedure = null;
foreach (ProcedureInfo pi in MyDocVersion.Procedures.OfType<ProcedureInfo>())
lastProcedure = pi;
_MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
//update transitions
AddTransitions(PendingTransitions);
PendingTransitions.Save(fn);
@@ -803,7 +786,7 @@ namespace VEPROMS
}
xd.SelectSingleNode("procedure/content/@number").InnerText = string.Format("Copy({0}) of {1}", count.ToString(), number);
//add imported procedure and copy count
_MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
//update transitions
AddTransitions(PendingTransitions);
FixFloatingFoldouts();
@@ -861,7 +844,7 @@ namespace VEPROMS
return false;
}
//add imported procedure
_MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
//update transitions
AddTransitions(PendingTransitions);
FixFloatingFoldouts();
@@ -884,9 +867,9 @@ namespace VEPROMS
bool didImp = LoadFormats(xd, "folder/formats/format");
if (!didImp)
{
this.Cursor = Cursors.Default;
this.btnImport.Enabled = true; // allow user to select a different export file to import
this.btnDoImport.Enabled = true; // allow user to change mind and perform the import
Cursor = Cursors.Default;
btnImport.Enabled = true; // allow user to select a different export file to import
btnDoImport.Enabled = true; // allow user to change mind and perform the import
return false; // Return False to Indicate that the Import did not succeed
}
string name = xd.DocumentElement.Attributes.GetNamedItem("name").InnerText;
@@ -1004,7 +987,8 @@ namespace VEPROMS
c.Save();
}
}
Dictionary<string, string> existingCopyFCName = new Dictionary<string, string>();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
Dictionary<string, string> existingCopyFCName = new Dictionary<string, string>();
// note that this is used when importing a folder or a procedure (procedure was added for UCF changes)
private bool LoadFormats(XmlDocument xd, string xmlpath)
{
@@ -1015,21 +999,20 @@ namespace VEPROMS
importedFormat = new Dictionary<int, string>();
XmlNodeList nl = xd.SelectNodes(xmlpath);
bool conflictingUCFdata = false;
List<string> existingFC = new List<string>();
List<string> importedFC = new List<string>();
List<string> fname = new List<string>();
foreach (XmlNode nd in nl)
{
string copyOfUCF = null;
// see if any of the imported formats are 'UCF' formats, i.e. have config data. If they are UCF,
// see if this is different that what is in the database. If it is, the user needs to decide
// whether to associate sections with existing UCF format or the new one. All UCF formats will be
// connected the same way, i.e. existing or new.
int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText);
string name = nd.Attributes.GetNamedItem("name").InnerText;
// see if any of the imported formats are 'UCF' formats, i.e. have config data. If they are UCF,
// see if this is different that what is in the database. If it is, the user needs to decide
// whether to associate sections with existing UCF format or the new one. All UCF formats will be
// connected the same way, i.e. existing or new.
#pragma warning disable IDE0059 // Unnecessary assignment of a value - formatid for Debugging/future use
int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText);
#pragma warning restore IDE0059 // Unnecessary assignment of a value
string name = nd.Attributes.GetNamedItem("name").InnerText;
string config = null;
XmlNode cfg = nd.Attributes.GetNamedItem("config");
if (cfg != null) config = cfg.InnerText;
@@ -1038,10 +1021,10 @@ namespace VEPROMS
FormatInfo exFI = FormatInfo.Get(existingFormat[name]);
if (exFI.Config != config && exFI.Config != "" && exFI.Config != null && config != "" && config != null)
{
// See if there are copies of this UCF format, if so, this may match (have same config) one of those and should
// use it before stating there is conflicting data.
copyOfUCF = ContentsOfUCFExists(name, config);
if (copyOfUCF == null)
// See if there are copies of this UCF format, if so, this may match (have same config) one of those and should
// use it before stating there is conflicting data.
string copyOfUCF = ContentsOfUCFExists(name, config);
if (copyOfUCF == null)
{
existingFC.Add(exFI.Config);
importedFC.Add(config);
@@ -1069,15 +1052,16 @@ namespace VEPROMS
if (pnameAttrib != null)
pname = pnameAttrib.InnerText;
if (pname == null) continue;
string description = null;
XmlNode descript = nd.Attributes.GetNamedItem("description");
if (descript != null) description = descript.InnerText;
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
// If the format that is being imported exists as a copy (already was imported and a 'Copy x of name' was created) and the imported and
// existing config match, use the existing (copied) format's name rather than importing it again (the dictionary was set up during
// the import formats process.
if (existingCopyFCName.ContainsKey(name)) name = existingCopyFCName[name];
XmlNode descript = nd.Attributes.GetNamedItem("description");
#pragma warning disable IDE0059 // Unnecessary assignment of a value - description, userid, dts for future use
string description = descript?.InnerText;
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
#pragma warning restore IDE0059 // Unnecessary assignment of a value
// If the format that is being imported exists as a copy (already was imported and a 'Copy x of name' was created) and the imported and
// existing config match, use the existing (copied) format's name rather than importing it again (the dictionary was set up during
// the import formats process.
if (existingCopyFCName.ContainsKey(name)) name = existingCopyFCName[name];
// compare this imported format to the original in the database.
// If format name exists, or if it has same config data, just use it.
@@ -1098,11 +1082,11 @@ namespace VEPROMS
// parent format will always be in there, if it is a new format, it will be added before the child. Check just in case (no null reference).
if (!existingFormat.ContainsKey(pname)) break;
int pid = existingFormat[pname];
Format pformat = Format.Get(pid);
_ = Format.Get(pid);
// if the new format doesn't exist, it will be added (after these other checks). Otherwise, handle the
// various cases listed above:
if (existingFormat.ContainsKey(name))
// if the new format doesn't exist, it will be added (after these other checks). Otherwise, handle the
// various cases listed above:
if (existingFormat.ContainsKey(name))
{
@@ -1221,7 +1205,6 @@ namespace VEPROMS
{
int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText);
int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText);
//if (!Old2NewContent.ContainsKey(oldid))
Old2NewLibDoc.Add(oldid, newid);
}
File.Delete(fn);
@@ -1362,8 +1345,8 @@ namespace VEPROMS
}
private void ExportFormats(FormatInfoList fil, XmlElement xn, string nodename, bool doElement)
{
XmlElement xe = null;
if (doElement) xe = xn.OwnerDocument.CreateElement(nodename);
XmlElement xe;
if (doElement) xe = xn.OwnerDocument.CreateElement(nodename);
else xe = xn;
foreach (FormatInfo fi in fil)
ExportFormat(xe, fi, "format");
@@ -1489,7 +1472,7 @@ namespace VEPROMS
{
pbExportProcedure.Value = 0;
pbExportProcedure.Maximum = dvi.Procedures.Count;
lblExportProcedure.Text = pbExportProcedure.Maximum.ToString() + " Procedures";
lblExportProcedure.Text = $"{pbExportProcedure.Maximum} Procedures";
foreach (ItemInfo ii in dvi.Procedures)
{
XmlDocument xd = new XmlDocument();
@@ -1641,14 +1624,14 @@ namespace VEPROMS
private void ExportItem(XmlElement xn, ItemInfo ii, string nodename)
{
/*
/*
ItemID
PreviousID
ContentID
DTS
*/
XmlElement xe = null;
if (xn.Name == "procedure")
XmlElement xe;
if (xn.Name == "procedure")
xe = xn;
else
{
@@ -2434,12 +2417,9 @@ namespace VEPROMS
}
}
private void AddTransitions()
{
AddTransitions(PendingTransitions);
}
private void AddTransitions() => AddTransitions(PendingTransitions);
private void AddTransitions(XmlDocument xd)
private void AddTransitions(XmlDocument xd)
{
/*
Content
@@ -2459,7 +2439,7 @@ namespace VEPROMS
type,id,toid,rangeid
*/
XmlNodeList nl = xd.SelectNodes("//transition");
lblImportStatus.Text = string.Format("Updating {0} Tranistions", nl.Count.ToString());
lblImportStatus.Text = $"Updating {nl.Count} Tranistions";
foreach (XmlNode nd in nl)
{
@@ -2522,9 +2502,8 @@ namespace VEPROMS
}
else //transition to existing itemid (external)
{
bool forceConvertToText = false;
int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText);
int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText);
int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText);
int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText);
string config = nd.Attributes.GetNamedItem("config").InnerText;
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
@@ -2538,43 +2517,44 @@ namespace VEPROMS
fromid = Old2NewContent[fromid];
Content cc = Content.Get(fromid);
Transition tt = Transition.MakeTransition(cc, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid);
if (tt.TransitionID < 0)
{
forceConvertToText = true;
_DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
cc.Save();
nd.InnerText = "done";
}
else
{
transitionid = tt.TransitionID;
string replacewith;
if (isrange == 0)
replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid);
else
replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
cc.Text = cc.Text.Replace(lookfor, replacewith);
if (cc.MyGrid != null && !string.IsNullOrEmpty(cc.MyGrid.Data))
{
cc.MyGrid.Data = cc.MyGrid.Data.Replace(lookfor, replacewith);
}
bool forceConvertToText;
if (tt.TransitionID < 0)
{
forceConvertToText = true;
_DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
cc.Save();
nd.InnerText = "done";
}
else
{
transitionid = tt.TransitionID;
string replacewith;
// B2016-176, B2016-197 - external transitions should be converted to text
forceConvertToText = true;
_DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
// B2017=003 make sure any grid changes are saved.
// done here because FixTransitionText() could update the transitions in the grid
if (cc.MyGrid != null && cc.MyGrid.Data != "")
cc.MyGrid.Save();
cc.Save();
nd.InnerText = "done";
_DidConvertTransitionsToText |= (forceConvertToText && _DidProcessTransitions); // B2016-225 - notify user when transitions are converted to text
}
}
if (isrange == 0)
replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid);
else
replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
cc.Text = cc.Text.Replace(lookfor, replacewith);
if (cc.MyGrid != null && !string.IsNullOrEmpty(cc.MyGrid.Data))
{
cc.MyGrid.Data = cc.MyGrid.Data.Replace(lookfor, replacewith);
}
// B2016-176, B2016-197 - external transitions should be converted to text
forceConvertToText = true;
_DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
// B2017=003 make sure any grid changes are saved.
// done here because FixTransitionText() could update the transitions in the grid
if (cc.MyGrid != null && cc.MyGrid.Data != "")
cc.MyGrid.Save();
cc.Save();
nd.InnerText = "done";
_DidConvertTransitionsToText |= (forceConvertToText && _DidProcessTransitions); // B2016-225 - notify user when transitions are converted to text
}
}
}
}
}
@@ -2620,7 +2600,6 @@ namespace VEPROMS
if (formatID >= importedFormat.Count) return null; // formatID not found, use default file name
formatName = importedFormat[formatID]; // for backwards compatibility with older export files
}
if (renamedUCFFormatName != null && renamedUCFFormatName.ContainsKey(formatFileName)) formatName = renamedUCFFormatName[formatName];
formatID = existingFormat[formatName];
return Format.Get(formatID);
}
@@ -2668,9 +2647,11 @@ namespace VEPROMS
MyRODb = AddRODb(xrodb);
ROFst rofst = AddROFst(xrofst);
DocVersionAssociation dva = dv.DocVersionAssociations.Add(rofst);
#pragma warning disable IDE0059 // Unnecessary assignment of a value - dva kept for side effect code
DocVersionAssociation dva = dv.DocVersionAssociations.Add(rofst);
#pragma warning restore IDE0059 // Unnecessary assignment of a value
dv.Save();
dv.Save();
}
return DocVersionInfo.Get(dv.VersionID);
@@ -2905,9 +2886,11 @@ namespace VEPROMS
foreach (XmlNode nd in xn.SelectNodes("rousage"))
{
string rousageid = nd.Attributes.GetNamedItem("rousageid").InnerText;
string roid = nd.Attributes.GetNamedItem("roid").InnerText;
#pragma warning disable IDE0059 // Unnecessary assignment of a value - roid for Debugging/future use
string roid = nd.Attributes.GetNamedItem("roid").InnerText;
#pragma warning restore IDE0059 // Unnecessary assignment of a value
string findLink = @"<START\].*?\[END>";
string findLink = @"<START\].*?\[END>";
content.Text = content.Text.Replace("<START]<START]", "<START]").Replace(@"[END><START]", @"[END>\v0 \v <START]"); //B2020-057 bad RO link - remove extra START and insert comment off/on between <END]<START]
content.Save();
MatchCollection ms = Regex.Matches(content.Text, findLink);
@@ -2943,7 +2926,7 @@ namespace VEPROMS
if (prefix == @"\v ")
part1 = part1.Substring(0, part1.Length - 3);
else
part1 = part1.Substring(0, part1.Length - 3) + " ";
part1 = $"{part1.Substring(0, part1.Length - 3)} ";
//modify part3 based on suffix
if (suffix == @"\v0 ")
part3 = part3.Substring(4);
@@ -3114,8 +3097,10 @@ namespace VEPROMS
{
foreach (XmlNode nd in xn.SelectNodes("annotation"))
{
int typeid = int.Parse(nd.Attributes.GetNamedItem("typeid").InnerText);
string rtftext = nd.Attributes.GetNamedItem("rtftext").InnerText;
#pragma warning disable IDE0059 // Unnecessary assignment of a value - typeid for debugging/future use
int typeid = int.Parse(nd.Attributes.GetNamedItem("typeid").InnerText);
#pragma warning restore IDE0059 // Unnecessary assignment of a value
string rtftext = nd.Attributes.GetNamedItem("rtftext").InnerText;
string searchtext = nd.Attributes.GetNamedItem("searchtext").InnerText;
string config = nd.Attributes.GetNamedItem("config").InnerText;
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
@@ -3850,7 +3835,7 @@ namespace VEPROMS
if (d == null)
{
// B2019-035 better memory management. Prior logic would eat up memory (and not free it).
string libkey = libtitle + "_" + dts.ToString();
string libkey = $"{libtitle}_{dts}";
if (ExistingLibDocs.ContainsKey(libkey))
d = Document.Get(ExistingLibDocs[libkey]); // found library document in existing database
}
@@ -3863,7 +3848,7 @@ namespace VEPROMS
string config = xn.Attributes.GetNamedItem("config").InnerText;
string userid = xn.Attributes.GetNamedItem("userid").InnerText;
string fileextension = xn.Attributes.GetNamedItem("fileextension").InnerText;
if (libtitle != "") libtitle = libtitle + "_" + dts.ToString(); // if a lib document, append the date/time to the title incase there are duplicate titles
if (libtitle != "") libtitle = $"{libtitle}_{dts}"; // if a lib document, append the date/time to the title incase there are duplicate titles
d = Document.MakeDocument(libtitle, doccontent, docascii, config, dts, userid, fileextension);
d.Save();
Old2NewLibDoc.Add(docid, d.DocID);
@@ -3873,20 +3858,14 @@ namespace VEPROMS
return d;
}
#endregion
#endregion
private void btnCloseExport_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnCloseExport_Click(object sender, EventArgs e) => Close();
private void btnCloseImport_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnCloseImport_Click(object sender, EventArgs e) => Close();
//unset the unit (SelectedSlave)
private void RemoveUnit_OnClose(object sender, EventArgs e)
//unset the unit (SelectedSlave)
private void RemoveUnit_OnClose(object sender, EventArgs e)
{
if (MyProcedure != null)
{