B2018-046 - Fix code so that duplicate ROs will not cause problems when they are converted to text during import.

This commit is contained in:
Rich 2018-03-14 15:23:23 +00:00
parent f9ef66880b
commit c10da98204

View File

@ -3270,6 +3270,11 @@ namespace VEPROMS
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>$", rousageid);
int lastIndex = 0;
string newText = content.Text;
// B2018-046 This loop repeats code to convert duplicate ROs in text to text
int originalCount = 0;
while (ms.Count > 0 && (originalCount == 0 || ms.Count < originalCount))
{
originalCount = ms.Count;
foreach (Match mm in ms)
{
int offset = mm.Index;
@ -3303,9 +3308,12 @@ namespace VEPROMS
content.Text = part1 + part2 + part3;
ROToTextAnnotation(content, part2); // B2016-225 (follow through) add annotation when RO is converted to text
_DidProcessROs = true; // B2017-076 flag that ROs where processed
break; // B2018-046 If it finds a match try again
}
lastIndex = mm.Index + mm.Length;
}
ms = Regex.Matches(content.Text, findLink); // B2018-046 Look for match again
}
}
content.Save();
}