Exemplo n.º 1
0
        private void add4(object sender, AsyncCompletedEventArgs e)
        {
            int l = 4;

            if (e.Cancelled)
            {
                File.Delete(textBox1.Text + "\\Songs\\" + a[l] + ".oszx");
                wc[l].Dispose();
                return;
            }

            int y = 5;

            if (y <= threadselected)
            {
                int x = y - 1;
                wc[x].Dispose();
                wc[x] = new WebClient();
                o[x]  = new NetSpeedCounter(wc[x], 5);
                File.Move(textBox1.Text + "\\Songs\\" + a[4] + ".oszx", textBox1.Text + "\\Songs\\" + a[4] + ".osz");

                a[x] = listView1.Items[x].SubItems[0].Text;
                idk.Add(a[4]);
                lvi.ListView.Items.Clear();
                oldalid--;
                ListFill((float)numericUpDown1.Value);
                oldalid++;
                refillmaps();


                using (wc[x])
                {
                    wc[x].DownloadFileAsync(new System.Uri("http://bloodcat.com/osu/s/" + a[x]),
                                            textBox1.Text + "\\Songs\\" + a[x] + ".oszx");
                    wc[x].DownloadProgressChanged += wc4_DownloadProgressChanged;
                    wc[x].DownloadFileCompleted   += add4;
                }
                o[x].Reset();
                o[x].Start();
            }
        }
Exemplo n.º 2
0
        private void add(object sender, AsyncCompletedEventArgs e)
        {
            int l = 0;

            if (e.Cancelled)
            {

                File.Delete(textBox1.Text + "\\Songs\\" + a[l] + ".oszx");
                wc[l].Dispose();
                return;
            }
            int y = 1;
            if (y <= threadselected)
            {
                int x = y - 1;
                wc[x].Dispose();
                wc[x] = new WebClient();
                o[x] = new NetSpeedCounter(wc[x], 5);
                File.Move(textBox1.Text + "\\Songs\\" + a[0] + ".oszx", textBox1.Text + "\\Songs\\" + a[0] + ".osz");

                a[x] = listView1.Items[x].SubItems[0].Text;
                idk.Add(a[0]);
                lvi.ListView.Items.Clear();
                oldalid--;
                ListFill((float)numericUpDown1.Value);
                oldalid++;
                refillmaps();
                
                using (wc[x])
                {
                    wc[x].DownloadFileAsync(new System.Uri("http://bloodcat.com/osu/s/" + a[x]),
                    textBox1.Text + "\\Songs\\" + a[x] + ".oszx");
                    wc[x].DownloadProgressChanged += wc_DownloadProgressChanged;
                    wc[x].DownloadFileCompleted += add;
                }
                o[x].Reset();
                o[x].Start();

            }
        }
Exemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (!isOn)
            {

                radioButton1.Enabled = false;
                radioButton2.Enabled = false;
                radioButton3.Enabled = false;

                isOn = !isOn;
                button2.Text = "Stop";

                Directory.CreateDirectory(textBox1.Text + "\\Songs\\");
                Button clickedButton = (Button)sender;
                threads = threadselected;
                wc = new WebClient[10];
                o = new NetSpeedCounter[10];
                WebRequest.DefaultWebProxy = null;
                refillmaps();


                


                start:
                for (q = 0; q < threadselected; q++)
                {

                    wc[q] = new WebClient();
                    o[q] = new NetSpeedCounter(wc[q], 5);
                    a[q] = listView1.Items[q].SubItems[0].Text;

                    if (File.Exists(textBox1.Text + "\\Songs\\" + a[q] + ".oszx"))
                    {
                        File.Delete(textBox1.Text + "\\Songs\\" + a[q] + ".oszx");
                    }

                    //if (File.Exists(textBox1.Text + "\\Songs\\" + a[q] + ".osz"))
                    //{
                    //    idk.Add(a[q]);
                    //    lvi.ListView.Items.Clear();
                    //    oldalid--;
                    //    ListFill((float)numericUpDown1.Value);
                    //    oldalid++;
                    //    refillmaps();
                    //    q++;

                    //    goto start;

                    //}

                    using (wc[q])
                    {
                        wc[q].DownloadFileAsync(new System.Uri("http://bloodcat.com/osu/s/" + a[q]),
                        textBox1.Text + "\\Songs\\" + a[q] + ".oszx");
                        o[q].Start();
                    }

                    idk.Add(a[q]);
                    lvi.ListView.Items.Clear();
                    oldalid--;
                    ListFill((float)numericUpDown1.Value);
                    oldalid++;
                    refillmaps();
                }

                #region wcEvents
                for (int c = 0; c < threads; c++)
                {
                    if (c == 0)
                        wc[c].DownloadFileCompleted += add;
                    if (c == 1)
                        wc[c].DownloadFileCompleted += add1;
                    if (c == 2)
                        wc[c].DownloadFileCompleted += add2;
                    if (c == 3)
                        wc[c].DownloadFileCompleted += add3;
                    if (c == 4)
                        wc[c].DownloadFileCompleted += add4;
                    if (c == 5)
                        wc[c].DownloadFileCompleted += add5;
                    if (c == 6)
                        wc[c].DownloadFileCompleted += add6;
                    if (c == 7)
                        wc[c].DownloadFileCompleted += add7;
                    if (c == 8)
                        wc[c].DownloadFileCompleted += add8;
                    if (c == 9)
                        wc[c].DownloadFileCompleted += add9;

                }

                for (int c = 0; c < threads; c++)
                {
                    if (c == 0)
                        wc[c].DownloadProgressChanged += wc_DownloadProgressChanged;
                    if (c == 1)
                        wc[c].DownloadProgressChanged += wc1_DownloadProgressChanged;
                    if (c == 2)
                        wc[c].DownloadProgressChanged += wc2_DownloadProgressChanged;
                    if (c == 3)
                        wc[c].DownloadProgressChanged += wc3_DownloadProgressChanged;
                    if (c == 4)
                        wc[c].DownloadProgressChanged += wc4_DownloadProgressChanged;
                    if (c == 5)
                        wc[c].DownloadProgressChanged += wc5_DownloadProgressChanged;
                    if (c == 6)
                        wc[c].DownloadProgressChanged += wc6_DownloadProgressChanged;
                    if (c == 7)
                        wc[c].DownloadProgressChanged += wc7_DownloadProgressChanged;
                    if (c == 8)
                        wc[c].DownloadProgressChanged += wc8_DownloadProgressChanged;
                    if (c == 9)
                        wc[c].DownloadProgressChanged += wc9_DownloadProgressChanged;

                }
                #endregion
                
            }
            else
            {
                for (int i = 0; i < threadselected; i++)
                    using (wc[i])
                           wc[i].CancelAsync();

                radioButton1.Enabled = true;
                radioButton2.Enabled = true;
                radioButton3.Enabled = true;

                isOn = !isOn;
                button2.Text = "Start DL";
            }


        }
Exemplo n.º 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (!isOn)
            {
                radioButton1.Enabled = false;
                radioButton2.Enabled = false;
                radioButton3.Enabled = false;

                isOn         = !isOn;
                button2.Text = "Stop";

                Directory.CreateDirectory(textBox1.Text + "\\Songs\\");
                Button clickedButton = (Button)sender;
                threads = threadselected;
                wc      = new WebClient[10];
                o       = new NetSpeedCounter[10];
                WebRequest.DefaultWebProxy = null;
                refillmaps();



start:
                for (q = 0; q < threadselected; q++)
                {
                    wc[q] = new WebClient();
                    o[q]  = new NetSpeedCounter(wc[q], 5);
                    a[q]  = listView1.Items[q].SubItems[0].Text;

                    if (File.Exists(textBox1.Text + "\\Songs\\" + a[q] + ".oszx"))
                    {
                        File.Delete(textBox1.Text + "\\Songs\\" + a[q] + ".oszx");
                    }

                    //if (File.Exists(textBox1.Text + "\\Songs\\" + a[q] + ".osz"))
                    //{
                    //    idk.Add(a[q]);
                    //    lvi.ListView.Items.Clear();
                    //    oldalid--;
                    //    ListFill((float)numericUpDown1.Value);
                    //    oldalid++;
                    //    refillmaps();
                    //    q++;

                    //    goto start;

                    //}

                    using (wc[q])
                    {
                        wc[q].DownloadFileAsync(new System.Uri("http://bloodcat.com/osu/s/" + a[q]),
                                                textBox1.Text + "\\Songs\\" + a[q] + ".oszx");
                        o[q].Start();
                    }

                    idk.Add(a[q]);
                    lvi.ListView.Items.Clear();
                    oldalid--;
                    ListFill((float)numericUpDown1.Value);
                    oldalid++;
                    refillmaps();
                }

                #region wcEvents
                for (int c = 0; c < threads; c++)
                {
                    if (c == 0)
                    {
                        wc[c].DownloadFileCompleted += add;
                    }
                    if (c == 1)
                    {
                        wc[c].DownloadFileCompleted += add1;
                    }
                    if (c == 2)
                    {
                        wc[c].DownloadFileCompleted += add2;
                    }
                    if (c == 3)
                    {
                        wc[c].DownloadFileCompleted += add3;
                    }
                    if (c == 4)
                    {
                        wc[c].DownloadFileCompleted += add4;
                    }
                    if (c == 5)
                    {
                        wc[c].DownloadFileCompleted += add5;
                    }
                    if (c == 6)
                    {
                        wc[c].DownloadFileCompleted += add6;
                    }
                    if (c == 7)
                    {
                        wc[c].DownloadFileCompleted += add7;
                    }
                    if (c == 8)
                    {
                        wc[c].DownloadFileCompleted += add8;
                    }
                    if (c == 9)
                    {
                        wc[c].DownloadFileCompleted += add9;
                    }
                }

                for (int c = 0; c < threads; c++)
                {
                    if (c == 0)
                    {
                        wc[c].DownloadProgressChanged += wc_DownloadProgressChanged;
                    }
                    if (c == 1)
                    {
                        wc[c].DownloadProgressChanged += wc1_DownloadProgressChanged;
                    }
                    if (c == 2)
                    {
                        wc[c].DownloadProgressChanged += wc2_DownloadProgressChanged;
                    }
                    if (c == 3)
                    {
                        wc[c].DownloadProgressChanged += wc3_DownloadProgressChanged;
                    }
                    if (c == 4)
                    {
                        wc[c].DownloadProgressChanged += wc4_DownloadProgressChanged;
                    }
                    if (c == 5)
                    {
                        wc[c].DownloadProgressChanged += wc5_DownloadProgressChanged;
                    }
                    if (c == 6)
                    {
                        wc[c].DownloadProgressChanged += wc6_DownloadProgressChanged;
                    }
                    if (c == 7)
                    {
                        wc[c].DownloadProgressChanged += wc7_DownloadProgressChanged;
                    }
                    if (c == 8)
                    {
                        wc[c].DownloadProgressChanged += wc8_DownloadProgressChanged;
                    }
                    if (c == 9)
                    {
                        wc[c].DownloadProgressChanged += wc9_DownloadProgressChanged;
                    }
                }
                #endregion
            }
            else
            {
                for (int i = 0; i < threadselected; i++)
                {
                    using (wc[i])
                        wc[i].CancelAsync();
                }

                radioButton1.Enabled = true;
                radioButton2.Enabled = true;
                radioButton3.Enabled = true;

                isOn         = !isOn;
                button2.Text = "Start DL";
            }
        }