public static void OldStartServer(TcpListener listener) { Console.WriteLine("Server started"); while (!exitSystem) { try { var client = listener.AcceptTcpClient(); var currentDat = DateTime.Now; if (client.Connected) { var sendCommunication = new Communication(client); Console.WriteLine("Client connected"); //var currentDate = String.Format("{0}{1}{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond); Console.WriteLine(String.Format("Current for client {0:HH:mm:ss:fff}", currentDat)); var textToSearch = sendCommunication.ReceiveText(); sendCommunication.SendText("ok"); var imageReceived = sendCommunication.ReceiveImage(); var text = findText.FindText(imageReceived, textToSearch); sendCommunication.SendTextFound(text); client.Close(); Console.WriteLine("Client disconnected"); } } catch (Exception ex) { Console.WriteLine("Random exception thrown"); Console.WriteLine(ex.Message); Console.WriteLine(ex.InnerException); Console.WriteLine(ex.StackTrace); } } }
static void Main(string[] args) { var ocr = new OneNoteOCR(); var findText = new ActionNote(); //var pixel = new GetDeviceDpi(); try { ocr.Verify(); } catch (Exception) { Console.WriteLine("you do not have OneNote 15 "); return; } if (args.Length == 0) { Console.WriteLine("please add argument = path to the image file"); return; } //var path = @"C:\Users\gastanica\Desktop\first.png"; var path = @"C:\Users\gastanica\Desktop\second.png"; //var path = @"C:\Users\gastanica\Desktop\screen.jpg"; //var path = @"C:\Users\gastanica\Desktop\2.3.png"; //var path = @"C:\Users\gastanica\Desktop\test2.png"; //var ocrText = ocr.RecognizeImage(args[0]); var ocrText = findText.FindText(path, "ATEUR"); Console.ReadLine(); }
static void Main(string[] args) { var ocr = new OneNoteOCR(); var findText = new ActionNote(); string imagePath = String.Empty; string textToFind = String.Empty; try { ocr.Verify(); } catch (Exception) { Console.WriteLine("you do not have OneNote 15 "); return; } if (Debugger.IsAttached) { imagePath = @"C:\Users\gastanica\Desktop\serverPASS4.png"; textToFind = "daily"; } else { if (args.Length < 2) { Console.WriteLine("please add argument = path to the image file"); return; } imagePath = args[0]; textToFind = args[1]; } TextFound ocrText = new TextFound(0, 0, 0, 0, "", ""); ocrText = findText.FindText(imagePath, textToFind); Console.WriteLine(imagePath); Console.WriteLine(textToFind); Console.WriteLine(ocrText.TextArea); Console.WriteLine(ocrText.Center()); Console.WriteLine(ocrText.ImageText); Console.WriteLine(ocrText.SearchText); }