Beispiel #1
0
        public static Beatmapset[] SearchAllBeatmaps(string keyword, BeatmapsetsSearchOptions options = null)
        {
            OsuApiV2Client    client = new OsuApiV2Client(OsuApiKey.UserName, OsuApiKey.Password);
            List <Beatmapset> list   = new List <Beatmapset>();

            Beatmapset[] tmpArray;
            int          i = 1;

            do
            {
                //Console.WriteLine($"page {i}.");
                var newOptions = new BeatmapsetsSearchOptions
                {
                    Page = i
                };

                if (options != null)
                {
                    newOptions.Extra    = options.Extra;
                    newOptions.Genre    = options.Genre;
                    newOptions.Language = options.Language;
                    newOptions.Mode     = options.Mode;
                    newOptions.Status   = options.Status;
                }

                tmpArray = client.SearchBeatMapAsync(keyword, newOptions).Result.Beatmapsets;
                if (tmpArray.Length > 0)
                {
                    list.AddRange(tmpArray);
                }
                else
                {
                    //Console.WriteLine($"page {i} no result.");
                }

                i++;
            } while (tmpArray.Length > 0);

            return(list.ToArray());
        }
Beispiel #2
0
        public static Beatmapset[] SearchBeatmaps(string keyword, BeatmapsetsSearchOptions options = null)
        {
            OsuApiV2Client client = new OsuApiV2Client(OsuApiKey.UserName, OsuApiKey.Password);

            return(client.SearchBeatMapAsync(keyword, options).Result.Beatmapsets);
        }