Exemplo n.º 1
0
 public static Episode[] LoadEpisodesFromFile(string fileName)
 {
     string[]  episodesInputs = File.ReadAllLines(fileName);
     Episode[] episodes       = new Episode[episodesInputs.Length];
     for (int i = 0; i < episodes.Length; i++)
     {
         episodes[i] = TvUtilities.Parse(episodesInputs[i]);
     }
     return(episodes);
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string   fileName       = "shows.txt";
            string   outputFileName = "storage.txt";
            IPrinter printer        = new ConsolePrinter();

            printer.Print($"Reading data from file {fileName}");
            Episode[] episodes = TvUtilities.LoadEpisodesFromFile(fileName);
            Season    season   = new Season(1, episodes);

            printer.Print(season.ToString());
            for (int i = 0; i < episodes.Length; i++)
            {
                season[i].AddView(TvUtilities.GenerateRandomScore());
            }
            printer.Print(season.ToString());
            printer = new FilePrinter(outputFileName);
            printer.Print(season.ToString());
        }