internal Rating(IEnumerable<XElement> rating) { var r = (from ratingattrib in rating select new { Rating = (String)ratingattrib.Attribute("label") ?? "None", Type = (String)ratingattrib.Attribute("scheme") }).FirstOrDefault(); MpaaRating = Holders.MpaaRating.None; TvRating = Holders.TvRating.None; if (r == null || r.Rating == "None") { ///this is bads } else { if (r.Type.Contains("mpaa")) { switch (r.Rating) { case "R": MpaaRating = Holders.MpaaRating.R; break; case "PG-13": MpaaRating = Holders.MpaaRating.PG13; break; case "PG": MpaaRating = Holders.MpaaRating.PG; break; case "NC-17": MpaaRating = Holders.MpaaRating.NC17; break; case "NR": case "UR": MpaaRating = Holders.MpaaRating.Unrated; break; case "G": MpaaRating = Holders.MpaaRating.G; break; default: MpaaRating = Holders.MpaaRating.None; break; } } else { switch (r.Rating) { case "PG": TvRating = Holders.TvRating.PG; break; case "TV-14": TvRating = Holders.TvRating.TV14; break; default: TvRating = Holders.TvRating.None; break; } } } }
public Rating(String rating) { MpaaRating = Holders.MpaaRating.None; TvRating = Holders.TvRating.None; }