public virtual void Handle(HttpRequestMessage httpRequestMessage) { switch (httpRequestMessage.RequestUri.DnsSafeHost) { case "app-api.pixiv.net": var token = httpRequestMessage.Headers.Authorization; if (token != null) { if (Session.Current.AccessToken.IsNullOrEmpty()) { throw new TokenNotFoundException( $"{nameof(Session.Current.AccessToken)} is empty, this exception should never be thrown, if you see this message, please send issue on github or contact me ([email protected])"); } httpRequestMessage.Headers.Authorization = new AuthenticationHeaderValue(token.Scheme, Session.Current.AccessToken); } break; case var x when x == "pixiv.net" || x == "www.pixiv.net": if (Session.Current.PhpSessionId.IsNullOrEmpty()) { throw new TokenNotFoundException( $"{nameof(Session.Current.PhpSessionId)} is empty, this exception should never be thrown, if you see this message, please send issue on github or contact me ([email protected])"); } httpRequestMessage.Headers.TryAddWithoutValidation("Cookie", $"PHPSESSID={Session.Current.PhpSessionId}"); break; } if (!httpRequestMessage.Headers.Contains("Accept-Language")) { httpRequestMessage.Headers.TryAddWithoutValidation("Accept-Language", AkaI18N.GetCultureAcceptLanguage()); } }
public RankOptionModel(RankOption option) { Corresponding = option; Name = AkaI18N.GetResource(option.GetEnumAttribute <EnumLocalizedName>().Name); }
public SearchTagMatchOptionModel(SearchTagMatchOption corresponding) { Description = AkaI18N.GetResource(corresponding.GetEnumAttribute <EnumLocalizedName>().Name); Corresponding = corresponding; }
private void CultureSelector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { AkaI18N.Reload((I18NOption)CultureSelector.SelectedItem); }