From da6cc6ac3ed5424408ab5374cca1a348b40c79d6 Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 22 May 2014 00:40:15 +0000 Subject: [PATCH] Updated code of FixTransitionText and FixContentText of the Content and ContentInfo classes to fix problem with Prerequisite Steps. --- .../Extension/ContentExt.cs | 12 +++++----- PROMS/Volian.Controls.Library/DisplayText.cs | 22 ++++++++++++++----- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs index 7b9d0280..0c3aa652 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs @@ -32,7 +32,7 @@ namespace VEPROMS.CSLA.Library string findLink = @""; MatchCollection ms = Regex.Matches(Text, findLink); //string lookFor = string.Format(@"", rousg.ROUsageID); - string lookFor = string.Format(@"^", tran.TranType, tran.TransitionID); + string lookFor = string.Format(@"^", 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 = @""; MatchCollection ms = Regex.Matches(Text, findLink); //string lookFor = string.Format(@"", rousg.ROUsageID); - string lookFor = string.Format(@"^$", rousg.ROUsageID); + string lookFor = string.Format(@"^$", 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 = @""; MatchCollection ms = Regex.Matches(Text, findLink); //string lookFor = string.Format(@"", rousg.ROUsageID); - string lookFor = string.Format(@"^", tran.TranType, tran.TransitionID); + string lookFor = string.Format(@"^", 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 = @""; + newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}"); + string findLink = @""; MatchCollection ms = Regex.Matches(Text, findLink); //string lookFor = string.Format(@"", rousg.ROUsageID); - string lookFor = string.Format(@"^$", rousg.ROUsageID); + string lookFor = string.Format(@"^$", rousg.ROUsageID); foreach (Match mm in ms) { int offset = mm.Index; diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index f6b2739b..5d85d19b 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -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(@""); + string lookFor = string.Format(@""); 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, @""); - return m.Groups[3].ToString(); + Match m = Regex.Match(_TextAndLink, @""); + 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, @""); - 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, @""); + 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; }