public object Parse(string filepath) { Desen_PrinterData ret = new Desen_PrinterData(); try { XElement Desen = XElement.Load(filepath); //取得Print_Direction ret.ModelName = Desen.getValue("Print_Direction"); //需判斷是否為null ret.PrintTime = Desen.getValue("PrintTime"); //需判斷是否為null 有特定格式...(cont.) /* * char[] separator = { '/', ' ', ':', '-' }; * string[] words = readedStr.Split(separator); * if (words.Count() == 6) * { * int year, month, day, hour, minute, second; * if (int.TryParse(words[0], out year) == true && * int.TryParse(words[1], out month) == true && * int.TryParse(words[2], out day) == true && * int.TryParse(words[3], out hour) == true && * int.TryParse(words[4], out minute) == true && * int.TryParse(words[5], out second) == true * ) * { * PrintTime = new DateTime(year, month, day, hour, minute, second); * } * } */ ret.PanelSN = Desen.getValue("SN"); ret.PanelBarcode = Desen.getValue("Barcode"); ret.Thickness = Desen.getValue("Thickness"); ret.StencilThickness = Desen.getValue("StencilThickness"); } catch (Exception exception) { Log4.PrinterLogger.ErrorFormat("Desen Printer Data Pasre Exception: {0}", filepath); Log4.PrinterLogger.ErrorFormat("Message: {0}", exception.Message); return(null); } return(ret); }
public bool IsBarcodeMatched(object fileobj, string barcode) { Desen_PrinterData data = fileobj as Desen_PrinterData; if (data.PanelBarcode == barcode) { return(true); } else { return(false); } }
public override object Match(InspectedPanel currentPanel) { Desen_PrinterData tmpTool = new Desen_PrinterData(); return((Desen_PrinterData)Match(currentPanel, (IParser)tmpTool, WatchedFolder)); }