Beispiel #1
0
        /// <summary>
        /// Mylistの詳細情報をセットします
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        private async Task <HttpMylistInfo> SetMylistDetail(string param)
        {
            var response = await _client.GetAsync(ApiURL.GET_DETAIL_MYLIST_DATA(param));

            this._responseMessage = await response.Content.ReadAsStringAsync();

            return(this);
        }
Beispiel #2
0
        /// <summary>
        /// ユーザーの投稿動画の一覧をセットします
        /// (XML)
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public async Task <HttpUserVideoInfo> SetResponseMessage(string userId)
        {
            var response = await _client.GetAsync(ApiURL.GET_USER_VIDEO(userId));

            _responseMessage = await response.Content.ReadAsStringAsync();

            _client.Dispose();
            return(this);
        }
Beispiel #3
0
 /// <summary>
 /// ユーザーのプロフィールページに遷移します
 /// 184の場合は処理を中断します。
 /// </summary>
 /// <param name="logic"></param>
 /// <param name="userId"></param>
 public static void GoToUserProfile(this UserProfileLogic me, string userId)
 {
     if (userId.IsNotNumber())
     {
         return;
     }
     ProcessSupport.GoToWebBrowser(ApiURL.GO_TO_USER_PROFILE(int.Parse(userId)),
                                   Message.FAIL_GO_TO_USER_PROFILE);
 }
Beispiel #4
0
        private async static Task <string[]> GetMylistId(string userId)
        {
            using (var client = HttpClientBuilder.NewHttpClient())
            {
                var response = await client.GetAsync(ApiURL.GET_USER_MYLIST(userId));

                string[] mylistInfo = XmlParse.ParseMylistXml(await response.Content.ReadAsStringAsync());
                return(mylistInfo);
            }
        }
 private void SetVersion()
 {
     if (ApiURL.Substring(ApiURL.Length - 1).Equals("/"))
     {
         ApiURL += ApiVersion;
     }
     else
     {
         ApiURL += $"/{ApiVersion}";
     }
 }
Beispiel #6
0
        public async Task ユーザーアイコン取得()
        {
            var        premium  = new Uri(ApiURL.USER_ICON_URL(161843));
            var        response = new Uri(ApiURL.USER_ICON_URL(97491199));
            HttpClient client   = new HttpClient();
            var        res      = await client.GetAsync(response);

            TestContext.WriteLine(res.IsSuccessStatusCode);
            BitmapImage preSource   = new BitmapImage(premium);
            BitmapImage imageSource = new BitmapImage(response);

            TestContext.WriteLine(preSource);
            TestContext.WriteLine(imageSource);
        }
Beispiel #7
0
        public async IAsyncEnumerable <string> ConnectLive(string threadId, string host, string port)
        {
            using (_tcp = new TcpClient())
            {
                await _tcp.ConnectAsync(host, int.Parse(port));

                byte[] buffer = Encoding.UTF8.GetBytes(ApiURL.CONNECT_SEVER_URL(threadId, 0));
                using (_stream = _tcp.GetStream())
                {
                    _stream.Write(buffer, 0, buffer.Length);
                    while (_stream.CanRead)
                    {
                        using (var memory = new MemoryStream())
                        {
                            byte[] readByte = new byte[256];
                            var    response = 0;
                            do
                            {
                                try
                                {
                                    response = _stream.Read(readByte, 0, readByte.Length);
                                }
                                catch (Exception)
                                {
                                    break;
                                }

                                if (response == 0)
                                {
                                    break;
                                }
                                memory.Write(readByte, 0, response);

                                yield return(Encoding.UTF8.GetString(memory.GetBuffer(), 0, (int)memory.Length));
                            } while (_stream.DataAvailable);
                        }
                    }
                }
            }
        }
Beispiel #8
0
        /// <summary>
        /// コメントの中にURLがあった場合そのページに遷移する。
        /// lvかsmがあった場合絶対パスに変換する
        /// URLがなかった場合,エラーメッセージを出力してFalseを返す。
        ///
        /// </summary>
        /// <param name="comment">  </param>
        /// <returns></returns>
        public static string TryUrlparseFromComment(string comment)
        {
            Match sm = _regexSm.Match(comment);
            Match lv = _regexLv.Match(comment);

            if (sm.Success)
            {
                return(ApiURL.ABSOLUTE_VIDEO_PATH(sm.ToString()));
            }
            else if (lv.Success)
            {
                return(ApiURL.ABSOLUTE_LIVE_PATH(lv.ToString()));
            }
            Match match = null;

            if ((match = _regexURL.Match(comment)).Success)
            {
                return(match.ToString());
            }


            return(null);
        }
Beispiel #9
0
 /// <summary>
 /// 配信の状態を取得します
 /// </summary>
 /// <param name="liveId"> ライブのID (lv****) </param>
 /// <returns> XML形式で変換 </returns>
 public async Task <HttpResponseMessage> GetLiveStatus(string liveId) => await _client.GetAsync(ApiURL.LIVE_STATUS_URL(liveId));
Beispiel #10
0
        public async Task <bool> GetUserIcon(int userId)
        {
            var response = await _client.GetAsync(ApiURL.USER_ICON_URL(userId));

            return(response.IsSuccessStatusCode);
        }
Beispiel #11
0
 public async Task <HttpResponseMessage> GetUserName(int userId) => await _client.GetAsync(ApiURL.GET_USER_NAME(userId));
Beispiel #12
0
 /// <summary>
 ///
 /// </summary>
 public static void GoToVideo_MouseDown(this UserProfileLogic me, string uri)
 {
     ProcessSupport.GoToWebBrowser(ApiURL.GO_TO_VIDEO_PAGE(uri), Message.FAIL_GO_TO_USER_VIDEO);
 }
Beispiel #13
0
        /// <summary>
        /// 対象のマイリストのページに遷移します。
        /// </summary>
        /// <param name="me"></param>
        /// <param name="mylistId"></param>
        /// <param name="userId"></param>
        public static void GoToMylist(this UserProfileLogic me, string userId, string mylistId)
        {
            var url = ApiURL.GO_TO_MYLIST_LINK(userId, mylistId);

            ProcessSupport.GoToWebBrowser(url, Message.FAIL_GO_TO_MYLIST);
        }