Add error support if incorrect phone.lst format (writes to error log)
This commit is contained in:
		@@ -224,36 +224,49 @@ 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
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if (cline != "")
 | 
									foreach (string clinex in lines)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					// xoff handles the columns.  The separator between phone items is a double space.  A phone
 | 
										string cline = clinex.TrimEnd();
 | 
				
			||||||
					// item may have a single space within it (this comes from 16bit implementation)
 | 
										if (cline != "")
 | 
				
			||||||
					float xoff = (float)docstyle.Layout.LeftMargin;
 | 
					 | 
				
			||||||
					int stLineindx = 0;
 | 
					 | 
				
			||||||
					int endLineindx = cline.IndexOf("  ");
 | 
					 | 
				
			||||||
					bool endOfLine = false;
 | 
					 | 
				
			||||||
					while (!endOfLine)
 | 
					 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						string phone = cline.Substring(stLineindx, endLineindx - stLineindx);
 | 
											// xoff handles the columns.  The separator between phone items is a double space.  A phone
 | 
				
			||||||
						float tmp = 0;
 | 
											// item may have a single space within it (this comes from 16bit implementation)
 | 
				
			||||||
						vlnText vt = new vlnText(pdfContentByte, null, phone, phone, xoff, lyoff, MySection.ActiveFormat.PlantFormat.FormatData.Font);
 | 
											float xoff = (float)docstyle.Layout.LeftMargin;
 | 
				
			||||||
						vt.ToPdf(pdfContentByte, 0, ref tmp, ref tmp);
 | 
											int stLineindx = 0;
 | 
				
			||||||
						xoff += 132; // columns in 16bit were a little more than 1 3/4 inches.
 | 
											int endLineindx = cline.IndexOf("  ");
 | 
				
			||||||
						stLineindx = endLineindx;
 | 
											bool endOfLine = false;
 | 
				
			||||||
						if (stLineindx >= cline.Length) break;
 | 
											while (!endOfLine)
 | 
				
			||||||
						while (cline[stLineindx] == ' ' && stLineindx < cline.Length) stLineindx++;
 | 
					 | 
				
			||||||
						if (stLineindx >= cline.Length - 1) endOfLine = true;
 | 
					 | 
				
			||||||
						else
 | 
					 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
							endLineindx = cline.IndexOf("  ", stLineindx);
 | 
												if (endLineindx - stLineindx > 0)
 | 
				
			||||||
							if (endLineindx == -1) endLineindx = cline.Length;
 | 
												{
 | 
				
			||||||
 | 
													string phone = cline.Substring(stLineindx, endLineindx - stLineindx);
 | 
				
			||||||
 | 
													float tmp = 0;
 | 
				
			||||||
 | 
													vlnText vt = new vlnText(pdfContentByte, null, phone, phone, xoff, lyoff, MySection.ActiveFormat.PlantFormat.FormatData.Font);
 | 
				
			||||||
 | 
													vt.ToPdf(pdfContentByte, 0, ref tmp, ref tmp);
 | 
				
			||||||
 | 
													xoff += 132; // columns in 16bit were a little more than 1 3/4 inches.
 | 
				
			||||||
 | 
													stLineindx = endLineindx;
 | 
				
			||||||
 | 
													if (stLineindx >= cline.Length) break;
 | 
				
			||||||
 | 
													while (cline[stLineindx] == ' ' && stLineindx < cline.Length) stLineindx++;
 | 
				
			||||||
 | 
													if (stLineindx >= cline.Length - 1) endOfLine = true;
 | 
				
			||||||
 | 
													else
 | 
				
			||||||
 | 
													{
 | 
				
			||||||
 | 
														endLineindx = cline.IndexOf("  ", stLineindx);
 | 
				
			||||||
 | 
														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();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user