Пример #1
0
 //Edits an existing movie and its data
 public bool editMovie(string title, genreEnum genre, ratingEnum rating, string file, int year, string image, string description, List <string> actors, int index, out string result)
 {
     if (title.Trim() != "")
     {
         if (file.Trim() != "")
         {//Genre and Rating can never be null
             movieList[index].setTitle(title);
             movieList[index].Genre  = genre;
             movieList[index].Rating = rating;
             movieData[movieList[index].File].Year        = year;
             movieData[movieList[index].File].Image       = image;
             movieData[movieList[index].File].Description = description;
             movieData[movieList[index].File].addActors(actors);
             result = "File Edited";
             writeList();
             Console.WriteLine(movieList[index]);
             return(true);
         }
         else
         {
             result = "File field invalid";
             return(false);
         }
     }
     else
     {
         result = "Title field invalid";
         return(false);
     }
 }
Пример #2
0
 public simpleMovie(string title, string file, ratingEnum rating, genreEnum genre)
 {
     this.title = title;
     this.file = file;
     this.rating = rating;
     this.genre = genre;
     hasThe = theSubstringCheck();
 }
Пример #3
0
 //Image, Year, Description and Actors will be in a seperate data structure
 public simpleMovie(string title, string file)
 {
     this.title = title;
     this.file = file;
     genre = genreEnum.Unknown;
     rating = ratingEnum.Unknown;
     hasThe = theSubstringCheck();
 }
Пример #4
0
 public info(string title, string file, ratingEnum rating, genreEnum genre)
 {
     this.title = title;
     this.file = file;
     this.rating = rating;
     this.genre = genre;
     hasThe = theSubstringCheck();
     setThisID();
 }
Пример #5
0
 //Image, Year, Description and Actors will be in a seperate data structure
 //To be added, a MovieSet class, which contains a set of info class for movies of the same set (The Matrix, The Matrix 2..., The Matrix 3...)
 public info(string title, string file)
 {
     this.title = title;
     this.file = file;
     genre = genreEnum.Unknown;
     rating = ratingEnum.Unknown;
     hasThe = theSubstringCheck();
     setThisID();
 }
Пример #6
0
 public info(string title, string file, ratingEnum rating, genreEnum genre)
 {
     this.title  = title;
     this.file   = file;
     this.rating = rating;
     this.genre  = genre;
     hasThe      = theSubstringCheck();
     setThisID();
 }
Пример #7
0
        //Image, Year, Description and Actors will be in a seperate data structure



        //To be added, a MovieSet class, which contains a set of info class for movies of the same set (The Matrix, The Matrix 2..., The Matrix 3...)
        public info(string title, string file)
        {
            this.title = title;
            this.file  = file;
            genre      = genreEnum.Unknown;
            rating     = ratingEnum.Unknown;
            hasThe     = theSubstringCheck();
            setThisID();
        }
Пример #8
0
 //Adds a new movie and its data
 public bool addMovie(string title, genreEnum genre, ratingEnum rating, string file, int year, string image, string description, List <string> actors, out string result)
 {
     if (title.Trim() != "")
     {
         if (file.Trim() != "")
         {//Genre and Rating can never be null
             if (!movieData.ContainsKey(file))
             {
                 movieList.Add(new info(title, file, rating, genre));
                 movieData.Add(file, new data(year, image, description, 0));
                 if (actors.Count != 0)
                 {
                     movieData[file].addActors(actors);
                 }
                 result = "Movie added";
                 sorted = false;
                 writeList();
                 Console.WriteLine(movieList.Last());
                 return(true);
             }
             else
             {
                 result = "File already exists";
                 return(false);
             }
         }
         else
         {
             result = "File field invalid";
             return(false);
         }
     }
     else
     {
         result = "Title field invalid";
         return(false);
     }
 }
Пример #9
0
 public episode(string title, string file, ratingEnum rating, genreEnum genre, string seasonTitle, int epNumber)
     : base(title, file, rating, genre)
 {
 }
Пример #10
0
        public void readAll(ref List <info> readList)
        {
            string title = String.Empty;
            string file  = String.Empty;

            genreEnum  genre  = genreEnum.Unknown;
            ratingEnum rating = ratingEnum.Unknown;

            using (XmlReader reader = XmlReader.Create(this.file))
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        if (reader.Name == "Title")
                        {
                            title = reader.ReadElementContentAsString();
                            reader.MoveToNextAttribute();
                            if (reader.Name == "File") //These checks prevent the wrong field being read to the wrong variable
                            {
                                file = reader.ReadElementContentAsString();
                            }
                            reader.MoveToNextAttribute();
                            try
                            {
                                if (reader.Name == "Genre") //These checks prevent the wrong field being read to the wrong variable
                                {
                                    genre = (genreEnum)(Int32.Parse(reader.ReadElementContentAsString()));
                                }
                            }
                            catch (Exception e)
                            {
                                this.ge.GlobalTryCatch(e, "Genre Read In Error");
                                genre = genreEnum.Unknown;
                            }
                            reader.MoveToNextAttribute();

                            try
                            {
                                if (reader.Name == "Rating") //These checks prevent the wrong field being read to the wrong variable
                                {
                                    rating = (ratingEnum)(Int32.Parse(reader.ReadElementContentAsString()));
                                }
                            }
                            catch (Exception e)
                            {
                                this.ge.GlobalTryCatch(e, "Rating Read In Error");
                                rating = ratingEnum.Unknown;
                            }
                            reader.MoveToNextAttribute();

                            readList.Add(new info(title, file, rating, genre));
                            title  = "";
                            file   = "";
                            genre  = genreEnum.Unknown;
                            rating = ratingEnum.Unknown;
                        }
                    }
                }
            }
        }
Пример #11
0
 public episode(string title, string file, ratingEnum rating, genreEnum genre, string seasonTitle, int epNumber)
     : base(title, file, rating, genre)
 {
 }