Пример #1
0
 public static string Serialize(AbstractMovie movie)
 {
     StringBuilder result = new StringBuilder();
     switch (movie.Genre)
     {
         case "TV Shov":
             TVShow show = movie as TVShow;
             if (show == null) throw new ArgumentException();
             result.Append(show.Genre);
             result.Append(';');
             result.Append(show.Name);
             result.Append(';');
             result.Append(show.Director);
             result.Append(';');
             result.Append(show.EpisodePrice);
             result.Append(';');
             result.Append(show.EpisodesCount);
             break;
         case "Action":
             Action action = movie as Action;
             if (action == null) throw new ArgumentException();
             result.Append(action.Genre);
             result.Append(';');
             result.Append(action.Name);
             result.Append(';');
             result.Append(action.Director);
             result.Append(';');
             result.Append(action.TricksCost);
             result.Append(';');
             result.Append(action.ActionDirector);
             result.Append(';');
             result.Append(action.ActionDirector);
             break;
     }
     return result.ToString();
 }
Пример #2
0
 void onMovieAdd(object sender, AbstractMovie movie)
 {
     data.Add(movie);
     UpdateContent();
 }