コード例 #1
0
ファイル: Program.cs プロジェクト: PrabhatAjmani/IMDBRater
        static void Main(string[] args)
        {
            var directorySearch            = new DirectoryRepository();
            var modifyDirectoryName        = new ModifyDirectoryName();
            List <DirectoryInfo> movieList = new List <DirectoryInfo>();

            try
            {
                movieList = GetMovieList(directorySearch);

                foreach (var movie in movieList)
                {
                    var rating = GetMovieInfo(movie.Name);

                    if (rating != null)
                    {
                        UpdateMovieDirectoryNameWithRating(movie, rating, modifyDirectoryName);
                    }
                }

                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadLine();
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: PrabhatAjmani/IMDBRater
        private static void UpdateMovieDirectoryNameWithRating(DirectoryInfo movie, string movieRating, ModifyDirectoryName modifyDirectoryName)
        {
            var rating = movieRating.Remove(0, 12);

            rating = rating.Remove(3, 1);

            if (rating.Equals("N/A"))
            {
                rating = rating.Remove(1, 1);
            }

            modifyDirectoryName.Rename(movie, rating);
        }