Esempio n. 1
0
        //触摸颜色点
        public static void Parse_ColorTouch(ref int index)
        {
            string str = lstScript[index];

            if (str.IndexOf("ColorTouch") == 0)
            {
                int   r, g, b;
                Regex reg = new Regex("R=(?<r>\\d+).*.G=(?<g>\\d+).*.B=(?<b>\\d+)");
                Match m   = reg.Match(str);
                r = int.Parse(m.Groups["r"].Value);
                g = int.Parse(m.Groups["g"].Value);
                b = int.Parse(m.Groups["b"].Value);

                Color c = Color.FromArgb(255, r, g, b);

                for (int i = 0; i < bmp.Width; i++)
                {
                    for (int j = 0; j < bmp.Height; j++)
                    {
                        if (bmp.GetPixel(i, j) == c)
                        {
                            SysMsg.MouseEvent(0, i, j);
                            Thread.Sleep(1);
                            SysMsg.MouseEvent(1, i, j);
                            index++;
                            return;
                        }
                    }
                }
                index++;
            }
        }
Esempio n. 2
0
        //条件等待
        //WaitColor
        //失败执行语句
        //循环执行语句Touch X= Y=
        //....
        //若超时未满足则执行下1句,第二句为每秒循环执行,否则下3句开始
        public static void Parse_WaitColor(ref int index)
        {
            string str = lstScript[index];

            if (str.IndexOf("WaitColor") == 0)
            {
                int   t, x, y, r, g, b;
                Regex reg = new Regex("T=(?<t>\\d+).*.X=(?<x>\\d+).*.Y=(?<y>\\d+).*.R=(?<r>\\d+).*.G=(?<g>\\d+).*.B=(?<b>\\d+)");
                Match m   = reg.Match(str);
                t = int.Parse(m.Groups["t"].Value);
                x = int.Parse(m.Groups["x"].Value);
                y = int.Parse(m.Groups["y"].Value);
                r = int.Parse(m.Groups["r"].Value);
                g = int.Parse(m.Groups["g"].Value);
                b = int.Parse(m.Groups["b"].Value);

                t /= 1000;

                while (--t >= 0)
                {
                    SysMsg.ShotEvent();
                    bmp = Tcp.GetBitmap();
                    frm.ImgUpdateFunction(bmp);
                    if (PointColorAEqual(x, y, r, g, b))
                    {
                        index += 4;
                        return;
                    }
                    string str1;
                    if (t % 2 == 0)
                    {
                        str1 = lstScript[index + 2];
                    }
                    else
                    {
                        str1 = lstScript[index + 3];
                    }
                    if (str1.IndexOf("Touch") == 0)
                    {
                        Regex reg1 = new Regex("X=(?<x>\\d+).*.Y=(?<y>\\d+)");
                        Match m1   = reg1.Match(str1);
                        int   x1   = int.Parse(m1.Groups["x"].Value);
                        int   y1   = int.Parse(m1.Groups["y"].Value);
                        SysMsg.MouseEvent(0, x1, y1);
                        Thread.Sleep(1);
                        SysMsg.MouseEvent(1, x1, y1);
                    }
                    Thread.Sleep(1000);
                }
                //失败执行下一句
                index++;
            }
        }
Esempio n. 3
0
        //更新图像
        //UpdataImg
        public static void Parse_UpdataImg(ref int index)
        {
            string str = lstScript[index];

            if (str.IndexOf("UpdataImg") == 0)
            {
                SysMsg.ShotEvent();
                bmp = Tcp.GetBitmap();
                frm.ImgUpdateFunction(bmp);
                index++;
            }
        }
Esempio n. 4
0
        //控制栏触摸
        public static void Parse_ControlTouch(ref int index)
        {
            string str = lstScript[index];

            if (str.IndexOf("Contorl") == 0)
            {
                Regex reg = new Regex("X=(?<x>\\d+).*.Y=(?<y>\\d+)");
                Match m   = reg.Match(str);
                int   x   = int.Parse(m.Groups["x"].Value);
                int   y   = int.Parse(m.Groups["y"].Value);
                SysMsg.MouseControlEvent(0, x, y);
                Thread.Sleep(1);
                SysMsg.MouseControlEvent(1, x, y);
                index++;
            }
        }
Esempio n. 5
0
        //触摸事件
        public static void Parse_Drag(ref int index)
        {
            string str = lstScript[index];

            if (str.IndexOf("Drag") == 0)
            {
                Regex reg = new Regex("X1=(?<x1>\\d+).*.Y1=(?<y1>\\d+).X2=(?<x2>\\d+).*.Y2=(?<y2>\\d+)");
                Match m   = reg.Match(str);
                int   x1  = int.Parse(m.Groups["x1"].Value);
                int   y1  = int.Parse(m.Groups["y1"].Value);
                int   x2  = int.Parse(m.Groups["x2"].Value);
                int   y2  = int.Parse(m.Groups["y2"].Value);
                SysMsg.MouseEvent(0, x1, y1);
                Thread.Sleep(200);
                SysMsg.MouseEvent(2, x2, y2);
                Thread.Sleep(200);
                SysMsg.MouseEvent(1, x2, y2);
                index++;
            }
        }