Exemplo n.º 1
0
 public void Load_anime_from_file(String text)
 {
     String[] lines = text.Split('\n');
     for (int i = 0; i < lines.Length; i++)
     {
         if (!lines[i].Contains("http"))
         {
             continue;
         }
         String[] line = new String[2];
         line[0] = lines[i].Substring(lines[i].IndexOf('{') + 1, lines[i].IndexOf('}') - lines[i].IndexOf('{') - 1);
         line[1] = lines[i].Substring(lines[i].IndexOf('[') + 1, lines[i].IndexOf(']') - lines[i].IndexOf('[') - 1);
         foreach (Data.Data.Anime a1 in Data.Data.list)
         {
             if (a1.title.Equals(line[0]))
             {
                 Data.Data.Anime a2 = a1;
                 a2.saved_in_file = true;
                 a2.link_to_anime = line[1];
                 Data.Data.list[Data.Data.list.IndexOf(a1)] = a2;
                 break;
             }
         }
     }
 }
Exemplo n.º 2
0
 private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)13)
     {
         textBox1.Text = am.Add_https(textBox1.Text);
         if (textBox1.Text.Equals("") || am.Is_It_Link_to_Anime(textBox1.Text))
         {
             int             current_column = dataGridView1.CurrentCell.ColumnIndex;
             int             curren_row     = comboBox1.SelectedIndex;
             Data.Data.Anime a1             = new Data.Data.Anime();
             a1 = sorted[comboBox1.SelectedIndex];
             a1.link_to_anime = textBox1.Text;
             Data.Data.list[Data.Data.list.IndexOf(sorted[comboBox1.SelectedIndex])] = a1;
             this.updated = true;
             Load_list();
             label1.Text = "Pomyślnie dodano podany link!";
             dataGridView1.CurrentCell = dataGridView1.Rows[curren_row].Cells[current_column];
             comboBox1.SelectedIndex   = curren_row;
         }
         else
         {
             label1.Text = "Nie udało się dodać podanego linku!";
         }
     }
 }
Exemplo n.º 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex == -1)
     {
         label1.Text = "Proszę wybrać anime!";
         return;
     }
     textBox1.Text = am.Add_https(textBox1.Text);
     if (textBox1.Text.Equals("") || am.Is_It_Link_to_Anime(textBox1.Text))
     {
         int             current_column = dataGridView1.CurrentCell.ColumnIndex;
         int             curren_row     = comboBox1.SelectedIndex;
         Data.Data.Anime a1             = new Data.Data.Anime();
         a1 = sorted[comboBox1.SelectedIndex];
         a1.link_to_anime = textBox1.Text;
         Data.Data.list[Data.Data.list.IndexOf(sorted[comboBox1.SelectedIndex])] = a1;
         this.updated = true;
         Load_list();
         label1.Text = "Pomyślnie dodano podany link!";
         dataGridView1.CurrentCell = dataGridView1.Rows[curren_row].Cells[current_column];
         comboBox1.SelectedIndex   = curren_row;
     }
     else
     {
         label1.Text = "Nie udało się dodać podanego linku!";
     }
 }
Exemplo n.º 4
0
        public void Load_anime_list(String htmlcode)
        {
            Boolean end_list = false;

            do
            {
                if (htmlcode.Contains("\"status\""))
                {
                    try
                    {
                        Data.Data.Anime am = new Data.Data.Anime();

                        htmlcode           = htmlcode.Substring(htmlcode.IndexOf("num_watched_episodes"));
                        am.num_watched     = int.Parse((htmlcode.Substring(htmlcode.IndexOf(":") + 1, htmlcode.IndexOf(",") - htmlcode.IndexOf(":") - 1)).Replace(" ", "").Replace("\"", ""));
                        htmlcode           = htmlcode.Substring(htmlcode.IndexOf("anime_title"));
                        am.title           = htmlcode.Substring(htmlcode.IndexOf(":") + 2, htmlcode.IndexOf(",") - htmlcode.IndexOf(":") - 3);
                        htmlcode           = htmlcode.Substring(htmlcode.IndexOf("anime_num_episodes"));
                        am.num_epiosde     = int.Parse((htmlcode.Substring(htmlcode.IndexOf(":") + 1, htmlcode.IndexOf(",") - htmlcode.IndexOf(":") - 1)).Replace(" ", "").Replace("\"", ""));
                        htmlcode           = htmlcode.Substring(htmlcode.IndexOf("anime_airing_status"));
                        am.airing          = (htmlcode.Substring(htmlcode.IndexOf(":") + 1, htmlcode.IndexOf(",") - htmlcode.IndexOf(":") - 1)).Replace(" ", "").Replace("\"", "") == "1" ? true : false;
                        htmlcode           = htmlcode.Substring(htmlcode.IndexOf("anime_image_path"));
                        am.image_url       = htmlcode.Substring(htmlcode.IndexOf(":") + 2, htmlcode.IndexOf(",") - htmlcode.IndexOf(":") - 3).Replace("\\", "");
                        htmlcode           = htmlcode.Substring(htmlcode.IndexOf("anime_start_date_string"));
                        am.year            = int.Parse(htmlcode.Substring(htmlcode.IndexOf(":") + 2, htmlcode.IndexOf(",") - htmlcode.IndexOf(":") - 3).Substring(6));
                        am.saved_in_file   = false;
                        am.link_to_anime   = "";
                        am.link_to_epiosde = "";
                        Data.Data.list.Add(am);
                    }
                    catch {
                        if (htmlcode.Contains("\"status\""))
                        {
                            htmlcode = htmlcode.Substring(htmlcode.IndexOf("\"status\""));
                        }
                        else
                        {
                            end_list = true;
                        }
                    }
                }
                else
                {
                    end_list = true;
                }
            } while (!end_list);
        }
Exemplo n.º 5
0
        private Boolean Check_Anime(Data.Data.Anime a1)
        {
            int num_episode;

            if (a1.saved_in_file)
            {
                num_episode = am.Last_Polish_Episode(a1.link_to_anime);
                if (a1.num_watched < num_episode)
                {
                    a1.link_to_epiosde = a1.link_to_anime.Replace("/anime/", "/odcinek/") + "/" + (a1.num_watched + 1);
                    Data.Data.new_episodes.Add(a1);
                }
                if (a1.link_to_anime.Equals(""))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                String link = am.Link_to_Anime(a1);
                num_episode = am.Last_Polish_Episode(link);
                Data.Data.Anime a2 = a1;
                a2.link_to_anime = link;
                Data.Data.list[Data.Data.list.IndexOf(a1)] = a2;
                if (a1.num_watched < num_episode)
                {
                    a2.link_to_epiosde = link.Replace("/anime/", "/odcinek/") + "/" + (a1.num_watched + 1);
                    Data.Data.new_episodes.Add(a2);
                }
                if (a2.link_to_anime.Equals(""))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }