Fixed logic to process ROs and Transitions containing curly braces
This commit is contained in:
parent
7f7e3085ab
commit
ee2ff97295
@ -408,7 +408,7 @@ namespace Volian.Controls.Library
|
|||||||
// (\\[^v' \\]+)* --> look for rtf commands but exclude \' before the \v
|
// (\\[^v' \\]+)* --> look for rtf commands but exclude \' before the \v
|
||||||
// \\v(\\[^v \\]+)* --> look for rtf commands after 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)
|
// 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);
|
MatchCollection matches = Regex.Matches(text, lookFor);
|
||||||
string prevValue = null;
|
string prevValue = null;
|
||||||
for (int i = matches.Count - 1; i >= 0; i--)
|
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;
|
if (!_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.AllUnits) prevValue = newvalue;
|
||||||
newvalue = DoROReplaceWords(_MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList, newvalue, _MyItemInfo.IsHigh);
|
newvalue = DoROReplaceWords(_MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList, newvalue, _MyItemInfo.IsHigh);
|
||||||
if (isSetpoint) newvalue = ReplaceSpaceWithHardspace(newvalue);
|
if (isSetpoint) newvalue = ReplaceSpaceWithHardspace(newvalue);
|
||||||
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
|
|
||||||
if (gg != newvalue)
|
if (gg != newvalue)
|
||||||
text = text.Substring(0, myIndex) + newvalue + text.Substring(myIndex + myLength);
|
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;
|
bool undtran = _MyItemInfo.ActiveFormat.PlantFormat.FormatData.TransData.Underline;
|
||||||
string strippedText = StaticStripRtfCommands(text);
|
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);
|
MatchCollection matches = Regex.Matches(text, lookFor);
|
||||||
if (matches.Count == 0) return text;
|
if (matches.Count == 0) return text;
|
||||||
string retstr = text;
|
string retstr = text;
|
||||||
@ -525,7 +524,6 @@ namespace Volian.Controls.Library
|
|||||||
myLength += m.Groups[3].Length;
|
myLength += m.Groups[3].Length;
|
||||||
}
|
}
|
||||||
string newvalue = text.Substring(myIndex, myLength);
|
string newvalue = text.Substring(myIndex, myLength);
|
||||||
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
|
|
||||||
//System.Text.RegularExpressions.Group g = m.Groups[3];
|
//System.Text.RegularExpressions.Group g = m.Groups[3];
|
||||||
string beforeTran = retstr.Substring(0, myIndex);
|
string beforeTran = retstr.Substring(0, myIndex);
|
||||||
string afterTran = retstr.Substring(myIndex + myLength);
|
string afterTran = retstr.Substring(myIndex + myLength);
|
||||||
|
@ -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
|
// 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.
|
// 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);
|
MatchCollection matches = Regex.Matches((string)MyFlexGrid[r, c], lookFor);
|
||||||
for (int i = matches.Count - 1; i >= 0; i--)
|
for (int i = matches.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user