Fixed logic to process ROs and Transitions containing curly braces

This commit is contained in:
Rich 2014-05-28 17:45:44 +00:00
parent 7f7e3085ab
commit ee2ff97295
2 changed files with 3 additions and 5 deletions

View File

@ -408,7 +408,7 @@ namespace Volian.Controls.Library
// (\\[^v' \\]+)* --> look for rtf commands but exclude \' before the \v
// \\v(\\[^v \\]+)* --> look for rtf commands after the \v
// if it turns out that if ro's have any embedded unicode characters this needs expanded, such as /u8209? (hard hyphen)
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v '?{{}}~\\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
MatchCollection matches = Regex.Matches(text, lookFor);
string prevValue = null;
for (int i = matches.Count - 1; i >= 0; i--)
@ -445,7 +445,6 @@ namespace Volian.Controls.Library
if (!_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.AllUnits) prevValue = newvalue;
newvalue = DoROReplaceWords(_MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList, newvalue, _MyItemInfo.IsHigh);
if (isSetpoint) newvalue = ReplaceSpaceWithHardspace(newvalue);
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
if (gg != newvalue)
text = text.Substring(0, myIndex) + newvalue + text.Substring(myIndex + myLength);
}
@ -502,7 +501,7 @@ namespace Volian.Controls.Library
{
bool undtran = _MyItemInfo.ActiveFormat.PlantFormat.FormatData.TransData.Underline;
string strippedText = StaticStripRtfCommands(text);
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v \\u]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):[0-9]* ([0-9]*).*?\[END>");
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v'?{{}}~ \\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):[0-9]* ([0-9]*).*?\[END>");
MatchCollection matches = Regex.Matches(text, lookFor);
if (matches.Count == 0) return text;
string retstr = text;
@ -525,7 +524,6 @@ namespace Volian.Controls.Library
myLength += m.Groups[3].Length;
}
string newvalue = text.Substring(myIndex, myLength);
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
//System.Text.RegularExpressions.Group g = m.Groups[3];
string beforeTran = retstr.Substring(0, myIndex);
string afterTran = retstr.Substring(myIndex + myLength);

View File

@ -502,7 +502,7 @@ namespace Volian.Controls.Library
{
// see if there are any links and save these so that any deleted ROs or transitions in the
// steprtb can have associated usages/transitions records removed from the database.
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v '?{{}}~\\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
MatchCollection matches = Regex.Matches((string)MyFlexGrid[r, c], lookFor);
for (int i = matches.Count - 1; i >= 0; i--)
{