public async Task <CommunitySearchResponse> SearchCommunity( string keyword , uint page , CommunitySearchSort sort = CommunitySearchSort.CreatedAt , Order order = Order.Descending , CommunitySearchMode mode = CommunitySearchMode.Keyword ) { if (_HohoemaApp.NiconicoContext == null) { return(null); } if (!_HohoemaApp.IsLoggedIn) { return(null); } return(await ConnectionRetryUtil.TaskWithRetry(async() => { using (var releaser = await _NicoPageAccessLock.LockAsync()) { return await _HohoemaApp.NiconicoContext.Search.CommunitySearchAsync(keyword, page, sort, order, mode); } })); }
public static Task <CommunitySearchResponse> CommunitySearchAsync( NiconicoContext context , string keyword , uint page , CommunitySearchSort sort , Order order , CommunitySearchMode mode ) { return(GetCommunitySearchPageHtmlAsync(context, keyword, page, sort, order, mode) .ContinueWith(prevTask => ParseCommunitySearchPageHtml(prevTask.Result))); }
public async Task <CommunitySearchResponse> SearchCommunity( string keyword , uint page , CommunitySearchSort sort = CommunitySearchSort.CreatedAt , Order order = Order.Descending , CommunitySearchMode mode = CommunitySearchMode.Keyword ) { return(await ContextActionAsync(async context => { return await context.Search.CommunitySearchAsync(keyword, page, sort, order, mode); })); }
public static string ToShortString(this CommunitySearchMode mode) { switch (mode) { case CommunitySearchMode.Keyword: return("s"); case CommunitySearchMode.Tag: return("t"); default: throw new NotSupportedException(); } }
public static Task <string> GetCommunitySearchPageHtmlAsync( NiconicoContext context , string str , uint page , CommunitySearchSort sort , Order order , CommunitySearchMode mode ) { var dict = new Dictionary <string, string>(); dict.Add("__format", "json"); dict.Add(nameof(page), page.ToString()); dict.Add(nameof(order), order.ToChar().ToString()); dict.Add(nameof(sort), sort.ToShortString()); dict.Add(nameof(mode), mode.ToShortString()); return(context.GetStringAsync(NiconicoUrls.CommynitySearchPageUrl + str, dict)); }
public static void SearchCommunity(this PageManager pageManager, string content, Mntone.Nico2.Order order, CommunitySearchSort sort, CommunitySearchMode mode) { var payload = new CommunitySearchPagePayloadContent() { Keyword = content, Order = order, Sort = sort, Mode = mode }; pageManager.OpenPage(HohoemaPageType.SearchResultCommunity, payload.ToParameterString()); }