public static void Run()
        {
            string[] lines = File.ReadAllLines("script.hbs", Encoding.UTF8);
            foreach (string line in lines)
            {
                if (line.Trim().StartsWith("#线程数"))
                {
                    int.TryParse(line.Replace("#线程数", "").Trim(), out threadCount);
                }
                if (line.Trim().StartsWith("#开启RGB"))
                {
                    rgb = true;
                }
                script += line + "\r\n";
            }

            System.Net.ServicePointManager.DefaultConnectionLimit = threadCount;

            ScriptedBomber sb = new ScriptedBomber(script);

            sb.OnBomberComplete += Sb_OnBomberComplete;
            BomberPerformer bp = new BomberPerformer(sb);

            bp.ThreadCount = threadCount;
            bp.StartBomber();
        }
Ejemplo n.º 2
0
        public void Run()
        {
            string[] lines = File.ReadAllLines("script.hbs", Encoding.UTF8);
            foreach (string line in lines)
            {
                if (line.Trim().StartsWith("#线程数"))
                {
                    int.TryParse(line.Replace("#线程数", "").Trim(), out threadCount);
                }
                if (line.Trim().StartsWith("#开启RGB"))
                {
                    rgb = true;
                }
                if (line.Trim().StartsWith("#关闭回显"))
                {
                    BomberUtils.showEcho = false;
                }
                script += line + "\r\n";
            }

            System.Net.ServicePointManager.DefaultConnectionLimit = threadCount;

            ScriptedBomber sb = new ScriptedBomber(script);

            sb.OnBomberComplete += Sb_OnBomberComplete;
            BomberPerformer bp = new BomberPerformer(sb);

            resultHandler = new showResult(delegate(int speed, string args) {
                monitorChart1.Value = speed;
                textBox1.Text       = args;
            });
            bp.ThreadCount = threadCount;
            bp.StartBomber();
        }
Ejemplo n.º 3
0
        private void MainActivity_Click(object sender, EventArgs e)
        {
            if (null == performer)
            {
                String script = FindViewById <EditText>(Resource.Id.txtScript).Text;

                GetSharedPreferences("main", Android.Content.FileCreationMode.Private).Edit().PutString("script", script).Commit();

                int threadcount = 32;

                string[] lines = script.Split('\r', '\n');
                foreach (string line in lines)
                {
                    if (line.Trim().StartsWith("#线程数"))
                    {
                        int.TryParse(line.Replace("#线程数", "").Trim(), out threadcount);
                    }
                    if (line.Trim().StartsWith("#关闭回显"))
                    {
                        BomberUtils.showEcho = false;
                    }
                }

                System.Net.ServicePointManager.DefaultConnectionLimit = threadcount;
                System.Net.ServicePointManager.Expect100Continue      = false;

                ScriptedBomber bomber = new ScriptedBomber(script);
                performer = new BomberPerformer(bomber);
                bomber.OnBomberComplete += Bomber_OnBomberComplete;
                performer.ThreadCount    = threadcount;
                performer.StartBomber();
                ((Button)sender).Text = "停止并退出";
                successcount          = 0;
                failcount             = 0;
                last = DateTime.Now;
            }
            else
            {
                performer.StopBomber();
                Finish();
            }
        }