Updated code of FixTransitionText and FixContentText of the Content and ContentInfo classes to fix problem with Prerequisite Steps.

This commit is contained in:
Rich 2014-05-22 00:40:15 +00:00
parent f7806951c9
commit da6cc6ac3e
2 changed files with 22 additions and 12 deletions

View File

@ -32,7 +32,7 @@ namespace VEPROMS.CSLA.Library
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID);
foreach (Match mm in ms)
{
Match m = Regex.Match(mm.Value, lookFor, RegexOptions.Singleline);
@ -237,7 +237,7 @@ namespace VEPROMS.CSLA.Library
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>$", rousg.ROUsageID);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>$", rousg.ROUsageID);
foreach (Match mm in ms)
{
Match m = Regex.Match(mm.Value, lookFor, RegexOptions.Singleline);
@ -356,7 +356,7 @@ namespace VEPROMS.CSLA.Library
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID);
foreach (Match mm in ms)
{
Match m = Regex.Match(mm.Value, lookFor, RegexOptions.Singleline);
@ -462,11 +462,11 @@ namespace VEPROMS.CSLA.Library
public void FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo) // string newvalue)
{
string newvalue = value;
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
string findLink = @"<START\].*?\[END>";
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>$", rousg.ROUsageID);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>$", rousg.ROUsageID);
foreach (Match mm in ms)
{
int offset = mm.Index;

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 \\]+)* (.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^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--)
@ -1730,8 +1730,10 @@ namespace Volian.Controls.Library
{
if (_TextAndLink != null)
{
Match m = Regex.Match(_TextAndLink, @"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(.*?)\[END>");
return m.Groups[3].ToString();
Match m = Regex.Match(_TextAndLink, @"<START\](\\[^v \\]+)*\\v0(\\[^v'?{}~ \\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{}~ \\]+)*\\v(\\[^v \\]+)* #Link:(.*?)\[END>");
if(m.Groups[3].Value == " ")
return m.Groups[4].Value;
return m.Groups[3].Value + m.Groups[4].Value;
}
return _Text;
}
@ -1739,9 +1741,17 @@ namespace Volian.Controls.Library
{
if (_TextAndLink != null)
{
Match m = Regex.Match(_TextAndLink, @"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(.*?)\[END>");
System.Text.RegularExpressions.Group g = m.Groups[3];
_TextAndLink = _TextAndLink.Substring(0, g.Index) + value + _TextAndLink.Substring(g.Index + g.Length);
Match m = Regex.Match(_TextAndLink, @"<START\](\\[^v \\]+)*\\v0(\\[^v'?{}~ \\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{}~ \\]+)*\\v(\\[^v \\]+)* #Link:(.*?)\[END>");
int myIndex = m.Groups[4].Index;
int myLength = m.Groups[4].Length;
if (m.Groups[3].Value != " ")
{
myIndex = m.Groups[3].Index;
myLength += m.Groups[3].Length;
}
string gg = _TextAndLink.Substring(myIndex, myLength);
string newvalue = value.Replace("{", @"\{").Replace("}", @"\}");
_TextAndLink = _TextAndLink.Substring(0, myIndex) + newvalue + _TextAndLink.Substring(myIndex + myLength);
}
_Text = value;
}