SRNicoNico.Models.NicoNicoWrapper.NicoNicoStoryBoard.GetStoryBoardAsync C# (CSharp) Method

GetStoryBoardAsync() public method

public GetStoryBoardAsync ( ) : Task
return Task
		public async  Task<NicoNicoStoryBoardData> GetStoryBoardAsync() {

            try {

                //エコノミーだったら
                if(StoryBoardApiBaseUrl.Contains("low")) {

                    return null;
                }

                var data = await GetStoryBoardInternalDataAsync();

                //ストーリーボードが無かったら
                if(data == null) {

                    return null;
                }

                //APIURL
                var uri = StoryBoardApiBaseUrl + "&sb=" + data.Id + "&board=";


                int bitmapindex = 0;
                for(int i = 1; i <= data.Count; i++) {

                    var response = await NicoNicoWrapperMain.Session.GetStreamAsync(uri + i);

                    var bitmap = new Bitmap(response);

                    for(int j = 0; j < data.Cols; j++) {

                        for(int k = 0; k < data.Rows; k++) {

                            var rect = new Rectangle(data.Width * k, data.Height * j, data.Width, data.Height);

                            data.BitmapCollection[bitmapindex] = bitmap.Clone(rect, bitmap.PixelFormat);
                            bitmapindex += data.Interval;
                        }
                    }
                }
                return data;

            } catch(Exception e) when (e is RequestTimeout || e is ArgumentException) {

                return null;
            }
        }

Usage Example

Beispiel #1
0
        public async void JumpTo(string videoUrl) {


            VideoUrl =  videoUrl;

            WatchApi = new NicoNicoWatchApi(videoUrl + "?watch_harmful=1", this);

            IsActive = true;

            Status = "動画情報取得中";
            //動画情報取得
            VideoData.ApiData = await WatchApi.GetWatchApiDataAsync();

            if(VideoData.ApiData == null) {

                LoadFailed = true;
                return;
            }

            Handler.Update();

            CommentInstance = new NicoNicoComment(VideoData.ApiData, this);



            if(VideoData.ApiData.GetFlv.IsPremium && !VideoData.ApiData.GetFlv.VideoUrl.StartsWith("rtmp")) {

                StoryBoardStatus = "取得中";

                var sb = new NicoNicoStoryBoard(VideoData.ApiData.GetFlv.VideoUrl);
                VideoData.StoryBoardData = await sb.GetStoryBoardAsync();

                if(VideoData.StoryBoardData == null) {

                    StoryBoardStatus = "データ無し";
                } else {

                    StoryBoardStatus = "取得完了";
                }
            } else {

                StoryBoardStatus = "データ無し";
            }
        }
All Usage Examples Of SRNicoNico.Models.NicoNicoWrapper.NicoNicoStoryBoard::GetStoryBoardAsync