C2025-022-Remove-UCF-2
This commit is contained in:
@@ -273,8 +273,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion ReplaceStrData
|
||||
#region ReplaceStr
|
||||
//[Flags]
|
||||
//public enum
|
||||
//: uint
|
||||
//public enum E_ReplaceFlags : uint
|
||||
//{
|
||||
// High = 0x0001, // Do ReplaceWords in HIGH LEVEL STEPS
|
||||
// RNO = 0x0002, // Do ReplaceWords in RNOS
|
||||
@@ -320,15 +319,15 @@ namespace VEPROMS.CSLA.Library
|
||||
get { return _State; }
|
||||
set { _State = value; }
|
||||
}
|
||||
private E_ReplaceFlagsUCF _Flag;
|
||||
[Editor(typeof(FlagEnumUIEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
||||
[XmlAttribute("Flag")]
|
||||
[DisplayName("Flags (Use In)")] // Note that [Description] is not used in collection items (that use collection editor)
|
||||
public E_ReplaceFlagsUCF Flag
|
||||
{
|
||||
get { return (E_ReplaceFlagsUCF)_Flag; }
|
||||
set { _Flag = value; }
|
||||
}
|
||||
//private E_ReplaceFlags _Flag;
|
||||
//[Editor(typeof(FlagEnumUIEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
||||
//[XmlAttribute("Flag")]
|
||||
//[DisplayName("Flags (Use In)")] // Note that [Description] is not used in collection items (that use collection editor)
|
||||
//public E_ReplaceFlags Flag
|
||||
//{
|
||||
// get { return (E_ReplaceFlags)_Flag; }
|
||||
// set { _Flag = value; }
|
||||
//}
|
||||
private string _ReplaceWord;
|
||||
[XmlAttribute("ReplaceWord")]
|
||||
[DisplayName("Replace Word")]
|
||||
|
@@ -1756,88 +1756,6 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
|
||||
|
||||
//#region UCF Clear Overwridden Formats
|
||||
//private class ClearOverrideFormatsByFolderCriteria
|
||||
//{
|
||||
// public ClearOverrideFormatsByFolderCriteria(int folderID, int? formatID, int? newformatID)
|
||||
// {
|
||||
// _FormatID = formatID;
|
||||
// _FolderID = folderID;
|
||||
// _NewFormatID = newformatID;
|
||||
// }
|
||||
// private int? _FormatID;
|
||||
// public int? FormatID
|
||||
// {
|
||||
// get { return _FormatID; }
|
||||
// set { _FormatID = value; }
|
||||
// }
|
||||
// private int? _NewFormatID;
|
||||
// public int? NewFormatID
|
||||
// {
|
||||
// get { return _NewFormatID; }
|
||||
// set { _NewFormatID = value; }
|
||||
// }
|
||||
// private int _FolderID;
|
||||
// public int FolderID
|
||||
// {
|
||||
// get { return _FolderID; }
|
||||
// set { _FolderID = value; }
|
||||
// }
|
||||
//}
|
||||
|
||||
//private void DataPortal_Fetch(ClearOverrideFormatsByFolderCriteria criteria)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
// {
|
||||
// using (SqlCommand cm = cn.CreateCommand())
|
||||
// {
|
||||
// cm.CommandType = CommandType.StoredProcedure;
|
||||
// cm.CommandText = "vesp_ClearOverrideFormatsByFolder";
|
||||
// cm.Parameters.AddWithValue("@FolderID", criteria.FolderID);
|
||||
// if (criteria.FormatID == null)
|
||||
// cm.Parameters.AddWithValue("@FormatID", DBNull.Value);
|
||||
// else
|
||||
// cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
|
||||
// if (criteria.NewFormatID == null)
|
||||
// cm.Parameters.AddWithValue("@NewFormatID", DBNull.Value);
|
||||
// else
|
||||
// cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
|
||||
// cm.CommandTimeout = Database.DefaultTimeout;
|
||||
// using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
// {
|
||||
// IsReadOnly = false;
|
||||
// while (dr.Read())
|
||||
// {
|
||||
// ContentInfo contentInfo = new ContentInfo(dr);
|
||||
// this.Add(contentInfo);
|
||||
// }
|
||||
// IsReadOnly = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Database.LogException("ClearOverrideFormatsByFolderCriteria.DataPortal_Fetch", ex);
|
||||
// throw new DbCslaException("ClearOverrideFormatsByFolderCriteria.DataPortal_Fetch", ex);
|
||||
// }
|
||||
//}
|
||||
|
||||
//public static ContentInfoList ClearOverrideFormatsByFolder(int folderID, int? formatID, int? newformatID)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ClearOverrideFormatsByFolderCriteria(folderID, formatID, newformatID));
|
||||
// return tmp;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// throw new DbCslaException("Error on ContentInfoList.ClearOverrideFormatsByFolder", ex);
|
||||
// }
|
||||
//}
|
||||
|
||||
private class ClearOverrideFormatsByDocVersionCriteria
|
||||
{
|
||||
public ClearOverrideFormatsByDocVersionCriteria(string dvlist, int? formatID, int? newformatID)
|
||||
|
@@ -2153,7 +2153,7 @@ namespace VEPROMS.CSLA.Library
|
||||
// return Text;
|
||||
//}
|
||||
#endregion
|
||||
private static Dictionary<FormatConfig.ReplaceStr, Regex> dicReplaceRegex = new Dictionary<FormatConfig.ReplaceStr, Regex>();
|
||||
private static Dictionary<ReplaceStr, Regex> dicReplaceRegex = new Dictionary<ReplaceStr, Regex>();
|
||||
private static bool? _ProcessReplaceWords;
|
||||
public static bool ProcessReplaceWords
|
||||
{
|
||||
@@ -2178,7 +2178,8 @@ namespace VEPROMS.CSLA.Library
|
||||
// F2021-053: BNPP Alarm - need ability to have super/sub scripts in the text of Alarm Tables (ROs).
|
||||
// if doing replace words for Page List items, the current item is not a step, use _DoReplWordInPageList flags this
|
||||
if (_MyItemInfo.MyContent.Type < 20000 && !_DoReplWordInPageList) return Text; // for now only replace in steps.
|
||||
FormatConfig.ReplaceStrData rsl = _MyFormat.PlantFormat.UCFandOrigReplaceStrData;
|
||||
//FormatConfig.ReplaceStrData rsl = _MyFormat.PlantFormat.FormatConfig.UCFandReplaceStrData;
|
||||
ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList;
|
||||
if (rsl.Count == 1 && (rsl[0].ReplaceWord == null || rsl[0].ReplaceWord == "")) return Text;
|
||||
|
||||
// F2021-093: Handle partials first and then plain replace words. Need to do this so that the words don't get processed by plain replace
|
||||
@@ -2193,15 +2194,16 @@ namespace VEPROMS.CSLA.Library
|
||||
// Loop through text looking for words to be replaced
|
||||
Dictionary<E_ReplaceFlags?, bool> shouldReplace = new Dictionary<E_ReplaceFlags?, bool>();
|
||||
//int profileDepth = ProfileTimer.Push(">>>> DoReplaceWords2.ForLoop");
|
||||
foreach (FormatConfig.ReplaceStr rs in rsl)
|
||||
foreach (ReplaceStr rs in rsl)
|
||||
{
|
||||
bool dopartial = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.Partials;
|
||||
if (!dopartial) // F2021-093: Partials moved into their own method and done first
|
||||
//bool dopartial = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.Partials; // save it may need to be changed back to this code.
|
||||
bool dopartial = (rs.Flag & E_ReplaceFlags.Partials) == E_ReplaceFlags.Partials; // from pre-UCF
|
||||
if (!dopartial) // F2021-093: Partials moved into their own method and done first
|
||||
{
|
||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.BeforeList; // C2021-045
|
||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.PageList; // B2021-132
|
||||
//B2021-132 only do replacewords in paglist if the replaceword pagelist flag is set
|
||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.BeforeList) == E_ReplaceFlags.BeforeList; // C2021-045, C2025-022 remove UFC
|
||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.FirstWord) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.PageList) == E_ReplaceFlags.PageList; // B2021-132
|
||||
//B2021-132 only do replacewords in paglist if the replaceword pagelist flag is set
|
||||
if (_DoReplWordInPageList && !doInPagelist) continue;
|
||||
|
||||
// note that the order of this check is important. Check in this order...
|
||||
@@ -2228,7 +2230,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (!dicReplaceRegex.ContainsKey(rs))
|
||||
{
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
//RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
//RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
//int profileDepth3 = ProfileTimer.Push(">>>> DoReplaceWords2.BuildMatch");
|
||||
// CASEINSENS: Do ReplaceWords for all words that match, regardless of case, and replace with the ReplaceWith string as is
|
||||
//RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase & RegexOptions.Singleline : RegexOptions.None & RegexOptions.Singleline;
|
||||
@@ -2268,18 +2272,18 @@ namespace VEPROMS.CSLA.Library
|
||||
// F2021-093: separate out partial replace words so that they can all be done before normal replace words. Partials read in the 'repword', use
|
||||
// it as-is as a dotnet regular expression to do replacement. Aside from the dotnet regular expression process, the rest of this
|
||||
// code is similar to plain regular expressions, in terms of processing flags for which steps, etc.
|
||||
private string DoReplacePartials(string Text, FormatConfig.ReplaceStrData rsl)
|
||||
private string DoReplacePartials(string Text, ReplaceStrList rsl)
|
||||
{
|
||||
Dictionary<FormatConfig.ReplaceStr, Regex> partialReplaceList = new Dictionary<FormatConfig.ReplaceStr, Regex>();
|
||||
Dictionary<ReplaceStr, Regex> partialReplaceList = new Dictionary<ReplaceStr, Regex>();
|
||||
Dictionary<E_ReplaceFlags?, bool> shouldReplace = new Dictionary<E_ReplaceFlags?, bool>();
|
||||
foreach (FormatConfig.ReplaceStr rs in rsl)
|
||||
foreach (ReplaceStr rs in rsl)
|
||||
{
|
||||
bool dopartial = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.Partials;
|
||||
bool dopartial = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.Partials) == E_ReplaceFlags.Partials;
|
||||
if (dopartial)
|
||||
{
|
||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.BeforeList; // C2021-045
|
||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.BeforeList) == E_ReplaceFlags.BeforeList; // C2021-045
|
||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.PageList; // B2021-132
|
||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.PageList) == E_ReplaceFlags.PageList; // B2021-132
|
||||
//B2021-132 only do replacewords in paglist if the replaceword pagelist flag is set
|
||||
if (_DoReplWordInPageList && !doInPagelist) continue;
|
||||
|
||||
@@ -2304,7 +2308,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (!dicReplaceRegex.ContainsKey(rs))
|
||||
{
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
dicReplaceRegex.Add(rs, new Regex(rs.ReplaceWord, myOptions));
|
||||
}
|
||||
try
|
||||
@@ -2320,7 +2324,7 @@ namespace VEPROMS.CSLA.Library
|
||||
Text = Text.Replace(@"\xA0", @"\u160?"); //replace hard space
|
||||
try
|
||||
{
|
||||
foreach (FormatConfig.ReplaceStr prs in partialReplaceList.Keys)
|
||||
foreach (ReplaceStr prs in partialReplaceList.Keys)
|
||||
Text = partialReplaceList[prs].Replace(Text, prs.ReplaceWith);
|
||||
//if (partialReplaceList.Count>0) GC.Collect(); // microsoft had a memory leak in regular expression code - this REALLY slows it down though
|
||||
}
|
||||
@@ -2486,7 +2490,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_Font = font;
|
||||
_MyItemInfo = myItemInfo;
|
||||
}
|
||||
public void Add(Regex myRegEx, FormatConfig.ReplaceStr myWord)
|
||||
public void Add(Regex myRegEx, ReplaceStr myWord)
|
||||
{
|
||||
MatchCollection myMatches = myRegEx.Matches(_Text);
|
||||
foreach (Match myMatch in myMatches)
|
||||
@@ -2529,7 +2533,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void Add(Match myMatch, FormatConfig.ReplaceStr myWord)
|
||||
public void Add(Match myMatch, ReplaceStr myWord)
|
||||
{
|
||||
// If one already exists for this location, then don't add another.
|
||||
if (ContainsKey(myMatch.Index)) return;
|
||||
@@ -2563,12 +2567,12 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
// B2022-015 BNPPalr: Determine whether RO text should have Replace Words applied. InLinkAndNotInRoFlag checks
|
||||
// for flag on replace word item & checks that it is within and RO link
|
||||
bool InLinkAndNotInRoFlag = ((foundMatch.MyWord.Flag) != 0) ? VerifyWithinLink(text, foundMatch, offset) : false;
|
||||
bool InLinkAndNotInRoFlag = ((foundMatch.MyWord.Flag & E_ReplaceFlags.NotInRO) != 0) ? VerifyWithinLink(text, foundMatch, offset) : false;
|
||||
if (!InLinkAndNotInRoFlag && VerifyNoHardSpace(text, foundMatch, offset) && VerifyNoLink(text, foundMatch, offset))
|
||||
{
|
||||
//if(offset != 0 || foundMatch.MyMatch.Index != 0 || !foundMatch.MyWord.ReplaceWith.StartsWith(@"{\par}"))
|
||||
//{
|
||||
if (((foundMatch.MyWord.Flag) == 0) || DiffUnit(foundMatch.MyWord.ReplaceWord, _MyItemInfo, "UNIT "))
|
||||
if (((foundMatch.MyWord.Flag & E_ReplaceFlags.DiffUnit) == 0) || DiffUnit(foundMatch.MyWord.ReplaceWord, _MyItemInfo, "UNIT "))
|
||||
{
|
||||
string with = foundMatch.MyWord.ReplaceWith;
|
||||
if (offset == 0 && with.StartsWith(@"{\par}"))
|
||||
@@ -2723,13 +2727,13 @@ namespace VEPROMS.CSLA.Library
|
||||
get { return _MyMatch; }
|
||||
set { _MyMatch = value; }
|
||||
}
|
||||
private FormatConfig.ReplaceStr _MyWord;
|
||||
public FormatConfig.ReplaceStr MyWord
|
||||
private ReplaceStr _MyWord;
|
||||
public ReplaceStr MyWord
|
||||
{
|
||||
get { return _MyWord; }
|
||||
set { _MyWord = value; }
|
||||
}
|
||||
public FoundMatch(Match myMatch, FormatConfig.ReplaceStr myWord)
|
||||
public FoundMatch(Match myMatch, ReplaceStr myWord)
|
||||
{
|
||||
_MyMatch = myMatch;
|
||||
_MyWord = myWord;
|
||||
|
@@ -594,70 +594,7 @@ public partial class FormatInfo : IFormatOrFormatInfo
|
||||
throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
// Get format data, but do not resolve the 'Data' and 'Genmac' fields, i.e. keep empty if they are
|
||||
// empty.
|
||||
//public static FormatInfo GetFormatNoUCFByFormatID(int formatID)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// FormatInfo tmp = DataPortal.Fetch<FormatInfo>(new FormatIDNoUCFCriteria(formatID));
|
||||
// if (tmp.ErrorMessage == "No Record Found")
|
||||
// {
|
||||
// tmp.Dispose(); // Clean-up FormatInfo
|
||||
// tmp = null;
|
||||
// }
|
||||
// return tmp;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// throw new DbCslaException("Error on FormatInfo.GetFormatNoUCFByFormatID", ex);
|
||||
// }
|
||||
//}
|
||||
//protected class FormatIDNoUCFCriteria
|
||||
//{
|
||||
// private int _FormatID;
|
||||
// public int FormatID { get { return _FormatID; } }
|
||||
// public FormatIDNoUCFCriteria(int formatID)
|
||||
// {
|
||||
// _FormatID = formatID;
|
||||
// }
|
||||
//}
|
||||
//private void DataPortal_Fetch(FormatIDNoUCFCriteria criteria)
|
||||
//{
|
||||
// if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.DataPortal_Fetch", GetHashCode());
|
||||
// try
|
||||
// {
|
||||
// using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
// {
|
||||
// ApplicationContext.LocalContext["cn"] = cn;
|
||||
// using (SqlCommand cm = cn.CreateCommand())
|
||||
// {
|
||||
// cm.CommandType = CommandType.StoredProcedure;
|
||||
// cm.CommandText = "getFormatNoUCF";
|
||||
// cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
|
||||
// cm.CommandTimeout = Database.DefaultTimeout;
|
||||
// using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
// {
|
||||
// if (!dr.Read())
|
||||
// {
|
||||
// _ErrorMessage = "No Record Found";
|
||||
// return;
|
||||
// }
|
||||
// ReadData(dr);
|
||||
// }
|
||||
// }
|
||||
// // removing of item only needed for local data portal
|
||||
// if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||
// ApplicationContext.LocalContext.Remove("cn");
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatInfo.DataPortal_Fetch", ex);
|
||||
// _ErrorMessage = ex.Message;
|
||||
// throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
|
||||
// }
|
||||
//}
|
||||
|
||||
#region PlantFormat
|
||||
[NonSerialized]
|
||||
private PlantFormat _PlantFormat;
|
||||
|
@@ -249,13 +249,5 @@ namespace VEPROMS.CSLA.Library
|
||||
SupInfoPdfPrint = 2,
|
||||
Merge = 3
|
||||
}
|
||||
public enum E_UCFImportOptions : uint
|
||||
{
|
||||
Ignore = 0,
|
||||
LoadNotUsed = 1,
|
||||
LoadOnlyImported = 2,
|
||||
LoadUseAll = 3,
|
||||
LoadForSetOnly = 4
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@@ -126,72 +126,76 @@ namespace VEPROMS.CSLA.Library
|
||||
XmlNodeList nl = XmlDoc.SelectNodes(xpath);
|
||||
return nl.Count > 0;
|
||||
}
|
||||
private FormatConfig.ReplaceStrData _UCFandOrigReplaceStrData = null;
|
||||
// This will return a complete list of ReplaceWords, combining those in the original plant format
|
||||
// with the ones added by the user via User Control of Format (UCF)
|
||||
public FormatConfig.ReplaceStrData UCFandOrigReplaceStrData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_UCFandOrigReplaceStrData != null) return _UCFandOrigReplaceStrData;
|
||||
_UCFandOrigReplaceStrData = GetMergedReplaceList(this);
|
||||
return _UCFandOrigReplaceStrData;
|
||||
}
|
||||
}
|
||||
private FormatConfig.ReplaceStrData GetMergedReplaceList(PlantFormat OriginalPlantFormat)
|
||||
{
|
||||
// need to compare the original format list with the list as it is stored for working with property grid.
|
||||
FormatConfig.ReplaceStrData retlist = new FormatConfig.ReplaceStrData(); // merged list
|
||||
List<string> inoriglist = new List<string>(); // use this list to find new items in formatconfig (see below)
|
||||
foreach (ReplaceStr origrepstr in OriginalPlantFormat.FormatData.SectData.ReplaceStrList)
|
||||
{
|
||||
// In the format config list (UCF), find the 'ReplaceWord'. This is the 'key' for defining whether the
|
||||
// replace word has been overwridden by UCF data. If it exists, use it:
|
||||
FormatConfig.ReplaceStr usethisone = null;
|
||||
bool deleted = false;
|
||||
// States for replacewords: 0 = no change, -1 deleted, 1 added, 2 modified
|
||||
if (FormatConfig != null)
|
||||
{
|
||||
foreach (FormatConfig.ReplaceStr ucfrepstr in FormatConfig.PlantFormat.FormatData.ReplaceStrData)
|
||||
{
|
||||
if (ucfrepstr.ReplaceWord == origrepstr.ReplaceWord)
|
||||
{
|
||||
if (ucfrepstr.State == -1) deleted = true;
|
||||
else usethisone = ucfrepstr;
|
||||
ucfrepstr.State = 2;
|
||||
inoriglist.Add(origrepstr.ReplaceWord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!deleted && usethisone == null)
|
||||
{
|
||||
usethisone = new FormatConfig.ReplaceStr();
|
||||
usethisone.Flag = (FormatConfig.E_ReplaceFlagsUCF)origrepstr.Flag;
|
||||
usethisone.State = 0; // no change
|
||||
usethisone.ReplaceWith = origrepstr.ReplaceWith;
|
||||
usethisone.ReplaceWord = origrepstr.ReplaceWord;
|
||||
}
|
||||
if (!deleted) retlist.Add(usethisone);
|
||||
}
|
||||
// now add in any ucf only replacements, any that are not in the inoriglist
|
||||
if (FormatConfig != null)
|
||||
{
|
||||
foreach (FormatConfig.ReplaceStr ucfrepstr in FormatConfig.PlantFormat.FormatData.ReplaceStrData)
|
||||
{
|
||||
if (!inoriglist.Contains(ucfrepstr.ReplaceWord))
|
||||
{
|
||||
FormatConfig.ReplaceStr newone = new FormatConfig.ReplaceStr();
|
||||
newone.Flag = (FormatConfig.E_ReplaceFlagsUCF)ucfrepstr.Flag;
|
||||
newone.State = 1;
|
||||
newone.ReplaceWith = ucfrepstr.ReplaceWith;
|
||||
newone.ReplaceWord = ucfrepstr.ReplaceWord;
|
||||
retlist.Add(newone);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (retlist);
|
||||
}
|
||||
//private FormatConfig.ReplaceStrData _UCFandOrigReplaceStrData = null;
|
||||
//// This will return a complete list of ReplaceWords, combining those in the original plant format
|
||||
//// with the ones added by the user via User Control of Format (UCF)
|
||||
//public ReplaceStrData UCFandOrigReplaceStrData
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (_UCFandOrigReplaceStrData != null) return _UCFandOrigReplaceStrData;
|
||||
// _UCFandOrigReplaceStrData = GetMergedReplaceList(this);
|
||||
// return _UCFandOrigReplaceStrData;
|
||||
// }
|
||||
//}
|
||||
//private FormatConfig.ReplaceStrData GetMergedReplaceList(PlantFormat OriginalPlantFormat)
|
||||
//{
|
||||
// need to compare the original format list with the list as it is stored for working with property grid.
|
||||
// FormatConfig.ReplaceStrData retlist = new FormatConfig.ReplaceStrData(); // merged list
|
||||
// List<string> inoriglist = new List<string>(); // use this list to find new items in formatconfig (see below)
|
||||
// foreach (ReplaceStr origrepstr in OriginalPlantFormat.FormatData.SectData.ReplaceStrList)
|
||||
// {
|
||||
// In the format config list(UCF), find the 'ReplaceWord'.This is the 'key' for defining whether the
|
||||
|
||||
// replace word has been overwridden by UCF data.If it exists, use it:
|
||||
|
||||
// ReplaceStr usethisone = null;
|
||||
// bool deleted = false;
|
||||
// States for replacewords: 0 = no change, -1 deleted, 1 added, 2 modified
|
||||
|
||||
// if (FormatConfig != null)
|
||||
// {
|
||||
// foreach (ReplaceStr ucfrepstr in FormatConfig.PlantFormat.FormatData.ReplaceStrData)
|
||||
// {
|
||||
// if (ucfrepstr.ReplaceWord == origrepstr.ReplaceWord)
|
||||
// {
|
||||
// if (ucfrepstr.State == -1) deleted = true;
|
||||
// else usethisone = ucfrepstr;
|
||||
// ucfrepstr.State = 2;
|
||||
// inoriglist.Add(origrepstr.ReplaceWord);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (!deleted && usethisone == null)
|
||||
// {
|
||||
// usethisone = new ReplaceStr();
|
||||
// usethisone.Flag = (E_ReplaceFlags)origrepstr.Flag;
|
||||
// usethisone.State = 0; // no change
|
||||
// usethisone.ReplaceWith = origrepstr.ReplaceWith;
|
||||
// usethisone.ReplaceWord = origrepstr.ReplaceWord;
|
||||
// }
|
||||
// if (!deleted) retlist.Add(usethisone);
|
||||
// }
|
||||
// now add in any ucf only replacements, any that are not in the inoriglist
|
||||
|
||||
// if (FormatConfig != null)
|
||||
// {
|
||||
// foreach (ReplaceStr ucfrepstr in PlantFormat.FormatData.ReplaceStrData)
|
||||
// {
|
||||
// if (!inoriglist.Contains(ucfrepstr.ReplaceWord))
|
||||
// {
|
||||
// ReplaceStr newone = new ReplaceStr();
|
||||
// newone.Flag = (E_ReplaceFlags)ucfrepstr.Flag;
|
||||
// newone.State = 1;
|
||||
// newone.ReplaceWith = ucfrepstr.ReplaceWith;
|
||||
// newone.ReplaceWord = ucfrepstr.ReplaceWord;
|
||||
// retlist.Add(newone);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return (retlist);
|
||||
//}
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
// EPFormatFiles contains which Electronic Procedure Format files apply to this main format file.
|
||||
|
Reference in New Issue
Block a user