本文整理汇总了C#中People.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# People.AddRange方法的具体用法?C# People.AddRange怎么用?C# People.AddRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类People
的用法示例。
在下文中一共展示了People.AddRange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SearchEverything
/// <summary>
/// Make a catalog/titles search request
/// </summary>
/// <param name="SearchTerm"></param>
/// <param name="Limit"></param>
/// <param name="OnUserBehalf">Make the request on the user's behalf if a
/// GetCurrentUserNetflixUserInfo delegate was provided during creation.</param>
/// <returns></returns>
public async Task<SearchResults> SearchEverything(String SearchTerm, Int32 Limit = 20, Boolean OnUserBehalf = true,
TitleExpansion TitleExpansionLevel = TitleExpansion.Minimal,
PersonExpansion PersonExpansionLevel = PersonExpansion.Minimal)
{
Login.CheckInformationSet();
Dictionary<String, String> extraParams = new Dictionary<String, String>();
extraParams.Add("term", OAuthHelpers.Encode(SearchTerm));
extraParams.Add("max_results", Limit.ToString());
String tokenSecret = "";
if (OnUserBehalf)
{
Account na = FlixSharp.Netflix.SafeReturnUserInfo();
if (na != null)
{
tokenSecret = na.TokenSecret;
extraParams.Add("oauth_token", na.Token);
}
}
String personurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
Login.ConsumerKey,
Constants.CatalogPeopleSearcUrl,
"GET",
tokenSecret,
extraParams);
var persondoc = AsyncHelpers.NetflixLoadXDocumentAsync(personurl);
String titleurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
Login.ConsumerKey,
Constants.CatalogTitleSearchUrl,
"GET",
tokenSecret,
extraParams);
var moviedoc = AsyncHelpers.NetflixLoadXDocumentAsync(titleurl);
People people = new People();
switch (PersonExpansionLevel)
{
case PersonExpansion.Minimal:
people.AddRange(from person
in (await persondoc).Descendants("person")
select new Person(PersonExpansion.Minimal)
{
IdUrl = person.Element("id").Value,
Name = person.Element("name").Value,
Bio = (String)person.Element("bio")
});
break;
case PersonExpansion.Complete:
people.AddRange(await AsyncFiller.GetCompleteNetflixPersonDetails(await persondoc));
break;
}
Titles movies = new Titles();
switch (TitleExpansionLevel)
{
case TitleExpansion.Minimal:
movies.AddRange(await Fill.GetBaseTitleInfo(moviedoc, "catalog_title"));
break;
case TitleExpansion.Expanded:
movies.AddRange(await AsyncFiller.GetExpandedMovieDetails(await moviedoc));
break;
case TitleExpansion.Complete:
movies.AddRange(await AsyncFiller.GetCompleteNetflixMovieDetails(await moviedoc));
break;
}
SearchResults sr = new SearchResults();
sr.MovieResults = movies;
sr.PeopleResults = people;
sr.SearchTerm = SearchTerm;
return sr;
}
示例2: GetDirectors
private async Task<People> GetDirectors(String NetflixId, Dictionary<String, String> ExtraParams, String TokenSecret, NetflixType? TitleType = null)
{
TitleType = Fill.GetNetflixType(NetflixId, TitleType);
var idtup = GeneralHelpers.GetIdFromUrl(NetflixId);
String url = "";
switch (TitleType)
{
case NetflixType.Movie:
url = String.Format(Constants.MoviesDirectors, idtup.Id);
break;
case NetflixType.Series:
url = String.Format(Constants.SeriesDirectors, idtup.Id);
break;
case NetflixType.SeriesSeason:
url = String.Format(Constants.SeriesSeasonsDirectors, idtup.Id, idtup.SeasonId);
break;
default: throw new Exception("Invalid request for TitleType: " + TitleType);
}
url = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
Login.ConsumerKey,
url,
"GET",
TokenSecret,
ExtraParams);
var doc = await AsyncHelpers.NetflixLoadXDocumentAsync(url);
People people = new People();
people.AddRange(from person
in doc.Element("people").Elements("person")
select new Person(PersonExpansion.Minimal)
{
IdUrl = person.Element("id").Value,
Name = person.Element("name").Value,
Bio = (String)person.Element("bio")
});
return people;
}
示例3: SearchPeople
public async Task<People> SearchPeople(String Name, Int32 Limit = 10, Boolean OnUserBehalf = true,
PersonExpansion ExpansionLevel = PersonExpansion.Minimal)
{
Login.CheckInformationSet();
Dictionary<String, String> extraParams = new Dictionary<String, String>();
extraParams.Add("term", OAuthHelpers.Encode(Name));
extraParams.Add("max_results", Limit.ToString());
String tokenSecret = "";
//String token = "";
if (OnUserBehalf)
{
Account na = FlixSharp.Netflix.SafeReturnUserInfo();
if (na != null)
{
tokenSecret = na.TokenSecret;
extraParams.Add("oauth_token", na.Token);
}
}
String personurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
Login.ConsumerKey,
Constants.CatalogPeopleSearcUrl,
"GET",
tokenSecret,
extraParams);
var persondoc = AsyncHelpers.NetflixLoadXDocumentAsync(personurl);
People people = new People();
switch (ExpansionLevel)
{
case PersonExpansion.Minimal:
people.AddRange(from person
in (await persondoc).Element("people").Elements("person")
select new Person(PersonExpansion.Minimal)
{
IdUrl = person.Element("id").Value,
Name = person.Element("name").Value,
Bio = (String)person.Element("bio")
});
break;
case PersonExpansion.Complete:
people.AddRange(await AsyncFiller.GetCompleteNetflixPersonDetails(await persondoc));
break;
}
return people;
}