Example #1
0
 private string readPdf(string filename)
 {
     loadingForm.setProgress("Reading " + SafeFileName);
     using (var Input = new OcrInput(filename))
     {
         var Result = Ocr.Read(Input);
         return(Result.Text);
     }
 }
Example #2
0
        private void pictureBoxCut_MouseUp(object sender, MouseEventArgs e)
        {
            if (IsOcrMaking)
            {
                return;
            }
            IsOcrMaking = true;

            OcrRectangle = CalcOcrRectangle();

            StartPoint = Point.Empty;
            Task.Run(() =>
            {
                var timer = new System.Threading.Timer(new TimerCallback((state =>
                {
                    this.BeginInvoke(new Action(() => this.Refresh()));
                })), null, 300, 300);
                try
                {
                    IsOcrMaking = true;

                    if (OcrRectangle == null)
                    {
                        return;
                    }

                    //鼠标相对于窗体左上角的坐标
                    ocrStopwatch.Restart();
                    using (var bitBmp = this.Image.Clone(OcrRectangle.Value, this.Image.PixelFormat))
                    {
                        var Result = Ocr.Read(bitBmp);

                        ocrStopwatch.Stop();

                        this.BeginInvoke(new Action(() => this.Refresh()));

                        OcrString = Result.Text;
                    }
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                }
                finally
                {
                    timer.Dispose();
                    timer       = null;
                    IsOcrMaking = false;
                }
            });
        }
Example #3
0
        static void Main()
        {
            // Utils.Mouse.SetCursorPosition(800, 200);
            // Utils.Mouse.MouseEvent(Utils.Mouse.MouseEventFlags.LeftDown);

            // Flow.Execute();
            Ocr.Read();

            // Utils.Mouse.MouseEvent(Utils.Mouse.MouseEventFlags.LeftUp);
            // var color = Utils.Screen.GetPixelColor(25, 25);
            // Console.WriteLine(color);
            // bool areSimilar = Screen.AreColorsSimilar(1251, 132, Color.FromArgb(255, 39, 43, 55), 0);
            // Console.WriteLine(areSimilar);
            // await Utils.Lol.Reset();
            // Account account = await Services.GetAccountToReap.Execute();
            // Console.WriteLine($"User Name: {account.UserName}");
            // Console.WriteLine($"Actual Password: {account.ActualPassword}");
            // Keyboard.Write(account.UserName);
            // Keyboard.PressKey(VirtualKeyCode.TAB);
            // Keyboard.Write(account.ActualPassword);
            // Keyboard.PressKey(VirtualKeyCode.RETURN);
        }