Added a check for a Figure substep type without an RO reference

This commit is contained in:
John Jenko 2016-05-13 19:00:58 +00:00
parent 5942d14798
commit cd523e12a6

View File

@ -3281,28 +3281,31 @@ namespace Volian.Print.Library
string linkInfoText = itemInfo.MyContent.Text.Replace(@"\v ", "");
Match m = Regex.Match(linkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)");
string val = null;
if (m.Groups.Count < 4)
if (m.Length > 0) // if m.lengh is zero, then no match was found - no RO was entered in the figure substep
{
//erMsg = "RO was not found during data migration.";
// added newlines in the RO number (shown in figure substep type with figure RO)
// if we are here, then there is no RO link information, use this number to find the RO image to print
val = string.Format("{0}\n{1}\n{2}\n{3}",
linkInfoText.Substring(0, linkInfoText.Length - 16),
linkInfoText.Substring(linkInfoText.Length - 16, 8),
linkInfoText.Substring(linkInfoText.Length - 8, 4),
linkInfoText.Substring(linkInfoText.Length - 4, 4));
val = val.Replace(@"\u8209?", "-");
}
else
{
string[] subs = m.Groups[3].Value.Split(" ".ToCharArray());
val = lookup.GetRoValue(subs[1]);
if (val == null || val == "?") val = lookup.GetRoValue(subs[1].Substring(0, 12));
if (val == "?")
if (m.Groups.Count < 4)
{
erMsg = string.Format("Referenced Object does not exist.");
_MyLog.WarnFormat("\r\nMissing Referenced Object {0} in {1}", subs[1], itemInfo.ShortPath);
yoff += 2 * SixLinesPerInch;
//erMsg = "RO was not found during data migration.";
// added newlines in the RO number (shown in figure substep type with figure RO)
// if we are here, then there is no RO link information, use this number to find the RO image to print
val = string.Format("{0}\n{1}\n{2}\n{3}",
linkInfoText.Substring(0, linkInfoText.Length - 16),
linkInfoText.Substring(linkInfoText.Length - 16, 8),
linkInfoText.Substring(linkInfoText.Length - 8, 4),
linkInfoText.Substring(linkInfoText.Length - 4, 4));
val = val.Replace(@"\u8209?", "-");
}
else
{
string[] subs = m.Groups[3].Value.Split(" ".ToCharArray());
val = lookup.GetRoValue(subs[1]);
if (val == null || val == "?") val = lookup.GetRoValue(subs[1].Substring(0, 12));
if (val == "?")
{
erMsg = string.Format("Referenced Object does not exist.");
_MyLog.WarnFormat("\r\nMissing Referenced Object {0} in {1}", subs[1], itemInfo.ShortPath);
yoff += 2 * SixLinesPerInch;
}
}
}
GC.Collect(); // memory garbage collection (Regex memory bug)