public List<IEpisode> GetEpisodes(string token, TypeEpisode type = TypeEpisode.All, bool next = false) { IUser user = UserFactory.CreateUser(); user.Token = token; return GetEpisodes(user, type, next); }
public List<IEpisode> GetEpisodes(IUser user, TypeEpisode type = TypeEpisode.All, bool next = false) { return user.GetEpisodes(type, next); }
public List<IEpisode> GetEpisodes(TypeEpisode type = TypeEpisode.All, bool next = false) { List<IEpisode> list = new List<IEpisode>(); string stype = type.ToString().ToLower(); string url = string.Format("/members/episodes/{0}.xml", stype); string param = string.Format("&token={0}", this.Token); if (next) param += "&view=next"; XmlDocument doc = Utils.UtilsXML.GetUrl(url, param); XmlElement xe = doc["root"]["episodes"]; if (xe == null) { throw new BetaSeriesException(1003, "Invalid action."); } foreach (XmlElement e in xe.GetElementsByTagName("episode")) { // there is an episode inside episode... if (e.ParentNode.Name.Equals("episode")) continue; IEpisode episode = EpisodeFactory.CreateEpisode(e); ; list.Add(episode); } return list; }