Exemple #1
0
        private void GetEpisodeList(AnimeDetails anime, ListView episodeList)
        {
            gbl_episodeList.Clear();
            DirectoryInfo animeFolder  = new DirectoryInfo(dataPath + anime.title);
            int           episodeIndex = 1;

            foreach (FileInfo file in animeFolder.EnumerateFiles())
            {
                if (file.Extension.ToLower() == ".mkv" || file.Extension.ToLower() == ".mp4")
                {
                    string[] arr = new string[2];
                    arr[0] = "Episode " + episodeIndex;
                    arr[1] = file.LastWriteTime.ToString("yyyy-MM-dd");
                    ListViewItem item = new ListViewItem(arr);
                    if (episodeIndex > anime.lastwatched)
                    {
                        item.SubItems[0].Text     += " *NEW*";
                        item.SubItems[0].ForeColor = Color.Red;
                    }
                    item.ToolTipText = "Watch Episode " + episodeIndex;
                    episodeList.Items.Add(item);
                    gbl_episodeList.Add(file.FullName);
                    episodeIndex++;
                }
            }
        }
Exemple #2
0
        private void GetDesc(AnimeDetails anime)
        {
            using (SqlConnection sqlConn = new SqlConnection(strConn))
            {
                try
                {
                    sqlConn.Open();
                    string        strQuery  = "SELECT * FROM [Anime Manager].[dbo].[tbl_ANIME_MAIN] WHERE a_title='" + anime.title + "'";
                    SqlCommand    sqlCmd    = new SqlCommand(strQuery, sqlConn);
                    SqlDataReader sqlRdr    = sqlCmd.ExecuteReader();
                    bool          dataFound = false;
                    while (sqlRdr.Read())
                    {
                        dataFound         = true;
                        anime.genres      = sqlRdr.GetValue(2).ToString().Split(',').ToList();
                        anime.lastwatched = Convert.ToInt32(sqlRdr.GetValue(3));
                        if (sqlRdr.GetValue(1) != null)
                        {
                            anime.desc = sqlRdr.GetValue(1).ToString();
                        }
                        else
                        {
                            anime.desc = "< No Description >";
                        }
                    }
                    if (!dataFound)
                    {
                        anime.desc = "< No Description >";
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                try
                {
                    sqlConn.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            DirectoryInfo mainFolder = new DirectoryInfo(dataPath);
            int           currentX   = 15;
            int           currentY   = 15;

            Panel mainScreen = new Panel
            {
                Location = new Point(0, 0),
                AutoSize = true,
                Name     = "MainScreen"
            };

            splitContainer1.Panel2.Controls.Add(mainScreen);
            //this.Controls.Add(mainScreen);

            foreach (DirectoryInfo animeFolder in mainFolder.EnumerateDirectories())
            {
                string       animeTitle = animeFolder.Name;
                bool         iconFound  = false;
                AnimeDetails newAnime   = new AnimeDetails
                {
                    title = animeTitle
                };

                Panel animeIcon = new Panel
                {
                    Location = new Point(currentX, currentY),
                    Size     = new Size(225, 250),
                    Name     = "pnl" + animeTitle.Split()[0],
                    AutoSize = true,
                    Cursor   = Cursors.Hand
                };
                mainScreen.Controls.Add(animeIcon);
                animeIcon.Click      += new EventHandler(GoToDetails);
                animeIcon.MouseEnter += new EventHandler(IconHover);
                animeIcon.MouseLeave += new EventHandler(IconDefault);

                foreach (FileInfo file in animeFolder.EnumerateFiles())
                {
                    if (file.Name.StartsWith("thumbnail"))
                    {
                        PictureBox thumbnail = new PictureBox
                        {
                            Location      = new Point(5, 5),
                            ImageLocation = file.FullName,
                            Size          = new Size(225, 225)
                        };
                        if (Image.FromFile(file.FullName).Width > thumbnail.Width || Image.FromFile(file.FullName).Height > thumbnail.Height)
                        {
                            thumbnail.SizeMode = PictureBoxSizeMode.Zoom;
                        }
                        else
                        {
                            thumbnail.SizeMode = PictureBoxSizeMode.CenterImage;
                        }
                        animeIcon.Controls.Add(thumbnail);
                        thumbnail.Click      += new EventHandler(GoToDetails);
                        thumbnail.MouseEnter += new EventHandler(IconHover);
                        thumbnail.MouseLeave += new EventHandler(IconDefault);
                        iconFound             = true;
                        newAnime.imgpath      = file.FullName;
                    }
                }

                if (!iconFound)
                {
                    PictureBox thumbnail = new PictureBox
                    {
                        Location      = new Point(5, 5),
                        ImageLocation = noImagePath,
                        Size          = new Size(225, 225)
                    };
                    if (Image.FromFile(noImagePath).Width > thumbnail.Width || Image.FromFile(noImagePath).Height > thumbnail.Height)
                    {
                        thumbnail.SizeMode = PictureBoxSizeMode.Zoom;
                    }
                    else
                    {
                        thumbnail.SizeMode = PictureBoxSizeMode.CenterImage;
                    }
                    animeIcon.Controls.Add(thumbnail);
                    thumbnail.Click      += new EventHandler(GoToDetails);
                    thumbnail.MouseEnter += new EventHandler(IconHover);
                    thumbnail.MouseLeave += new EventHandler(IconDefault);
                    newAnime.imgpath      = noImagePath;
                }

                Label title = new Label
                {
                    Location  = new Point(5, 230),
                    Text      = animeTitle,
                    Width     = 225,
                    TextAlign = ContentAlignment.MiddleCenter,
                    Font      = new Font("Arial", 10, FontStyle.Bold)
                };
                animeIcon.Controls.Add(title);
                title.Click      += new EventHandler(GoToDetails);
                title.MouseEnter += new EventHandler(IconHover);
                title.MouseLeave += new EventHandler(IconDefault);

                if (currentX > 1050 - 250 * 2)
                {
                    currentY += 270;
                    currentX  = 15;
                }
                else
                {
                    currentX += 250;
                }

                gbl_animeList.Add(newAnime);
            }
        }