// TODO: remove this method after removing obsolete constructors. private protected static BooruOptions[] CombineArrays(BooruOptions[] arr1, BooruOptions[] arr2) { var arr = new BooruOptions[arr1.Length + arr2.Length]; arr1.CopyTo(arr, 0); arr2.CopyTo(arr, arr1.Length); return(arr); }
protected static BooruOptions MergeOptions(BooruOptions[] array) { BooruOptions options = BooruOptions.none; for (int i = 0; i < array.Length; i++) { options |= array[i]; } return(options); }
protected ABooru(string baseUrl, UrlFormat format, BooruOptions options) { Auth = null; HttpClient = null; _options = options; bool useHttp = UsesHttp(); // Cache returned value for faster access. #pragma warning disable CS0618 // Keep this field for a while in case someone still depends on it. _useHttp = useHttp; #pragma warning restore CS0618 _baseUrl = "http" + (useHttp ? "" : "s") + "://" + baseUrl; _format = format; _imageUrl = "http" + (useHttp ? "" : "s") + "://" + baseUrl + "/" + GetUrl(format, "post"); if (_format == UrlFormat.indexPhp) { _imageUrlXml = _imageUrl.Replace("json=1", "json=0"); } else if (_format == UrlFormat.postIndexJson) { _imageUrlXml = _imageUrl.Replace("index.json", "index.xml"); } _tagUrl = "http" + (useHttp ? "" : "s") + "://" + baseUrl + "/" + GetUrl(format, "tag"); if (HasWikiAPI()) { _wikiUrl = format == UrlFormat.danbooru ? "http" + (useHttp ? "" : "s") + "://" + baseUrl + "/" + GetUrl(format, "wiki_page") : "http" + (useHttp ? "" : "s") + "://" + baseUrl + "/" + GetUrl(format, "wiki"); } if (HasRelatedAPI()) { _relatedUrl = format == UrlFormat.danbooru ? "http" + (useHttp ? "" : "s") + "://" + baseUrl + "/" + GetUrl(format, "related_tag") : "http" + (useHttp ? "" : "s") + "://" + baseUrl + "/" + GetUrl(format, "tag", "related"); } if (HasCommentAPI()) { _commentUrl = "http" + (useHttp ? "" : "s") + "://" + baseUrl + "/" + GetUrl(format, "comment"); } }
public Moebooru(string url, BooruOptions options = BooruOptions.none) : base(url, UrlFormat.postIndexJson, options | BooruOptions.noPostByMd5 | BooruOptions.noPostById | BooruOptions.noFavorite) { }
public Gelbooru(string url, BooruOptions options = BooruOptions.none) : base(url, UrlFormat.indexPhp, options | BooruOptions.noWiki | BooruOptions.noRelated | BooruOptions.limitOf20000 | BooruOptions.commentApiXml) { }
public Gelbooru02(string url, BooruOptions options = BooruOptions.none) : base(url, UrlFormat.indexPhp, options | BooruOptions.noRelated | BooruOptions.noWiki | BooruOptions.noPostByMd5 | BooruOptions.commentApiXml | BooruOptions.tagApiXml | BooruOptions.noMultipleRandom) { _url = url; }
public E621(string url, BooruOptions options = BooruOptions.none) : base(url, UrlFormat.danbooru, options | BooruOptions.noWiki | BooruOptions.noRelated | BooruOptions.noComment | BooruOptions.noTagById | BooruOptions.noPostById | BooruOptions.noPostCount | BooruOptions.noFavorite) { }
public Sankaku(string url, BooruOptions options = BooruOptions.none) : base(url, UrlFormat.sankaku, options | BooruOptions.noRelated | BooruOptions.noPostByMd5 | BooruOptions.noPostById | BooruOptions.noPostCount | BooruOptions.noFavorite | BooruOptions.noTagById) { }
public Danbooru(string url, BooruOptions options = BooruOptions.none) : base(url, UrlFormat.danbooru, options | BooruOptions.noLastComments | BooruOptions.noPostCount | BooruOptions.noFavorite) { }