public async Task <ILoginResponse> LoginAsync(ILoginRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (WebBrowserNavigator.WebBrowser.Address != ChunithmNetUrl.Top) { await WebBrowserNavigator.LoadAsync(ChunithmNetUrl.Top); } await WebBrowserNavigator.EvaluatePageMoveScriptAsync($@" var inputs = document.getElementsByTagName('input'); var inputName = inputs[0]; var inputPassword = inputs[1]; inputName.value = '{request.SegaId}'; inputPassword.value = '{request.Password}'; formSubmit('sega_login'); "); var responseAsync = LoginResponse.CreateResponseAsync(WebBrowserNavigator.WebBrowser); await responseAsync; var response = responseAsync.Result; if (response.Success) { var aimeListParser = new AimeListParser(); response.AimeList = aimeListParser.Parse(response.DocumentText); } return(response); }
public async Task <IMusicDetailGetResponse> GetMusicDetailAsync(IMusicDetailGetRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (WebBrowserNavigator.WebBrowser.Address != ChunithmNetUrl.MusicGenre) { await WebBrowserNavigator.LoadAsync(ChunithmNetUrl.MusicGenre); } await WebBrowserNavigator.EvaluatePageMoveScriptAsync($@" var genreSelecter = document.getElementsByName('genre')[0]; genreSelecter.value = 99; formSubmitAddParam('music_genre', 'level_master'); "); await WebBrowserNavigator.EvaluatePageMoveScriptAsync($@" formSubmitAddParam('music_detail', 'musicId_{request.Id}'); "); var responseAsync = MusicDetailGetResponse.CreateResponseAsync(WebBrowserNavigator.WebBrowser); await responseAsync; var response = responseAsync.Result; if (response.Success) { var musicDetailParser = new MusicDetailParser(); response.MusicDetail = musicDetailParser.Parse(response.DocumentText); } return(response); }
public async Task <IPlaylogDetailGetResponse> GetPlaylogDetailAsync(IPlaylogDetailGetRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (WebBrowserNavigator.WebBrowser.Address != ChunithmNetUrl.Playlog) { await WebBrowserNavigator.LoadAsync(ChunithmNetUrl.Playlog); } await WebBrowserNavigator.EvaluatePageMoveScriptAsync($@" pageMove('PlaylogDetail', {request.Index}); "); var responseAsync = PlaylogDetailGetResponse.CreateResponseAsync(WebBrowserNavigator.WebBrowser); await responseAsync; var response = responseAsync.Result; if (response.Success) { var playlogDetailParser = new PlaylogDetailParser(); response.PlaylogDetail = playlogDetailParser.Parse(response.DocumentText); } return(response); }
public async Task <IMusicLevelGetResponse> GetMusicLevelAsync(IMusicLevelGetRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (WebBrowserNavigator.WebBrowser.Address != ChunithmNetUrl.MusicLevel) { await WebBrowserNavigator.LoadAsync(ChunithmNetUrl.MusicLevel); } await WebBrowserNavigator.EvaluatePageMoveScriptAsync($@" var levelSelecter = document.getElementsByName('level')[0]; levelSelecter.value = {request.Level}; changeSelecter(levelSelecter); "); var responseAsync = MusicLevelGetResponse.CreateResponseAsync(WebBrowserNavigator.WebBrowser); await responseAsync; var response = responseAsync.Result; if (response.Success) { var musicLevelParser = new MusicLevelParser(); response.MusicLevel = musicLevelParser.Parse(response.DocumentText); } return(response); }
public async Task <IAimeSelectResponse> SelectAimeAsync(IAimeSelectRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (WebBrowserNavigator.WebBrowser.Address != ChunithmNetUrl.AimeList) { await WebBrowserNavigator.LoadAsync(ChunithmNetUrl.AimeList); } await WebBrowserNavigator.EvaluatePageMoveScriptAsync($@" formSubmit('aime_login_{request.AimeIndex}'); "); var responseAsync = AimeSelectResponse.CreateResponseAsync(WebBrowserNavigator.WebBrowser); await responseAsync; var response = responseAsync.Result; return(response); }