CSLA - Extension
This commit is contained in:
@@ -25,25 +25,10 @@ namespace VEPROMS.CSLA.Library
|
||||
get { return _NewTransToUnNumberedItem; }
|
||||
set { _NewTransToUnNumberedItem = value; }
|
||||
}
|
||||
public string PathTo
|
||||
{
|
||||
get
|
||||
{
|
||||
return MyItemToID.Path;
|
||||
}
|
||||
}
|
||||
public string PathFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
return MyContent.ContentItems[0].Path;
|
||||
}
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("ID: {0} From: {1} To: {2}", TransitionID, FromID, ToID);
|
||||
}
|
||||
[NonSerialized]
|
||||
public string PathTo => MyItemToID.Path;
|
||||
public string PathFrom => MyContent.ContentItems[0].Path;
|
||||
public override string ToString() => $"ID: {TransitionID} From: {FromID} To: {ToID}";
|
||||
[NonSerialized]
|
||||
private TransitionConfig _TransitionConfig;
|
||||
public TransitionConfig TransitionConfig
|
||||
{
|
||||
@@ -56,27 +41,7 @@ namespace VEPROMS.CSLA.Library
|
||||
return _TransitionConfig;
|
||||
}
|
||||
}
|
||||
public bool HasPageNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return TransitionConfig.Transition_Formatted.ToUpper() == "TRUE";
|
||||
}
|
||||
}
|
||||
public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, int tranType, ItemInfo toitem, ItemInfo rangeitem, bool hasPageNum)
|
||||
{
|
||||
try
|
||||
{
|
||||
return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, rangeitem, HasPageNum);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (tranType == 2 && ex.Message == "Cannot find Next Item")
|
||||
return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, toitem, HasPageNum);
|
||||
_MyLog.Error("Error Processing Transition Text", ex);
|
||||
return "(Resolved Transition Text)";
|
||||
}
|
||||
}
|
||||
public bool HasPageNum => TransitionConfig.Transition_Formatted.ToUpper() == "TRUE";
|
||||
public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, int tranType, ItemInfo toitem, ItemInfo rangeitem)
|
||||
{
|
||||
try
|
||||
@@ -108,13 +73,6 @@ namespace VEPROMS.CSLA.Library
|
||||
ItemInfo item = MyContent.ContentItems[0];
|
||||
ItemInfo myItemToID = MyItemToID;
|
||||
if (tranLookup.ContainsKey(item.ItemID)) item = tranLookup[item.ItemID];
|
||||
bool hasPageNum = false;
|
||||
if (item.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier ||
|
||||
item.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
|
||||
{
|
||||
TransitionConfig tc = new TransitionConfig(Config);
|
||||
if (tc != null && tc.Transition_Formatted.ToUpper() == "TRUE") hasPageNum = true;
|
||||
}
|
||||
if (tranLookup.ContainsKey(ToID))
|
||||
{
|
||||
myItemToID = tranLookup[ToID];
|
||||
@@ -150,7 +108,7 @@ namespace VEPROMS.CSLA.Library
|
||||
//Console.WriteLine("MyItemToID = {0}", MyItemToID);
|
||||
//Console.WriteLine("MyItemRangeID = {0}", MyItemRangeID);
|
||||
}
|
||||
return ResolvePathTo(item.ActiveFormat, item, TranType, myItemToID, myItemRangeID, hasPageNum);
|
||||
return ResolvePathTo(item.ActiveFormat, item, TranType, myItemToID, myItemRangeID);
|
||||
}
|
||||
}
|
||||
#region AffectedTransitons
|
||||
@@ -172,17 +130,11 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
protected class TransitionReportDataCriteria
|
||||
{
|
||||
private int _VersionID;
|
||||
public int VersionID
|
||||
{
|
||||
get { return _VersionID; }
|
||||
}
|
||||
private int _ProcedureID;
|
||||
public int ProcedureID
|
||||
{
|
||||
get { return _ProcedureID; }
|
||||
}
|
||||
public TransitionReportDataCriteria(int versionID, int procedureID)
|
||||
private readonly int _VersionID;
|
||||
public int VersionID => _VersionID;
|
||||
private readonly int _ProcedureID;
|
||||
public int ProcedureID => _ProcedureID;
|
||||
public TransitionReportDataCriteria(int versionID, int procedureID)
|
||||
{
|
||||
_VersionID = versionID;
|
||||
_ProcedureID = procedureID;
|
||||
@@ -208,9 +160,11 @@ namespace VEPROMS.CSLA.Library
|
||||
IsReadOnly = false;
|
||||
while (dr.Read())
|
||||
{
|
||||
TransitionInfo ti = new TransitionInfo(dr);
|
||||
ti.Level = dr.GetInt32("level");
|
||||
this.Add(ti);
|
||||
TransitionInfo ti = new TransitionInfo(dr)
|
||||
{
|
||||
Level = dr.GetInt32("level")
|
||||
};
|
||||
this.Add(ti);
|
||||
}
|
||||
IsReadOnly = true;
|
||||
}
|
||||
@@ -228,11 +182,8 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
private class AffectedTransitonsCriteria
|
||||
{
|
||||
public AffectedTransitonsCriteria(int itemID)
|
||||
{
|
||||
_ItemID = itemID;
|
||||
}
|
||||
private int _ItemID;
|
||||
public AffectedTransitonsCriteria(int itemID) => _ItemID = itemID;
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
@@ -287,24 +238,17 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
StringBuilder sb = new StringBuilder("");
|
||||
foreach (TransitionInfo trans in this)
|
||||
sb.Append("\r\n" + trans.PathFrom);
|
||||
sb.Append($"\r\n{trans.PathFrom}");
|
||||
return sb.ToString();
|
||||
}
|
||||
#endregion
|
||||
#region ExternalTransitionsToChildren
|
||||
private class ExternalTransitionsToChildrenCriteria
|
||||
{
|
||||
public ExternalTransitionsToChildrenCriteria(int itemID)
|
||||
{
|
||||
_ItemID = itemID;
|
||||
}
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
}
|
||||
public ExternalTransitionsToChildrenCriteria(int itemID) => ItemID = itemID;
|
||||
|
||||
public int ItemID { get; set; }
|
||||
}
|
||||
public static TransitionInfoList GetExternalTransitionsToChildren(int itemID)
|
||||
{
|
||||
try
|
||||
@@ -354,17 +298,10 @@ namespace VEPROMS.CSLA.Library
|
||||
#region ExternalTransitions
|
||||
private class ExternalTransitionsCriteria
|
||||
{
|
||||
public ExternalTransitionsCriteria(int itemID)
|
||||
{
|
||||
_ItemID = itemID;
|
||||
}
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
}
|
||||
public ExternalTransitionsCriteria(int itemID) => ItemID = itemID;
|
||||
|
||||
public int ItemID { get; set; }
|
||||
}
|
||||
public static TransitionInfoList GetExternalTransitions(int itemID)
|
||||
{
|
||||
try
|
||||
@@ -413,17 +350,10 @@ namespace VEPROMS.CSLA.Library
|
||||
#region PastedAffectedTransitions
|
||||
private class PastedAffectedTransitonsCriteria
|
||||
{
|
||||
public PastedAffectedTransitonsCriteria(int itemID)
|
||||
{
|
||||
_ItemID = itemID;
|
||||
}
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
}
|
||||
public PastedAffectedTransitonsCriteria(int itemID) => ItemID = itemID;
|
||||
|
||||
public int ItemID { get; set; }
|
||||
}
|
||||
internal static TransitionInfoList GetPastedAffected(int itemID)
|
||||
{
|
||||
try
|
||||
@@ -472,17 +402,10 @@ namespace VEPROMS.CSLA.Library
|
||||
#region TransitionsToDisconnected
|
||||
private class TransitionsToDisconnectedCriteria
|
||||
{
|
||||
public TransitionsToDisconnectedCriteria(string docVersionList)
|
||||
{
|
||||
_DocVersionList = docVersionList;
|
||||
}
|
||||
private string _DocVersionList;
|
||||
public string DocVersionList
|
||||
{
|
||||
get { return _DocVersionList; }
|
||||
set { _DocVersionList = value; }
|
||||
}
|
||||
}
|
||||
public TransitionsToDisconnectedCriteria(string docVersionList) => DocVersionList = docVersionList;
|
||||
|
||||
public string DocVersionList { get; set; }
|
||||
}
|
||||
public static TransitionInfoList GetTransitionsToDisconnected(string docVersionList)
|
||||
{
|
||||
try
|
||||
@@ -531,17 +454,10 @@ namespace VEPROMS.CSLA.Library
|
||||
#region TransitionsToNonEditable
|
||||
private class TransitionsToNonEditableCriteria
|
||||
{
|
||||
public TransitionsToNonEditableCriteria(string docVersionList)
|
||||
{
|
||||
_DocVersionList = docVersionList;
|
||||
}
|
||||
private string _DocVersionList;
|
||||
public string DocVersionList
|
||||
{
|
||||
get { return _DocVersionList; }
|
||||
set { _DocVersionList = value; }
|
||||
}
|
||||
}
|
||||
public TransitionsToNonEditableCriteria(string docVersionList) => DocVersionList = docVersionList;
|
||||
|
||||
public string DocVersionList { get; set; }
|
||||
}
|
||||
public static TransitionInfoList GetTransitionsToNonEditable(string docVersionList)
|
||||
{
|
||||
try
|
||||
@@ -590,7 +506,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public class TransitionBuilder
|
||||
{
|
||||
private StringBuilder _Results = new StringBuilder();
|
||||
private readonly StringBuilder _Results = new StringBuilder();
|
||||
public FormatData _FormatData;
|
||||
public string _TransFormat;
|
||||
public E_TransUI _TransUI;
|
||||
@@ -599,53 +515,25 @@ namespace VEPROMS.CSLA.Library
|
||||
public ItemInfo _ToItem;
|
||||
public ItemInfo _RangeItem;
|
||||
public bool _UsedRangeAncestor;
|
||||
private string _Token;
|
||||
public string _UnitProcSetString;
|
||||
public string _UnitProcSetString;
|
||||
public bool SectNumWithStepNum;
|
||||
private int _SectionNumberLength = 0;
|
||||
public int SectionNumberLength
|
||||
{
|
||||
get { return _SectionNumberLength; }
|
||||
set { _SectionNumberLength = value; }
|
||||
}
|
||||
private string _StepPrefix = "";
|
||||
public string StepPrefix
|
||||
{
|
||||
get { return _StepPrefix; }
|
||||
set { _StepPrefix = value; }
|
||||
}
|
||||
private List<int> _SectionsUsed = new List<int>();
|
||||
public List<int> SectionsUsed
|
||||
{
|
||||
get { return _SectionsUsed; }
|
||||
}
|
||||
public string Token
|
||||
{
|
||||
get { return _Token; }
|
||||
set { _Token = value; }
|
||||
}
|
||||
private string _Prefix;
|
||||
|
||||
public int SectionNumberLength { get; set; } = 0;
|
||||
public string StepPrefix { get; set; } = "";
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private List<int> _SectionsUsed = new List<int>();
|
||||
public List<int> SectionsUsed => _SectionsUsed;
|
||||
public string Token { get; set; }
|
||||
private string _Prefix;
|
||||
public string Prefix
|
||||
{
|
||||
get { return _Prefix; }
|
||||
set { if(_Prefix==null)_Prefix = value; }
|
||||
}
|
||||
public void ResetPrefix(string str)
|
||||
{
|
||||
_Prefix = str;
|
||||
}
|
||||
public bool HasText
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Results.Length > 0;
|
||||
}
|
||||
}
|
||||
public StringBuilder Append(string str)
|
||||
{
|
||||
return _Results.Append(str);
|
||||
}
|
||||
public StringBuilder ReplaceToken(string str)
|
||||
public void ResetPrefix(string str) => _Prefix = str;
|
||||
public bool HasText => _Results.Length > 0;
|
||||
public StringBuilder Append(string str) => _Results.Append(str);
|
||||
public StringBuilder ReplaceToken(string str)
|
||||
{
|
||||
if (str == null || str == "") return _Results;
|
||||
if (_FormatData.TransData.XchngTranSpForHard && str[0]!=',' && str[0] != ' ')
|
||||
@@ -662,19 +550,10 @@ namespace VEPROMS.CSLA.Library
|
||||
else
|
||||
return _Results.Append(str.TrimEnd(" :".ToCharArray()));
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return _Results.ToString();
|
||||
}
|
||||
public StringBuilder Remove(int startIndex, int length)
|
||||
{
|
||||
return _Results.Remove(startIndex, length);
|
||||
}
|
||||
public int Length
|
||||
{
|
||||
get { return _Results.Length; }
|
||||
}
|
||||
public void AppendPrefix()
|
||||
public override string ToString() => _Results.ToString();
|
||||
public StringBuilder Remove(int startIndex, int length) => _Results.Remove(startIndex, length);
|
||||
public int Length => _Results.Length;
|
||||
public void AppendPrefix()
|
||||
{
|
||||
if (Prefix == null) return; // no Prefix text to add
|
||||
if (HasText)
|
||||
@@ -741,47 +620,43 @@ namespace VEPROMS.CSLA.Library
|
||||
private static Dictionary<string, TransitionAppendFunction> _AppendMethods;
|
||||
private static void SetupMethods()
|
||||
{
|
||||
_AppendMethods = new Dictionary<string, TransitionAppendFunction>();
|
||||
_AppendMethods.Add("{Proc Num}", AddTransitionProcNum);
|
||||
_AppendMethods.Add("{?.Proc Num}", AddOptionalTransitionProcNum);
|
||||
_AppendMethods.Add("{Proc Title}", AddTransitionProcTitle);
|
||||
_AppendMethods.Add("{?.Proc Title}", AddOptionalTransitionProcTitle);
|
||||
_AppendMethods.Add("{First Step}", AddStepNumber);
|
||||
_AppendMethods.Add("{Step Number}", AddStepNumber); // WCN2, tran type 6
|
||||
_AppendMethods.Add("{Last Step}", AddRangeStepNumber);
|
||||
_AppendMethods.Add("{.}", AddIncludedStepNumber);
|
||||
_AppendMethods.Add("{Sect Hdr}", AddTranGetSectionHdr);
|
||||
_AppendMethods.Add("{?.Sect Hdr}", AddOptionalTranGetSectionHdr);
|
||||
_AppendMethods.Add("{Sect Title}", AddTranGetSectionTitle);
|
||||
_AppendMethods.Add("{?.Sect Title}", AddOptionalTranGetSectionTitle);
|
||||
_AppendMethods.Add("{?.Sect Num}", AddOptionalTranGetSectionNum);
|
||||
_AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber);
|
||||
_AppendMethods.Add("{Sect Num All}", AddTranGetAllSectionNumber);
|
||||
_AppendMethods.Add("{Sect Number}", AddTranGetSectionNumber); // WCN2, tran type 6
|
||||
_AppendMethods.Add("{Page Num}", AddPageNumber);
|
||||
_AppendMethods.Add("{Step Text}", AddStepText);
|
||||
_AppendMethods = new Dictionary<string, TransitionAppendFunction>
|
||||
{
|
||||
{ "{Proc Num}", AddTransitionProcNum },
|
||||
{ "{?.Proc Num}", AddOptionalTransitionProcNum },
|
||||
{ "{Proc Title}", AddTransitionProcTitle },
|
||||
{ "{?.Proc Title}", AddOptionalTransitionProcTitle },
|
||||
{ "{First Step}", AddStepNumber },
|
||||
{ "{Step Number}", AddStepNumber }, // WCN2, tran type 6
|
||||
{ "{Last Step}", AddRangeStepNumber },
|
||||
{ "{.}", AddIncludedStepNumber },
|
||||
{ "{Sect Hdr}", AddTranGetSectionHdr },
|
||||
{ "{?.Sect Hdr}", AddOptionalTranGetSectionHdr },
|
||||
{ "{Sect Title}", AddTranGetSectionTitle },
|
||||
{ "{?.Sect Title}", AddOptionalTranGetSectionTitle },
|
||||
{ "{?.Sect Num}", AddOptionalTranGetSectionNum },
|
||||
{ "{Sect Num}", AddTranGetSectionNumber },
|
||||
{ "{Sect Num All}", AddTranGetAllSectionNumber },
|
||||
{ "{Sect Number}", AddTranGetSectionNumber }, // WCN2, tran type 6
|
||||
{ "{Page Num}", AddPageNumber },
|
||||
{ "{Step Text}", AddStepText }
|
||||
};
|
||||
}
|
||||
public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem, bool hasPageNum)
|
||||
{
|
||||
return GetResolvedText(fromInfo.ActiveFormat, fromInfo, tranType, toItem, rangeItem, hasPageNum);
|
||||
}
|
||||
private static Regex RegFixVCS = new Regex(@"Section ([0-9.]+)(.0)? Step \1"); // Find Section xxx followed by Step xxx
|
||||
public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem, bool hasPageNum) => GetResolvedText(fromInfo.ActiveFormat, fromInfo, tranType, toItem, rangeItem, hasPageNum);
|
||||
private static readonly Regex RegFixVCS = new Regex(@"Section ([0-9.]+)(.0)? Step \1"); // Find Section xxx followed by Step xxx
|
||||
public static string GetResolvedText(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem, bool pagenum)
|
||||
{
|
||||
if (!pagenum)
|
||||
{
|
||||
TransitionInfo ct = fromInfo.MyContent.ContentTransitionCount > 0 ? fromInfo.MyContent.ContentTransitions[0] : null;
|
||||
int trIU = -1;
|
||||
string cfg = string.Empty;
|
||||
if (ct != null)
|
||||
if (ct != null)
|
||||
{
|
||||
trIU = fromInfo.MyContent.ContentTransitions[0].MyTransitionInfoUnique;
|
||||
cfg = fromInfo.MyContent.ContentTransitions[0].Config;
|
||||
}
|
||||
_ = fromInfo.MyContent.ContentTransitions[0].MyTransitionInfoUnique;
|
||||
_ = fromInfo.MyContent.ContentTransitions[0].Config;
|
||||
}
|
||||
else
|
||||
{
|
||||
string pattern = string.Format(@"<START\]\\v0([^#]*)\\v #Link:Transition(|Range):[0-9]* <CTID=-[0-9]+>( [0-9]*){{1,2}}\[END>");
|
||||
//string pattern = string.Format(@".*\\v <START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:[0-9]+ <CTID=-[0-9]+>( [0-9]*){{1,2}}\[END>");
|
||||
string pattern = string.Format(@"<START\]\\v0([^#]*)\\v #Link:Transition(|Range):[0-9]* <CTID=-[0-9]+>( [0-9]*){{1,2}}\[END>");
|
||||
Match m = Regex.Match(fromInfo.MyContent.Text, pattern);
|
||||
if (m.Groups.Count > 1 && m.Groups[1].Value.ToUpper().Contains("(PAGE ~)")) // B2020-089, check for upper case Page ~ in case step was upper cased
|
||||
pagenum = true;
|
||||
@@ -805,7 +680,7 @@ namespace VEPROMS.CSLA.Library
|
||||
tb._TransFormat = tb._TransFormat.Insert(tb._TransFormat.IndexOf("{First Step}")+12, " {Page Num}");
|
||||
}
|
||||
else
|
||||
tb._TransFormat = tb._TransFormat + " {Page Num}";
|
||||
tb._TransFormat += " {Page Num}";
|
||||
}
|
||||
}
|
||||
if(_AppendMethods==null)
|
||||
@@ -820,18 +695,7 @@ namespace VEPROMS.CSLA.Library
|
||||
retval = toItem.Ordinal.ToString();
|
||||
fromInfo.NewTransToUnNumberedItem = true;
|
||||
//Volian.Base.Library.vlnStackTrace.ShowStackLocal("Setting Flag", 3, 10);
|
||||
//using (Item itm = fromInfo.Get())
|
||||
//{
|
||||
// ItemAnnotation ia = itm.ItemAnnotations.Add(AnnotationType.GetByName("Verifcation Required"));
|
||||
// ia.SearchText = "Transition to Un-Numbered Step";
|
||||
//itm.Save();
|
||||
//}
|
||||
}
|
||||
//if (Regex.IsMatch(retval, @".*\[[BP][0-9]{4,4}\].*")
|
||||
// && tb._ToItem.ActiveFormat != null
|
||||
// && tb._ToItem.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert )
|
||||
// retval = Regex.Replace(retval, @" *(\[[BP][0-9]{4,4}\])+","");
|
||||
//return retval;
|
||||
if (Regex.IsMatch(retval, @".* *\[([A-Z0-9 ]|\\u160\?)+\] *.*")
|
||||
&& tb._ToItem.ActiveFormat != null
|
||||
&& tb._ToItem.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert)
|
||||
@@ -844,11 +708,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private static TransitionBuilder SetupTransitionBuilder(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem)
|
||||
{
|
||||
TransitionBuilder tb = new TransitionBuilder();
|
||||
tb._FormatData = formatInfo.PlantFormat.FormatData;
|
||||
// get the format of the transition string based on this transition's index into the TransData part of
|
||||
// format....
|
||||
if (tranType >= tb._FormatData.TransData.TransTypeList.MaxIndex) // found during fixing of B2016-176 B2016-197 fixes invalid index error during import of procedure
|
||||
TransitionBuilder tb = new TransitionBuilder
|
||||
{
|
||||
_FormatData = formatInfo.PlantFormat.FormatData
|
||||
};
|
||||
// get the format of the transition string based on this transition's index into the TransData part of
|
||||
// format....
|
||||
if (tranType >= tb._FormatData.TransData.TransTypeList.MaxIndex) // found during fixing of B2016-176 B2016-197 fixes invalid index error during import of procedure
|
||||
tranType = 0;
|
||||
// Replace 3 tokens ", {.}, {.}, {.}" with a single token "{.}"
|
||||
tb._TransFormat = tb._FormatData.TransData.TransTypeList[tranType].TransFormat.Replace(", {.}, {.}, {.}", "{.}");
|
||||
@@ -873,9 +739,7 @@ namespace VEPROMS.CSLA.Library
|
||||
tb._TranType = 4;
|
||||
}
|
||||
int startIndex = 0;
|
||||
int index = -1;
|
||||
int rexIndex = -1;
|
||||
string prefix = null;
|
||||
string prefix = null;
|
||||
string prevToken = null;
|
||||
bool lastAdded = false;
|
||||
MatchCollection mc = Regex.Matches(tb._TransFormat, @"{(Proc Num|\?\.Proc Num|Proc Title|\?\.Proc Title|" +
|
||||
@@ -885,8 +749,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
string tmppref = prefix;
|
||||
prefix = null;
|
||||
rexIndex = m.Index;
|
||||
int rexEndToken = m.Index + m.Length - 1;
|
||||
int rexIndex = m.Index;
|
||||
int rexEndToken = m.Index + m.Length - 1;
|
||||
if (rexIndex > startIndex) prefix = tb._TransFormat.Substring(startIndex, rexIndex - startIndex);
|
||||
if (prefix == null) prevToken = null;
|
||||
// if the last token did not add anything to the buffer, still want to put the text prefix in:
|
||||
@@ -1007,9 +871,8 @@ namespace VEPROMS.CSLA.Library
|
||||
// as used by AEP is: UnitProcSetString ="{PSI:UNITCOM}-{SI:SETNAME}-{PSI:SETID}-"
|
||||
string findMatch = "{.*?}";
|
||||
MatchCollection ms = Regex.Matches(tb._UnitProcSetString,findMatch);
|
||||
string txt = tb._UnitProcSetString;
|
||||
FolderConfig fc = tb._ToItem.MyDocVersion.MyFolder.FolderConfig as FolderConfig;
|
||||
ProcedureConfig pc = new ProcedureConfig(tb._ToItem.MyProcedure.MyContent.Config);
|
||||
_ = tb._ToItem.MyDocVersion.MyFolder.FolderConfig as FolderConfig;
|
||||
ProcedureConfig pc = new ProcedureConfig(tb._ToItem.MyProcedure.MyContent.Config);
|
||||
// Use a dictionary to get all of the tokens from the format string, then
|
||||
// go through all dictionary entries to make the replacements.
|
||||
Dictionary<string, string> repStr = new Dictionary<string, string>();
|
||||
@@ -1094,7 +957,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
lretstr.Append(tb._FormatData.TransData.DelimiterForTransitionTitle);
|
||||
lretstr.Append(tb._FormatData.TransData.CapsTransitions ? parenstr.ToUpper().Replace(@"\U", @"\u") :
|
||||
tb._FormatData.TransData.Cap1stCharTrans ? CapFirstLetterOnly(parenstr, 0) :
|
||||
tb._FormatData.TransData.Cap1stCharTrans ? CapFirstLetterOnly(parenstr) :
|
||||
parenstr);
|
||||
lretstr.Append(tb._FormatData.TransData.DelimiterForTransitionTitle);
|
||||
}
|
||||
@@ -1170,7 +1033,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (thisTab != null && thisTab != "")
|
||||
{
|
||||
thisTab = thisTab.Trim(" ".ToCharArray());
|
||||
if (hasDelim && !thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab = thisTab + ".";
|
||||
if (hasDelim && !thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab += ".";
|
||||
if (hasDotZero && thisTab.EndsWith(".0.")) thisTab = thisTab.Substring(0, thisTab.Length - 2);
|
||||
}
|
||||
// RHM 20130326 2039 - I added the logic to limit the addition of the section tab to
|
||||
@@ -1197,7 +1060,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!hasDelim)
|
||||
foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, "");
|
||||
hlsTab = hlsTab.Trim(" ".ToCharArray());
|
||||
if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + ".";
|
||||
if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab += ".";
|
||||
if (hasDotZero)
|
||||
{
|
||||
if (item.IsHigh)
|
||||
@@ -1218,9 +1081,6 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private static bool AddPageNumber(TransitionBuilder tb)
|
||||
{
|
||||
//At some point, add a property off a section 'IsFoldout' and use the next two lines:
|
||||
//if ((myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts && mySection.MyContent.Number.ToUpper() == "FOLDOUT")
|
||||
//|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && mySection.MyContent.Text.ToUpper().Contains("FOLDOUT")))
|
||||
if (tb._ToItem.PageNumber != -1 && (tb._FromItem.PageNumber != -1 || (tb._FromItem.ActiveSection.MyConfig as SectionConfig).Section_IsFoldout == "Y")) //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box
|
||||
{
|
||||
int pgoffset = tb._ToItem.PageNumber - tb._FromItem.PageNumber;
|
||||
@@ -1255,9 +1115,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private static bool AddStepNumber(TransitionBuilder tb)
|
||||
{
|
||||
// If we're on a step put out the step number.
|
||||
ItemInfo secitm = TranGetSectionItem(tb._ToItem);
|
||||
if ((!((tb._TransUI & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) || tb._ToItem.MyContent.Type > 20000)
|
||||
// If we're on a step put out the step number.
|
||||
#pragma warning disable IDE0059 // Unnecessary assignment of a value - Kept for Debugging
|
||||
ItemInfo secitm = TranGetSectionItem(tb._ToItem);
|
||||
#pragma warning restore IDE0059 // Unnecessary assignment of a value
|
||||
if ((!((tb._TransUI & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) || tb._ToItem.MyContent.Type > 20000)
|
||||
{
|
||||
if (tb._FormatData.PrintData.SpecialCaseCalvertAlarm && tb._ToItem.IsHigh && tb._ToItem.FormatStepData.StepEditData.TypeMenu.MenuItem.ToUpper().Contains("WINDOW"))
|
||||
{
|
||||
@@ -1281,7 +1143,6 @@ namespace VEPROMS.CSLA.Library
|
||||
tb.Remove(tb.Length - 7, 7); // 7 is length of ", Step "
|
||||
tb.AppendPrefix();
|
||||
}
|
||||
//else if (tb._TranType == 4 && tb._ToItem.MoreThanOneStepSection())
|
||||
else if (tb._TranType == 4 && tb._ToItem.MoreThanOneStepSection() || tb._TranType == 5)
|
||||
{
|
||||
tb.AppendPrefix();
|
||||
@@ -1333,14 +1194,14 @@ namespace VEPROMS.CSLA.Library
|
||||
bool usedRangeAncestor = false;
|
||||
// Refresh Next Items
|
||||
tb._ToItem.RefreshNextItems();
|
||||
ItemInfo next = GetNextItem(tb._ToItem, rangeAncestors, ref usedRangeAncestor);
|
||||
ItemInfo next = GetNextItem(tb._ToItem, rangeAncestors);
|
||||
string lastTab = Tab(tb._RangeItem, tb._RangeItem.ActiveFormat.PlantFormat.FormatData.TransData.TStepNoFlag);
|
||||
while (next.ItemID != tb._RangeItem.ItemID)
|
||||
{
|
||||
string thisTab = Tab(next, tb._RangeItem.ActiveFormat.PlantFormat.FormatData.TransData.TStepNoFlag);
|
||||
if (lastTab == thisTab) break;
|
||||
tb.ReplaceToken(", " + thisTab);
|
||||
next = GetNextItem(next, rangeAncestors, ref usedRangeAncestor);
|
||||
next = GetNextItem(next, rangeAncestors);
|
||||
}
|
||||
tb._UsedRangeAncestor = usedRangeAncestor;
|
||||
return true;
|
||||
@@ -1363,7 +1224,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
private static ItemInfo GetNextItem(ItemInfo next, Dictionary<int, ItemInfo> rangeAncestors, ref bool usedRangeAncestor)
|
||||
private static ItemInfo GetNextItem(ItemInfo next, Dictionary<int, ItemInfo> rangeAncestors)
|
||||
{
|
||||
if (rangeAncestors.ContainsKey(next.ItemID))
|
||||
return rangeAncestors[next.ItemID];
|
||||
@@ -1473,15 +1334,9 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private static bool AddTranGetSectionNumber(TransitionBuilder tb)
|
||||
{
|
||||
return AddTranGetSectionNumber(tb, false);
|
||||
}
|
||||
private static bool AddTranGetAllSectionNumber(TransitionBuilder tb)
|
||||
{
|
||||
return AddTranGetSectionNumber(tb, true);
|
||||
}
|
||||
private static bool AddTranGetSectionNumber(TransitionBuilder tb, bool allLevels)
|
||||
private static bool AddTranGetSectionNumber(TransitionBuilder tb) => AddTranGetSectionNumber(tb, false);
|
||||
private static bool AddTranGetAllSectionNumber(TransitionBuilder tb) => AddTranGetSectionNumber(tb, true);
|
||||
private static bool AddTranGetSectionNumber(TransitionBuilder tb, bool allLevels)
|
||||
{
|
||||
if (tb._TranType == 1 && tb._ToItem.ActiveSection.ItemID == tb._FromItem.ActiveSection.ItemID) return false;
|
||||
if (tb.SectNumWithStepNum) return false;
|
||||
@@ -1514,13 +1369,9 @@ namespace VEPROMS.CSLA.Library
|
||||
tb.ReplaceToken(retstr);
|
||||
return (retstr != null && retstr != "");
|
||||
}
|
||||
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
|
||||
private static string TrimSectNumber(string str)
|
||||
{
|
||||
if (str == null) return str;
|
||||
return str.TrimStart();
|
||||
}
|
||||
private static string FixTitleCase(Match m)
|
||||
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
|
||||
private static string TrimSectNumber(string str) => str == null ? str : str.TrimStart();
|
||||
private static string FixTitleCase(Match m)
|
||||
{
|
||||
if (Regex.IsMatch(m.Value, @"^[A-Za-z]+\.?$"))
|
||||
{
|
||||
@@ -1533,12 +1384,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return m.Value;
|
||||
}
|
||||
private static string CapFirstLetterOnly(string retstr, int p)
|
||||
private static string CapFirstLetterOnly(string retstr)
|
||||
{
|
||||
// LATER: write code to capitalize first letter (active plants)
|
||||
// F2021-037: Support title case include '/' as separator (added '/' to regex replace)
|
||||
string lretstr = Regex.Replace(retstr, @"([^ ,/]+)", new MatchEvaluator(FixTitleCase));
|
||||
return lretstr;
|
||||
// LATER: write code to capitalize first letter (active plants)
|
||||
// F2021-037: Support title case include '/' as separator (added '/' to regex replace)
|
||||
return Regex.Replace(retstr, @"([^ ,/]+)", new MatchEvaluator(FixTitleCase));
|
||||
}
|
||||
// TODO: Section methods are not complete....
|
||||
private static ItemInfo TranGetSectionItem(ItemInfo itminfo)
|
||||
@@ -1564,7 +1414,7 @@ namespace VEPROMS.CSLA.Library
|
||||
string str1 = TranGetSectionNumber(tb._ToItem);
|
||||
// F2024-008 added flag to title case the section number in transitions
|
||||
if (tb._FormatData.TransData.Cap1stCharTransSectionNumber)
|
||||
str1 = CapFirstLetterOnly(str1, 0);
|
||||
str1 = CapFirstLetterOnly(str1);
|
||||
if(!tb._ToItem.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) return str1;
|
||||
List<ItemInfo> FromSections = GetSections(tb._FromItem.ActiveSection);
|
||||
List<ItemInfo> ToSections = GetSections(tb._ToItem.ActiveSection);
|
||||
@@ -1578,11 +1428,9 @@ namespace VEPROMS.CSLA.Library
|
||||
break;
|
||||
}
|
||||
}
|
||||
//string str = tmpitm.MyContent.Number;
|
||||
string str = BuildSectionPath(ToSections);
|
||||
// B2024-025 - process all of the applicability token (<U-xxx>, <U>, <ID>)
|
||||
str = VEPROMS.CSLA.Library.DisplayText.ResolveUnitSpecific(tb._ToItem.MyDocVersion, str);
|
||||
//if (!str.EndsWith(".") && tb._ToItem.ItemID != tb._ToItem.ActiveSection.ItemID)
|
||||
tb.StepPrefix = ".";
|
||||
tb.SectionNumberLength = str.Length;
|
||||
return (str);
|
||||
@@ -1611,11 +1459,8 @@ namespace VEPROMS.CSLA.Library
|
||||
sb.Append(sep + lastPart.TrimEnd(" ".ToCharArray()));
|
||||
return sb.ToString();
|
||||
}
|
||||
private static bool IsRoman(string number)
|
||||
{
|
||||
return Regex.IsMatch(number,@"[IVXLCDM]+\.?");
|
||||
}
|
||||
private static List<ItemInfo> GetSections(ItemInfo myItemInfo)
|
||||
private static bool IsRoman(string number) => Regex.IsMatch(number, @"[IVXLCDM]+\.?");
|
||||
private static List<ItemInfo> GetSections(ItemInfo myItemInfo)
|
||||
{
|
||||
List<ItemInfo> retval = new List<ItemInfo>();
|
||||
while (myItemInfo != null && myItemInfo.IsSection)
|
||||
@@ -1633,7 +1478,7 @@ namespace VEPROMS.CSLA.Library
|
||||
ItemInfo tmpitm = TranGetSectionItem(itminfo);
|
||||
string sectionTitle = tmpitm.MyContent.Text;
|
||||
sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") :
|
||||
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) :
|
||||
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle) :
|
||||
sectionTitle);
|
||||
// F2024-008 Added flag to surround the section title with parenthesis in transitions
|
||||
if (tb._FormatData.TransData.ParensAroundSectionTitle)
|
||||
@@ -1658,7 +1503,7 @@ namespace VEPROMS.CSLA.Library
|
||||
ItemInfo tmpitm = TranGetSectionItem(itminfo);
|
||||
string sectionTitle = tmpitm.MyContent.Text;
|
||||
sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") :
|
||||
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) :
|
||||
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle) :
|
||||
sectionTitle);
|
||||
// B2017-236 Replace embedded returns with spaces and trim the spaces from the end of the section title.
|
||||
return TrimSectionTitle(sectionTitle);
|
||||
|
||||
Reference in New Issue
Block a user