Fixed how DoROAdjustments handles curly braces

Fixed how DoTransitionAdjustments handles curly braces
Fixed how SaveContents handles curly braces
This commit is contained in:
Rich
2014-05-28 02:15:00 +00:00
parent 9ee31d43fc
commit 7f7e3085ab
2 changed files with 48 additions and 22 deletions

View File

@@ -502,12 +502,12 @@ 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 \\]+)* (.*?)(\\[^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--)
{
Match m = matches[i];
if (m != null && m.Groups.Count > 6 && m.Groups[6].ToString() == "ReferencedObject")
if (m != null && m.Groups.Count > 7 && m.Groups[7].ToString() == "ReferencedObject")
{
Regex regRefObj = new Regex(@"\#Link\:ReferencedObject\:([0-9]*) ([0-9a-zA-Z]*) ([0-9]*)", RegexOptions.Singleline);
Match myMatch = regRefObj.Match(m.Value);
@@ -517,7 +517,7 @@ namespace Volian.Controls.Library
RtfRoUsageList.Add(usgid);
}
}
if (m != null && m.Groups.Count > 6 && m.Groups[6].ToString().StartsWith("Transition"))
if (m != null && m.Groups.Count > 7 && m.Groups[7].ToString().StartsWith("Transition"))
{
Regex regRefObj = new Regex(@"\#Link\:Transition[a-zA-Z]*\:([0-9]*) ([0-9]*) ([0-9]*)", RegexOptions.Singleline);
Match myMatch = regRefObj.Match(m.Value);
@@ -525,7 +525,15 @@ namespace Volian.Controls.Library
{
int tid = int.Parse(myMatch.Groups[2].Value);
RtfTransList.Add(tid);
if (m.Groups[3].Value.Contains("(Page ~)")) RtfTransPageNumList.Add(tid);
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 = ((string)MyFlexGrid[r, c]).Substring(myIndex, myLength);
if (gg.Contains("(Page ~)")) RtfTransPageNumList.Add(tid);
}
}
}