static void Main(string[] args) { MRZScannerLibrary.MRZScannerLibrary test = new MRZScannerLibrary.MRZScannerLibrary("My_app_testProcessMRZ", "Y5J5xYPvDyVRBGR47dfh76kc"); byte[] image = File.ReadAllBytes("C:\\Users\\yubarbeu\\Desktop\\240px-Lauda,_Niki_1973-07-06.webp"); test.StartScan(image); while (true) { Console.WriteLine(test.isScanCompleted + " - \n"); if (test.isScanCompleted) { Console.WriteLine("ExpMsg = " + test.ExeptionMessage); Console.WriteLine("isCompl = " + test.isScanCompleted); Console.WriteLine("isSuccCompl = " + test.isScanSuccessCompleted); Console.WriteLine("=========="); Console.WriteLine("DocNumber = " + test.documentData.DocumentNumber); Console.WriteLine("BirthDate = " + test.documentData.BirthDate); break; } Thread.Sleep(1000); } }
static void Main(string[] args) { /* * //MRZScannerLibrary.MRZScannerLibrary test = new MRZScannerLibrary.MRZScannerLibrary(); * * //Step1 add task passport * var resp = step1(); * var xmlString = resp.Result.Content.ReadAsStringAsync().Result; * Console.WriteLine(xmlString + "\n"); * * //Spet2 get task link if ready * XmlDocument xDoc1 = new XmlDocument(); * xDoc1.LoadXml(xmlString); * * //TODO FIX THIS * var id = xDoc1.LastChild.FirstChild.Attributes.GetNamedItem("id").InnerText; * * var resp2 = step2("https://cloud.ocrsdk.com/getTaskStatus?taskId=", id); * var xmlString2 = resp2.Result.Content.ReadAsStringAsync().Result; * Console.WriteLine(xmlString2 + "\n"); * * //Step3 get info on task * XmlDocument xDoc2 = new XmlDocument(); * xDoc2.LoadXml(xmlString2); * * //TODO FIX THIS * var link = xDoc2.LastChild.FirstChild.Attributes.GetNamedItem("resultUrl").InnerText; * * var resp3 = step3(link); * Console.WriteLine(resp3.Result.Content.ReadAsStringAsync().Result + "\n"); * * //Step4 init library */ MRZScannerLibrary.MRZScannerLibrary test = new MRZScannerLibrary.MRZScannerLibrary("My_app_testProcessMRZ", "Y5J5xYPvDyVRBGR47dfh76kc"); byte[] image = File.ReadAllBytes("C:\\Users\\yubarbeu\\Desktop\\passports\\2.jpg"); test.StartScan(image); while (true) { Console.WriteLine(test.isScanCompleted + " - \n"); if (test.isScanCompleted) { Console.WriteLine("ExpMsg = " + test.ExeptionMessage); Console.WriteLine("isCompl = " + test.isScanCompleted); Console.WriteLine("isSuccCompl = " + test.isScanSuccessCompleted); Console.WriteLine("=========="); Console.WriteLine("DocNumber = " + test.documentData.DocumentNumber); Console.WriteLine("BirthDate = " + test.documentData.BirthDate); break; } Thread.Sleep(1000); } }
static void Main(string[] args) { MRZScannerLibrary.MRZScannerLibrary test = new MRZScannerLibrary.MRZScannerLibrary("My_app_testProcessMRZ", "Y5J5xYPvDyVRBGR47dfh76kc"); //byte[] image = File.ReadAllBytes("C:\\Users\\yubarbeu\\Desktop\\240px-Lauda,_Niki_1973-07-06.webp"); //CRASH byte[] image = File.ReadAllBytes("C:\\Users\\yubarbeu\\Desktop\\Passports\\5.jpg"); //SUCCESS ////////////////////////// /// Пример использования без каллбэка ////////////////////////// /* * test.StartScan(image, null); * * while (true) * { * Console.WriteLine(test.isScanCompleted + " - \n"); * * if (test.isScanCompleted) * { * Console.WriteLine("ExpMsg = " + test.ExeptionMessage); * Console.WriteLine("isCompl = " + test.isScanCompleted); * Console.WriteLine("isSuccCompl = " + test.isScanSuccessCompleted); * Console.WriteLine("=========="); * Console.WriteLine("DocNumber = " + test.documentData.DocumentNumber); * Console.WriteLine("BirthDate = " + test.documentData.BirthDate); * break; * } * Thread.Sleep(1000); * }*/ ////////////////////////// /// Пример использования с каллбэком ////////////////////////// test.StartScan(image, () => { Console.WriteLine("ExpMsg = " + test.ExeptionMessage); Console.WriteLine("isCompl = " + test.isScanCompleted); Console.WriteLine("isSuccCompl = " + test.isScanSuccessCompleted); Console.WriteLine("=========="); Console.WriteLine("DocNumber = " + test.documentData.DocumentNumber); Console.WriteLine("BirthDate = " + test.documentData.BirthDate); }); Console.Read(); }