Esempio n. 1
0
        protected override WebRequest CreateWebRequest()
        {
            var req = base.CreateWebRequest();

            if (query != null)
            {
                req.AddParameter("q", query);
            }

            if (General != null && General.Any())
            {
                req.AddParameter("c", string.Join('.', General.Select(e => e.ToString().Underscore())));
            }

            if (ruleset.OnlineID >= 0)
            {
                req.AddParameter("m", ruleset.OnlineID.ToString());
            }

            req.AddParameter("s", SearchCategory.ToString().ToLowerInvariant());

            if (Genre != SearchGenre.Any)
            {
                req.AddParameter("g", ((int)Genre).ToString());
            }

            if (Language != SearchLanguage.Any)
            {
                req.AddParameter("l", ((int)Language).ToString());
            }

            req.AddParameter("sort", $"{SortCriteria.ToString().ToLowerInvariant()}_{directionString}");

            if (Extra != null && Extra.Any())
            {
                req.AddParameter("e", string.Join('.', Extra.Select(e => e.ToString().ToLowerInvariant())));
            }

            if (Ranks != null && Ranks.Any())
            {
                req.AddParameter("r", string.Join('.', Ranks.Select(r => r.ToString())));
            }

            if (Played != SearchPlayed.Any)
            {
                req.AddParameter("played", Played.ToString().ToLowerInvariant());
            }

            req.AddParameter("nsfw", ExplicitContent == SearchExplicit.Show ? "true" : "false");

            req.AddCursor(cursor);

            return(req);
        }