private void Authentication(Profile profile) { _logger.Debug("Authentication"); try { var url = string.Format(@"http://api.myshows.ru/profile/login?login={0}&password={1}", profile.Login, profile.Password); var resp = ExecuteRequest(url); } catch (WebException ex) { throw new InvalidOperationException("Auth error: " + ex); } }
public ApiParser(Profile profile) { _profile = profile; }
/// <summary> /// Create a new Profile object. /// </summary> /// <param name="profileId">Initial value of the ProfileId property.</param> /// <param name="login">Initial value of the Login property.</param> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="password">Initial value of the Password property.</param> public static Profile CreateProfile(global::System.Int64 profileId, global::System.String login, global::System.Int32 userId, global::System.String password) { Profile profile = new Profile(); profile.ProfileId = profileId; profile.Login = login; profile.UserId = userId; profile.Password = password; return profile; }
public void ReadSeries(Profile profile) { var url = string.Format("http://api.myshows.ru/rss/{0}/episodes/aired/", profile.UserId); var xml = XDocument.Parse(new WebClientEx().DownloadString(url)); var channel = xml.Root.Element("channel"); foreach (var item in channel.Elements("item")) { var title = item.Element("title").Value; var seriesName = title.Substring(0, title.LastIndexOf(' ')); var episodeName = title.Substring(title.LastIndexOf(' ') + 1); var series = profile.Series.FirstOrDefault(s => s.Title == seriesName); if (series == null) profile.Series.Add(series = new Series(seriesName)); var episode = series.Episodes.FirstOrDefault(e => e.CodedName == episodeName); if (episode == null) series.Episodes.Add(episode = new Episode(episodeName)); } }
/// <summary> /// Deprecated Method for adding a new object to the Profiles EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProfiles(Profile profile) { base.AddObject("Profiles", profile); }