Add error support if incorrect phone.lst format (writes to error log)

This commit is contained in:
Kathy Ruffing 2014-05-15 12:43:16 +00:00
parent 5023c30710
commit 50a5787b32

View File

@ -224,8 +224,11 @@ namespace Volian.Print.Library
plist = plist.Replace("\r", ""); plist = plist.Replace("\r", "");
string[] lines = plist.Split("\n".ToCharArray()); string[] lines = plist.Split("\n".ToCharArray());
DocStyle docstyle = MySection.MyDocStyle; DocStyle docstyle = MySection.MyDocStyle;
foreach (string cline in lines) try
{ {
foreach (string clinex in lines)
{
string cline = clinex.TrimEnd();
if (cline != "") if (cline != "")
{ {
// xoff handles the columns. The separator between phone items is a double space. A phone // xoff handles the columns. The separator between phone items is a double space. A phone
@ -235,6 +238,8 @@ namespace Volian.Print.Library
int endLineindx = cline.IndexOf(" "); int endLineindx = cline.IndexOf(" ");
bool endOfLine = false; bool endOfLine = false;
while (!endOfLine) while (!endOfLine)
{
if (endLineindx - stLineindx > 0)
{ {
string phone = cline.Substring(stLineindx, endLineindx - stLineindx); string phone = cline.Substring(stLineindx, endLineindx - stLineindx);
float tmp = 0; float tmp = 0;
@ -251,9 +256,17 @@ namespace Volian.Print.Library
if (endLineindx == -1) endLineindx = cline.Length; if (endLineindx == -1) endLineindx = cline.Length;
} }
} }
else
endOfLine = true;
}
lyoff = lyoff - vlnPrintObject.SixLinesPerInch; lyoff = lyoff - vlnPrintObject.SixLinesPerInch;
} }
} }
}
catch (Exception ex)
{
_MyLog.Error("Error processing phone list.", ex);
}
if (PageListLayer != null) pdfContentByte.EndLayer(); if (PageListLayer != null) pdfContentByte.EndLayer();
pdfContentByte.RestoreState(); pdfContentByte.RestoreState();
} }