Esempio n. 1
0
 private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {
     for (int i = 0; i < dictionary.Count; i++)
     {
         currentMovie = dictionary.ElementAt(i).Key.fileName;
         backgroundWorker1.ReportProgress(i);
         dictionary[dictionary.ElementAt(i).Key] = TheMovieDB.getMovieBean(dictionary.ElementAt(i).Key);
         progress++;
     }
 }
Esempio n. 2
0
        private void importDataToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            MovieBean importedMovie = TheMovieDB.getMovieBean(movie);

            importedMovie.dateAdded    = movie.dateAdded;
            importedMovie.fileName     = movie.fileName;
            importedMovie.fullPath     = movie.fullPath;
            importedMovie.uniqueID     = movie.uniqueID;
            importedMovie.watched      = movie.watched;
            importedMovie.watchedDates = movie.watchedDates;

            movie = importedMovie;
            setupScreen();
            Cursor = Cursors.Default;
        }
Esempio n. 3
0
        private bool importMovie(string filePath, bool getData)
        {
            //don't add the file if it has already been added
            bool addFile = true;

            foreach (MovieBean movie in files.movies)
            {
                if (movie.fullPath.Equals(filePath))
                {
                    addFile = false;
                }
            }

            if (!File.Exists(filePath))
            {
                addFile = false;
            }


            if (Directory.Exists(filePath))
            {
                addFile = false;
                foreach (String file in Directory.GetFiles(filePath).Union(Directory.GetDirectories(filePath)))
                {
                    importMovie(file, getData);
                }
            }

            if (addFile && GlobalFunctions.isVideoFile(filePath))
            {
                //create and add a MovieBean to Storage.movies
                MovieBean movie = new MovieBean();
                movie.setup(filePath, getUniqueID());
                if (getData)
                {
                    movie = movie.merge(TheMovieDB.getMovieBean(movie));
                }
                files.movies.Add(movie);
                files.addMovieScan(Path.GetDirectoryName(filePath));
                return(true);
            }
            return(false);
        }