Ejemplo n.º 1
0
        private anim_inf dowload_page(string hex)
        {
            string val = "http://www.world-art.ru/animation/animation.php?id=" + hex;
            HttpWebRequest webreque = (HttpWebRequest)WebRequest.Create(val);
            // webreque.Accept = "*/*";
            //webreque.Referer = "";
            // webreque.Headers.Add("Accept-Language", "ru");
            // webreque.Headers.Add("Accept-Encoding", "gzip, deflate");
            webreque.UserAgent = "Opera/9.80 (Windows NT 5.1; U; MRA 5.7 (build 03797); ru) Presto/2.10.229 Version/11.60";
            //webreque.ContentType = @"text/html; charset=windows-1251";
            HttpWebResponse webrespon;
            webrespon = (HttpWebResponse)webreque.GetResponse();
            StreamReader str_read = new StreamReader(webrespon.GetResponseStream(), Encoding.GetEncoding("windows-1251"));
            string str = str_read.ReadToEnd();
              //  string temp = "<a href='list.php?genre_2=";
            string temp = "list.php' class='estimation'>";
            int ind=0;
            int jj=0;
            anim_inf ai = new anim_inf();
            while (ind != -1)
            {
                ind = str.IndexOf(temp, ind);
                if(ind==-1) break;
                string zhanr = "";
                ind+=temp.Length;
                while (true)
                {
                    if (str[ind] != '<')
                    {
                        zhanr += str[ind];
                        ind++;
                    }
                    else break;
                }
                ai.zhanr += zhanr+"|";
            }
            temp = "<p align=justify class='review'>";
            ind = str.IndexOf(temp);
            int ind_start;
            int len;
            string opis = "";
            if (ind != -1)
            {
                ind_start = ind + temp.Length;
                int ind_end = str.IndexOf("</p>", ind_start);
                if (ind_end != -1)
                {
                    len = ind_end - ind_start;
                    opis = str.Substring(ind_start, len);
                    opis = opis.Replace("<br>", "\n");
                    ai.opisanie = opis;
                }
            }

            temp = "<html><head><title>";
            ind = str.IndexOf(temp);
            opis = "";
            if (ind != -1)
            {
                ind_start = ind + temp.Length;
                int ind_end = str.IndexOf("</title>", ind_start);
                if (ind_end != -1)
                {
                    len = ind_end - ind_start;
                    opis = str.Substring(ind_start, len);
                    opis = opis.Replace("Аниме - ", "");
                    opis = opis.Replace("\n", "");
                    ai.name_a = opis;
                }
            }
            ai.god = GetPartText("<font size=3 color=#990000>", "</font>", str);
            ai.tip = GetPartText("<br><b>Тип</b>:", "<br>", str);
            return ai;
        }
Ejemplo n.º 2
0
 private void button6_Click(object sender, EventArgs e)
 {
     ClearWindowAdd();
     anim_inf ai = new anim_inf();
     string Id_a = "";
     if (textBox6.Text != "")
     {
         Form_Spis_Anime f_spis_a = new Form_Spis_Anime();
         f_spis_a.Owner = this;
         f_spis_a.name_a = textBox6.Text;
         f_spis_a.ShowDialog();
     }
     if (textBox7.Text != "")
     {
         ai = dowload_page(textBox7.Text);
         ai.name_a = ai.name_a.Replace("&#x27;", "'");
         textBox2.Text = ai.god;
         textBox3.Text = ai.tip;
         char[] charSeparator = { '|' };
         string[] zhanr_mas = ai.zhanr.Split(charSeparator);
         if (ai.name_a != "") textBox1.Text = ai.name_a;
         if (ai.opisanie != "") textBox4.Text = ai.opisanie;
         ComboBox[] combo = GetComboBox();
         int jj = 0;
         for (int i = 0; i < zhanr_mas.Length - 1; i++)
         {
             combo[i].SelectedIndex = combo[i].FindStringExact(zhanr_mas[i]);
         }
         pictureBox1.Load(download_Image(textBox7.Text));
         if (auto && next)
         {
             button5_Click(this, EventArgs.Empty);
         }
     }
     else
     {
         auto = false;
         next = false;
     }
 }