示例#1
0
        public override int GetHashCode()
        {
            var hashCode = -359988537;

            hashCode = hashCode * -1521134295 + Token.GetHashCode();
            hashCode = hashCode * -1521134295 + MatchedText.GetHashCode();
            hashCode = hashCode * -1521134295 + StartIndex.GetHashCode();
            return(hashCode);
        }
示例#2
0
        public State Advance()
        {
#if DEBUG
            Debug.Assert(Type == ParseStepType.Pass, "Cannot call Advance() unless the Type is Pass");
            Debug.Assert(!_alreadyAdvanced, "Can only call Advance() once");
            _alreadyAdvanced = true;
#endif
            // Call Advance() on the State for each character in the match
            return(MatchedText.Aggregate(InitialState, (current, t) => current.Advance()));
        }
示例#3
0
文件: Program.cs 项目: miintz/SonSerC
        public String SeeifAlbumsInSearchResults()
        {
            int topsize   = 30;
            int widthsize = 125;
            int left      = 265;
            int top       = 180;

            Bitmap bmp = new Bitmap(widthsize, topsize, PixelFormat.Format32bppArgb);

            using (Graphics g = Graphics.FromImage(bmp))
            {
                var rect = new User32.Rect();
                User32.GetWindowRect(FocusSpotify(true).MainWindowHandle, ref rect);

                Graphics graphics = Graphics.FromImage(bmp);
                g.CopyFromScreen(left, top, 0, 0, new Size(widthsize, topsize), CopyPixelOperation.SourceCopy);
            }

            //make it a big bigger first
            Size si = new Size(bmp.Width * 2, bmp.Height * 2); //bump up the size to increase BlueSimilarity's change of not fudging the text

            bmp = ResizeImage(bmp, si);

            bmp.Save("lastsearch.png");

            String MatchedText;

            using (var engine = new TesseractEngine("tesseract-ocr", "eng", EngineMode.Default))
            {
                using (var pix = PixConverter.ToPix(bmp))
                {
                    using (var page = engine.Process(pix))
                    {
                        //3. Get matched text from tesseract
                        MatchedText = page.GetText();
                    }
                }
            }

            String[] Lines = MatchedText.Split(new char[] { '\n' });
            String   Word  = Lines[0];

            return(Word);
        }