Пример #1
0
        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 <IPlaylogDetailGetResponse> GetPlaylogDetailAsync(IPlaylogDetailGetRequest request)
        {
            if (WebBrowserNavigator.WebBrowser.Url?.AbsoluteUri != ChunithmNetUrl.Playlog)
            {
                await WebBrowserNavigator.NavigateAsync(ChunithmNetUrl.Playlog);
            }

            var   playlogDetail = WebBrowserNavigator.InvokeScriptAsync("pageMove", new object[] { "PlaylogDetail", request.Index });
            await playlogDetail;

            var response = new PlaylogDetailGetResponse(WebBrowserNavigator.WebBrowser);

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

            return(response);
        }
Пример #3
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);
        }