Ejemplo n.º 1
0
        /// <summary>
        /// 攻击辅助
        /// </summary>
        public void attack2()
        {
            List <xyc> list = new List <xyc>();

            foreach (DataGridViewRow item in this.dataGridView1.Rows)
            {
                if (item.Cells["x坐标"].Value == null)
                {
                    continue;
                }
                xyc xyc = new xyc();
                xyc.x     = item.Cells["x坐标"].Value.ToString();
                xyc.y     = item.Cells["y坐标"].Value.ToString();
                xyc.c     = item.Cells["颜色"].Value.ToString();
                xyc.key   = item.Cells["keycode"].Value.ToString();
                xyc.group = item.Cells["group"].Value.ToString();
                list.Add(xyc);
            }
            attacklist = list;
            while (isOn)
            {
                foreach (var item in attacklist.Where(p => !string.IsNullOrEmpty(p.group)))
                {
                    if (myClassLibrary.helper.ColorHelper.获取指定坐标的16进制颜色(item.x, item.y) == item.c)
                    {
                        helper.键盘.键(Convert.ToByte(item.key));
                        Random r = new Random();
                        System.Threading.Thread.Sleep(r.Next(100, 300));
                        continue;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存配置 导出json
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            List <xyc> list = new List <xyc>();

            foreach (DataGridViewRow item in this.dataGridView1.Rows)
            {
                if (item.Cells["x坐标"].Value == null)
                {
                    continue;
                }
                xyc xyc = new xyc();
                xyc.x     = item.Cells["x坐标"].Value.ToString();
                xyc.y     = item.Cells["y坐标"].Value.ToString();
                xyc.c     = item.Cells["颜色"].Value.ToString();
                xyc.key   = item.Cells["keycode"].Value.ToString();
                xyc.group = item.Cells["group"].Value.ToString();
                list.Add(xyc);
            }
            string str = JsonConvert.SerializeObject(list);
            //MessageBox.Show(str);

            StreamWriter myStream;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                myStream = new StreamWriter(saveFileDialog1.FileName);
                myStream.Write(str); //写入
                myStream.Close();    //关闭流
            }
        }
Ejemplo n.º 3
0
        protected override void WndProc(ref Message m)
        {
            const int WM_HOTKEY = 0x0312;//如果m.Msg的值为0x0312那么表示用户按下了热键

            //按快捷键
            switch (m.Msg)
            {
            case WM_HOTKEY:
                switch (m.WParam.ToInt32())
                {
                case 100:            //按下的是Shift+S
                    if (isOn)
                    {
                        SpeechSynthesizer synth = new SpeechSynthesizer();

                        synth.Speak("结束自动攻击");

                        synth.Dispose();

                        isOn = false;

                        if (thread.IsAlive)
                        {
                            thread.Abort();
                        }
                        if (thread2.IsAlive)
                        {
                            thread2.Abort();
                        }
                    }
                    else
                    {
                        SpeechSynthesizer synth = new SpeechSynthesizer();

                        synth.Speak("开始自动攻击");

                        synth.Dispose();
                        isOn = true;

                        thread = new Thread(attack);
                        thread.Start();
                        thread2 = new Thread(attack2);
                        thread2.Start();
                    }
                    break;

                case 101:
                    //获取鼠标坐标和颜色并保存
                    xyc xyc = new xyc();
                    xyc.x = (Cursor.Position.X).ToString();
                    xyc.y = (Cursor.Position.Y).ToString();
                    xyc.c = helper.ColorHelper.获取指定坐标的16进制颜色(xyc.x, xyc.y);
                    DataRow dr = tblDatas.NewRow();
                    dr["x坐标"]     = xyc.x;
                    dr["y坐标"]     = xyc.y;
                    dr["颜色"]      = xyc.c;
                    dr["keycode"] = "";
                    tblDatas.Rows.Add(dr);

                    break;
                }
                break;
            }
            base.WndProc(ref m);
        }