Exemple #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);
     }
 }
Exemple #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();
 }
Exemple #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();
 }
Exemple #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();
 }
Exemple #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();
 }
Exemple #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();
 }
Exemple #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();
        }
Exemple #8
0
        public Book(string title, string author, genreEnum genre, int pub_year,
                    string Edition_Lang, int ID_No)

        {
            this.Title        = title;
            this.Author       = author;
            this.Genre        = genre;
            this.Pub_Year     = pub_year;
            this.Edition_Lang = Edition_Lang;
            this.ID_No        = ID_No;
        }
Exemple #9
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);
     }
 }
Exemple #10
0
 public episode(string title, string file, ratingEnum rating, genreEnum genre, string seasonTitle, int epNumber)
     : base(title, file, rating, genre)
 {
 }
Exemple #11
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;
                        }
                    }
                }
            }
        }
Exemple #12
0
 public episode(string title, string file, ratingEnum rating, genreEnum genre, string seasonTitle, int epNumber)
     : base(title, file, rating, genre)
 {
 }