using Aitex.Core.RT.Log; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace Aitex.Sorter.RT.Module.Recipe { public class HostUsageRecipe { public double PreAlignAngle; public bool IsReadLaserMarker1; public bool IsVerifyLaserMarker1; public bool IsVerifyChecksumLaserMarker1; public int LaserMarkerWaferReaderIndex1; public bool IsReadLaserMarker2; public bool IsVerifyLaserMarker2; public bool IsVerifyChecksumLaserMarker2; public int LaserMarkerWaferReaderIndex2; public List OcrReaderJob1; public List OcrReaderJob2; public bool IsPostAlign; public double PostAlignAngle; public bool IsTurnOver; public string HostRecipeName { get; set; } public HostUsageRecipe(string content,string recipename) { try { HostRecipeName = recipename; var doc = XDocument.Parse(content); var node = doc.Root.Element("AitexSorterHostUsageRecipe"); if (node == null) { LOG.Write(string.Format("recipe not valid")); return; } string value = node.Attribute("PreAlignAngle").Value; double doubleValue; double.TryParse(value, out doubleValue); PreAlignAngle = doubleValue; value = node.Attribute("IsReadLaserMarker1").Value; bool boolValue; bool.TryParse(value, out boolValue); IsReadLaserMarker1 = boolValue; value = node.Attribute("IsVerifyLaserMarker1").Value; bool.TryParse(value, out boolValue); IsVerifyLaserMarker1 = boolValue; value = node.Attribute("IsVerifyChecksumLaserMarker1").Value; bool.TryParse(value, out boolValue); IsVerifyChecksumLaserMarker1 = boolValue; value = node.Attribute("LaserMarkerWaferReaderIndex1").Value; int intValue; int.TryParse(value, out intValue); LaserMarkerWaferReaderIndex1 = intValue; value = node.Attribute("IsReadLaserMarker2").Value; bool.TryParse(value, out boolValue); IsReadLaserMarker2 = boolValue; value = node.Attribute("IsVerifyLaserMarker2").Value; bool.TryParse(value, out boolValue); IsVerifyLaserMarker2 = boolValue; value = node.Attribute("IsVerifyChecksumLaserMarker2").Value; bool.TryParse(value, out boolValue); IsVerifyChecksumLaserMarker2 = boolValue; value = node.Attribute("LaserMarkerWaferReaderIndex2").Value; int.TryParse(value, out intValue); LaserMarkerWaferReaderIndex2 = intValue; value = node.Attribute("IsPostAlign").Value; bool.TryParse(value, out boolValue); IsPostAlign = boolValue; value = node.Attribute("IsTurnOver").Value; bool.TryParse(value, out boolValue); IsTurnOver = boolValue; value = node.Attribute("PostAlignAngle").Value; double.TryParse(value, out doubleValue); PostAlignAngle = doubleValue; value = node.Attribute("OcrReaderJob1").Value; var arr = value.Split(new char[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries); OcrReaderJob1 = arr.ToList(); value = node.Attribute("OcrReaderJob2").Value; arr = value.Split(new char[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries); OcrReaderJob2 = arr.ToList(); } catch (Exception ex) { LOG.Write(ex); } } } }