예제 #1
0
        private void SearchVideos(String strPath)
        {
            String[] strSubDirectories = null;
            try
            {
                strSubDirectories = Directory.GetDirectories(strPath);
            }
            catch (Exception)
            {
                return;
            }
            if (strSubDirectories.Length > 0)
            {
                // Go inside
                foreach (String strSubDirectory in strSubDirectories)
                {
                    SearchVideos(strSubDirectory);
                }
            }

            String[] strFiles = null;
            try
            {
                strFiles = Directory.GetFiles(strPath);
            }
            catch (Exception)
            {
                // Do nothing
                return;
            }
            if (strFiles.Length > 0)
            {
                foreach (String strFile in strFiles)
                {
                    String strExtension = Path.GetExtension(strFile).ToLower();
                    if (strExtension.Length > 0)
                    {
                        strExtension = strExtension.Remove(0, 1);
                    }
                    if (alFileTypes.Contains(strExtension))
                    {
                        String strMovieName = Path.GetFileNameWithoutExtension(strFile);
                        vdb.AddMovie(strMovieName.ToUpper());
                        vdb.MovieName   = strMovieName;
                        vdb.MediaType   = strExtension;
                        vdb.Location    = strFile;
                        vdb.HasSubtitle = false;

                        // Check if it has subtitles.
                        String strSubtitlePath = Path.ChangeExtension(strFile, "srt");
                        if (File.Exists(strSubtitlePath))
                        {
                            vdb.HasSubtitle = true;
                        }
                    }
                }
            }
        }
예제 #2
0
        private void DatabaseTest()
        {
            VideoDatabase vdb = new VideoDatabase();

            vdb.MovieName   = "ayan";
            vdb.StarCast    = "suriya";
            vdb.Language    = "Tamil";
            vdb.HasSubtitle = true;
            vdb.Genre       = "Action";

            MessageBox.Show(vdb.MovieName);
            MessageBox.Show(vdb.StarCast);
            MessageBox.Show(vdb.Language);
            MessageBox.Show(vdb.Genre);
            MessageBox.Show(vdb.HasSubtitle.ToString());

            vdb.AddMovie("Nala Damayanti");

            vdb.AddExtension("dat");
            vdb.AddExtension("avi");

            vdb.AddSearchPath("F:\\Movies");
            vdb.AddSearchPath("L:\\DATA\\Movies");
        }