private void SetHeaders(BooruProcessor.SourceType srcType) { shc.Referer = referer; shc.AcceptEncoding = SessionHeadersValue.AcceptEncodingGzip; shc.AutomaticDecompression = System.Net.DecompressionMethods.GZip; SetHeaderType(srcType); }
public SiteBooru(string siteUrl, string tagUrl, string siteName, string shortName, string referer, bool needMinus, BooruProcessor.SourceType srcType) { this.siteName = siteName; this.siteUrl = siteUrl; this.tagUrl = tagUrl; this.shortName = shortName; this.referer = referer; this.needMinus = needMinus; this.srcType = srcType; //ShowExplicit = false; }
/// <summary> /// Use after successful login /// </summary> /// <param name="siteUrl">站点解析地址</param> /// <param name="tagUrl">tag自动提示地址</param> /// <param name="siteName">站点名</param> /// <param name="shortName">站点短名</param> /// <param name="needMinus">页码是否从0开始</param> /// <param name="srcType">解析类型</param> /// <param name="shc">Headers</param> public SiteBooru(string siteUrl, string tagUrl, string siteName, string shortName, bool needMinus, BooruProcessor.SourceType srcType, SessionHeadersCollection shc) { this.siteName = siteName; this.siteUrl = siteUrl; this.tagUrl = tagUrl; this.shortName = shortName; referer = shc.Referer; this.needMinus = needMinus; this.srcType = srcType; this.shc = shc; }
/// <summary> /// Booru Site /// </summary> /// <param name="siteUrl">站点解析地址</param> /// <param name="url">图库服务器地址</param> /// <param name="tagUrl">tag自动提示地址</param> /// <param name="siteName">站点名</param> /// <param name="shortName">站点短名</param> /// <param name="referer">引用地址</param> /// <param name="needMinus">页码是否从0开始</param> /// <param name="srcType">解析类型</param> /// <param name="loginUrl">登录地址</param> public SiteBooru(string siteUrl, string url, string tagUrl, string siteName, string shortName, string referer, bool needMinus, BooruProcessor.SourceType srcType, string loginUrl = null) { Url = url; this.siteName = siteName; this.shortName = shortName; this.siteUrl = siteUrl; this.tagUrl = tagUrl; this.referer = referer; this.needMinus = needMinus; this.srcType = srcType; this.loginUrl = loginUrl; SetHeaders(srcType); siteLoginUser.Add(shortName, null); siteLoginCookie.Add(shortName, null); }
/// <summary> /// Use after successful login /// </summary> /// <param name="siteUrl">站点解析地址</param> /// <param name="url">图库服务器地址</param> /// <param name="tagUrl">tag自动提示地址</param> /// <param name="siteName">站点名</param> /// <param name="shortName">站点短名</param> /// <param name="needMinus">页码是否从0开始</param> /// <param name="srcType">解析类型</param> /// <param name="shc">Headers</param> /// <param name="loginUrl">登录地址</param> public SiteBooru(string siteUrl, string url, string tagUrl, string siteName, string shortName, bool needMinus, BooruProcessor.SourceType srcType, SessionHeadersCollection shc, string loginUrl = null) { Url = url; this.siteName = siteName; this.shortName = shortName; this.siteUrl = siteUrl; this.tagUrl = tagUrl; referer = shc.Referer; this.needMinus = needMinus; this.srcType = srcType; this.shc = shc; this.loginUrl = loginUrl; siteLoginUser.Add(shortName, null); siteLoginCookie.Add(shortName, null); }
private void SetHeaderType(BooruProcessor.SourceType srcType) { switch (srcType) { case BooruProcessor.SourceType.JSON: case BooruProcessor.SourceType.JSONNV: case BooruProcessor.SourceType.JSONSku: shc.Accept = shc.ContentType = SessionHeadersValue.AcceptAppJson; break; case BooruProcessor.SourceType.XML: case BooruProcessor.SourceType.XMLNV: shc.Accept = shc.ContentType = SessionHeadersValue.AcceptTextXml; break; default: shc.ContentType = SessionHeadersValue.AcceptTextHtml; break; } }