Esempio n. 1
0
        private bool IsBait(List <string> isBaitColorInfo, Point baitPoint, List <int> baitOffset, int timeOut)
        {
            var startTime = DateTime.Now.AddMilliseconds(timeOut);
            int l, t, r, b;

            l = baitPoint.X - baitOffset[0];
            t = baitPoint.Y - baitOffset[1];
            r = baitPoint.X + baitOffset[2];
            b = baitPoint.Y + baitOffset[3];
            while (DateTime.Now < startTime)
            {
                //Debug.WriteLine(string.Format("l:{0},t:{1},r:{2},b:{3}",l,t,r,b));
                var count = _dmSoft.GetColorNum(l, t, r, b, isBaitColorInfo[0], double.Parse(isBaitColorInfo[1]));
                if (count > 0)
                {
                    Debug.WriteLine(string.Format("{0} {1} {2}", count, isBaitColorInfo[0], isBaitColorInfo[1]));
                }
                if (count > int.Parse(isBaitColorInfo[2]))
                {
                    return(true);
                }
                _dmSoft.Delay(10);
            }
            return(false);
        }