Exemplo n.º 1
0
        public async Task <ILoginResponse> LoginAsync(ILoginRequest request)
        {
            if (!IsLoggedIn())
            {
                await GetToken();
            }

            var loginContent = new FormUrlEncodedContent(new Dictionary <string, string>()
            {
                { "segaId", request.SegaId },
                { "password", request.Password },
                { "token", token },
            });

            var   postLogin = client.PostAsync(ChunithmNetUrl.CreateUrl("submit"), loginContent);
            await postLogin;

            var   getAimeList = client.GetAsync(ChunithmNetUrl.CreateUrl("aimeList"));
            await getAimeList;

            var response = new LoginResponse(getAimeList.Result);

            if (response.Success)
            {
                var aimeListParser = new AimeListParser();
                response.AimeList = aimeListParser.Parse(response.DocumentText);
                if (response.AimeList == null)
                {
                    response.OnInvalidAimeList();
                }
            }

            return(response);
        }
        public async Task <IWorldsEndMusicGetResponse> GetWorldsEndMusicAsync(IWorldsEndMusicGetRequest request)
        {
            var   worldsEndMusicGet = client.GetAsync(ChunithmNetUrl.CreateUrl("worldsEnd/worldsEndList"));
            await worldsEndMusicGet;

            var response = new WorldsEndMusicGetResponse(worldsEndMusicGet.Result);

            if (response.Success)
            {
                response.WorldsEndMusic = new WorldsEndMusicParser().Parse(response.DocumentText);
            }
            return(response);
        }
        public async Task <IPlaylogGetResponse> GetPlaylogAsync(IPlaylogGetRequest requestData)
        {
            var   playlog = client.GetAsync(ChunithmNetUrl.CreateUrl("record/playlog"));
            await playlog;

            var response = new PlaylogGetResponse(playlog.Result);

            if (response.Success)
            {
                response.Playlog = new PlaylogParser().Parse(response.DocumentText);
            }
            return(response);
        }
        public async Task <IAimeSelectResponse> SelectAimeAsync(IAimeSelectRequest request)
        {
            var selectAimeContent = new FormUrlEncodedContent(new Dictionary <string, string>()
            {
                { "idx", request.AimeIndex.ToString() },
                { "token", token },
            });

            var   selectAime = client.PostAsync(ChunithmNetUrl.CreateUrl("aimeList/submit"), selectAimeContent);
            await selectAime;

            var   home = client.GetAsync(ChunithmNetUrl.CreateUrl("home"));
            await home;

            var response = new AimeSelectResponse(home.Result);

            return(response);
        }
Exemplo n.º 5
0
        public async Task <IMusicLevelGetResponse> GetMusicLevelAsync(IMusicLevelGetRequest request)
        {
            var musicLevelContent = new FormUrlEncodedContent(new Dictionary <string, string>
            {
                { "level", request.Level.ToString() },
                { "token", token },
            });

            var   musicLevelRequest = client.PostAsync(ChunithmNetUrl.CreateUrl("record/musicLevel/sendSearch"), musicLevelContent);
            await musicLevelRequest;

            var   musicLevel = client.GetAsync(ChunithmNetUrl.CreateUrl("record/musicLevel/search"));
            await musicLevel;

            var response = new MusicLevelGetResponse(musicLevel.Result);

            if (response.Success)
            {
                response.MusicLevel = new MusicLevelParser().Parse(response.DocumentText);
            }
            return(response);
        }
Exemplo n.º 6
0
        public async Task <IMusicGenreGetResponse> GetMusicGenreAsync(IMusicGenreGetRequest request)
        {
            var musicGenreContent = new FormUrlEncodedContent(new Dictionary <string, string>
            {
                { "genre", request.GenreCode.ToString() },
                { "token", token },
            });

            var   musicGenreRequest = client.PostAsync(ChunithmNetUrl.CreateUrl(GetPostPath(request.Difficulty)), musicGenreContent);
            await musicGenreRequest;

            var   musicGenre = client.GetAsync(ChunithmNetUrl.CreateUrl(GetRequestPath(request.Difficulty)));
            await musicGenre;

            var response = new MusicGenreGetResponse(musicGenre.Result);

            if (response.Success)
            {
                response.MusicGenre = new MusicGenreParser().Parse(response.DocumentText);
            }

            return(response);
        }
Exemplo n.º 7
0
        public async Task <IWorldsEndMusicDetailGetResponse> GetWorldsEndMusicDetailAsync(IWorldsEndMusicDetailGetRequest request)
        {
            var worldsEndMusicDetailContent = new FormUrlEncodedContent(new Dictionary <string, string>
            {
                { "idx", request.Id.ToString() },
                { "token", token },
            });

            var   worldsEndMusicDetailRequest = client.PostAsync(ChunithmNetUrl.CreateUrl("worldsEnd/worldsEndList/sendWorldsEndDetail"), worldsEndMusicDetailContent);
            await worldsEndMusicDetailRequest;

            var   worldsEndMusicDetail = client.GetAsync(ChunithmNetUrl.CreateUrl("worldsEnd/worldsEndDetail"));
            await worldsEndMusicDetail;

            var response = new WorldsEndMusicDetailGetResponse(worldsEndMusicDetail.Result);

            if (response.Success)
            {
                var worldsEndMusicDetailParser = new WorldsEndMusicDetailParser();
                response.WorldsEndMusicDetail = worldsEndMusicDetailParser.Parse(response.DocumentText);
            }

            return(response);
        }
Exemplo n.º 8
0
        public async Task <IPlaylogDetailGetResponse> GetPlaylogDetailAsync(IPlaylogDetailGetRequest requestData)
        {
            var playlogDetailContent = new FormUrlEncodedContent(new Dictionary <string, string>
            {
                { "idx", requestData.Index.ToString() },
                { "token", token },
            });

            var   playlogDetailRequest = client.PostAsync(ChunithmNetUrl.CreateUrl("record/playlog/sendPlaylogDetail"), playlogDetailContent);
            await playlogDetailRequest;

            var   playlogDetail = client.GetAsync(ChunithmNetUrl.CreateUrl("record/playlogDetail"));
            await playlogDetail;

            var response = new PlaylogDetailGetResponse(playlogDetail.Result);

            if (response.Success)
            {
                var playlogDetailParser = new PlaylogDetailParser();
                response.PlaylogDetail = playlogDetailParser.Parse(response.DocumentText);
            }

            return(response);
        }
Exemplo n.º 9
0
        public async Task <IMusicDetailGetResponse> GetMusicDetailAsync(IMusicDetailGetRequest request)
        {
            var musicDetailContent = new FormUrlEncodedContent(new Dictionary <string, string>
            {
                { "idx", request.Id.ToString() },
                { "token", token },
            });

            var   musicDetailRequest = client.PostAsync(ChunithmNetUrl.CreateUrl("record/musicGenre/sendMusicDetail"), musicDetailContent);
            await musicDetailRequest;

            var   musicDetail = client.GetAsync(ChunithmNetUrl.CreateUrl("record/musicDetail"));
            await musicDetail;

            var response = new MusicDetailGetResponse(musicDetail.Result);

            if (response.Success)
            {
                var musicDetailParser = new MusicDetailParser();
                response.MusicDetail = musicDetailParser.Parse(response.DocumentText);
            }

            return(response);
        }