C#Breakpoint命中调试器

时间:2016-09-18 17:41:50

标签: c# debugging

Soo ive justed完成了我在c#中的第一个项目,但后来我在这上面运行了upp “实时事件:断点命中:Timer1_tick,Forn断点或跟踪点被调试器击中”。我真的不能发现任何错误,我的代码soo我真的不知道如何解决这里是我一直在尝试的代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            webBrowser1.Navigate("mywebsite.com");
            webBrowser1.ScriptErrorsSuppressed = true;
        }
        private int failed = 0;
        string startbet = "250";
        string bet2 = "150000";
        string bet3 = "300000";
        string bet4 = "600000";
        string bet5 = "1200000";
        string bet6 = "2400000";
        string bet7 = "4800000";
        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("brukernavn")[0].SetAttribute("value", textBox1.Text);
            webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("passord")[0].SetAttribute("value", textBox2.Text);
            webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("login_buton")[0].InvokeMember("click");
            timer1.Enabled = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            webBrowser1.Navigate("mywebsite.com/gamblingsite.php");
            webBrowser1.DocumentCompleted += Krigside;
            timer1.Enabled = false;
        }
        private void Krigside(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            webBrowser1.DocumentCompleted -= Krigside;
            timer2.Enabled = true;
            timer2.Interval = 1000;
        }
        private void timer2_Tick(object sender, EventArgs e)
        {
            if (webBrowser1.DocumentText.Contains("bokstavene"))
            {
                MessageBox.Show("Anti-bot! du har 60 sekunder på og fullføre!");
                timer2.Enabled = true;
                timer2.Interval = 60000; //60 sekunder før den sjekker anti-bot igjen.
            }
            else
            {
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", startbet);
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
                timer2.Enabled = false;
                webBrowser1.DocumentCompleted += SjekkVinnFeil;
            }
        }
        private void SjekkVinnFeil(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            MessageBox.Show("KRIG SIDEN ER KLAR!");
            webBrowser1.DocumentCompleted -= SjekkVinnFeil;
            if (webBrowser1.DocumentText.Contains("taper"))
            {
                failed += 1;
            }
            else
            {
                failed = 0;
            }
            timer3.Enabled = true;
        }

        private void timer3_Tick(object sender, EventArgs e)
        {
            if (webBrowser1.DocumentText.Contains("bokstavene"))
            {
                MessageBox.Show("Anti-bot! du har 60 sekunder på og fullføre!");
                timer3.Enabled = true;
                timer3.Interval = 60000; //60 sekunder før den sjekker anti-bot igjen.
            }
            else if (failed == 3)
            {
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet2);
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
                timer3.Enabled = false;
                webBrowser1.DocumentCompleted += SjekkVinnFeil;
            }
            else if (failed == 4)
            {
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet3);
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
                timer3.Enabled = false;
                webBrowser1.DocumentCompleted += SjekkVinnFeil;
            }
            else if (failed == 5)
            {
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet4);
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
                timer3.Enabled = false;
                webBrowser1.DocumentCompleted += SjekkVinnFeil;
            }
            else if (failed == 6)
            {
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet5);
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
                timer3.Enabled = false;
                webBrowser1.DocumentCompleted += SjekkVinnFeil;
            }
            else if (failed == 7)
            {
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet6);
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
                timer3.Enabled = false;
                webBrowser1.DocumentCompleted += SjekkVinnFeil;
            }
            else if (failed == 8)
            {
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet7);
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
                timer3.Enabled = false;
                webBrowser1.DocumentCompleted += SjekkVinnFeil;
            }
            else
            {
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", startbet);
                webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
                timer3.Enabled = false;
                webBrowser1.DocumentCompleted += SjekkVinnFeil;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            timer2.Enabled = false;
            timer3.Enabled = false;
            MessageBox.Show("Stoppet!");
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }
    }
}

并且我已经查看了我的代码了几次现在一直在理解什么是错的,所以我希望这里的任何人都能帮我说出我做错了什么。我很新鲜到c#所以我希望你可以帮助我,因为我已经尝试搜索问题,但没有任何解决它的运气。

1 个答案:

答案 0 :(得分:3)

所以你唯一的问题是断点击中的原因?如果是,那么它是因为您已经在某个时间设置了断点以进行调试。如果您不再需要它们,则可以选择debug菜单选项并选择delete all breakpointdisable all breakpoint来删除断点。

您也可以考虑使用选项Releasestart without dedbugging模式下运行该应用程序。 (或)web.config / app.config设置以下行

<Compilation debug="false" />