当前位置: 首页>>代码示例>>C#>>正文


C# Session.SetAccessers方法代码示例

本文整理汇总了C#中Session.SetAccessers方法的典型用法代码示例。如果您正苦于以下问题:C# Session.SetAccessers方法的具体用法?C# Session.SetAccessers怎么用?C# Session.SetAccessers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session.SetAccessers方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Search

        /// <summary>動画を検索する</summary>
        /// <param name="Keyword">検索キーワード</param>
        /// <param name="SearchPage">検索ページの指定、1~nの間の数値を指定する</param>
        /// <param name="SearchType">検索方法を指定する</param>
        /// <param name="SearchOption">検索オプションを指定する、Filterメンバは無効</param>
        public Session<Response<VideoInfo[]>> Search(
            string Keyword,
            int SearchPage,
            SearchType SearchType,
            SearchOption SearchOption)
        {
            var session = new Session<Response<VideoInfo[]>>();

            session.SetAccessers(new Func<byte[], APIs.IAccesser>[]
            {
                (data) =>
                {
                    var accesser = new APIs.search.Accesser();
                    accesser.Setting(
                        context.CookieContainer,
                        SearchType.ToKey(),
                        Keyword,
                        SearchPage.ToString(),
                        SearchOption.SortOrder.ToKey(),
                        SearchOption.SortTarget.ToKey());

                    return accesser;
                }
            },
            (data) =>
                Converter.VideoInfoResponse(context, new APIs.search.Parser().Parse(data)));

            return session;
        }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:34,代码来源:VideoServicePage.cs

示例2: DownloadMylist

        /// <summary>
        /// マイリストを取得する
        /// </summary>
        public Session<Response<Mylist>> DownloadMylist()
        {
            var session = new Session<Response<Mylist>>();

            session.SetAccessers(
                new Func<byte[], APIs.IAccesser>[]
                {
                    (data) =>
                    {
                        var accesser = new APIs.mylistvideo.Accesser();
                        accesser.Setting(
                            context.CookieContainer,
                            target.ID);

                        return accesser;
                    }
                },
                (data) =>
                {
                    return Converter.MylistResponse(
                        context,
                        new APIs.mylistvideo.Parser().Parse(data),
                        target.ID);
                });

            return session;
        }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:30,代码来源:MylistPage.cs

示例3: DownloadUser

        /// <summary>
        /// ユーザー情報を取得する
        /// </summary>
        public Session<Response<User>> DownloadUser()
        {
            var session = new Session<Response<User>>();
            var accessorList = new List<Func<byte[], APIs.IAccesser>>();

            if (!htmlCache.IsAvailab)
                accessorList.Add(
                    (data) =>
                    {
                        var accesser = new APIs.user_page_html.Accesser();
                        accesser.Setting(
                            context.CookieContainer,
                            target.ID);

                        return accesser;
                    });

            session.SetAccessers(
                accessorList.ToArray(),
                (data) =>
                {
                    var parser = new APIs.user_page_html.Parser();

                    if (data != null)
                        htmlCache.Value = parser.Parse(data);

                    return Converter.UserResponse(context, parser.Parse(htmlCache));
                });

            return session;
        }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:34,代码来源:UserPage.cs

示例4: Login

        /// <summary>ログインする</summary>
        /// <param name="MailAddress">メールアドレス</param>
        /// <param name="Password">パスワード</param>
        public Session<User> Login(string MailAddress, string Password)
        {
            var session = new Session<User>();

            session.SetAccessers(new Func<byte[], APIs.IAccesser>[]
            {
                (data) =>
                {
                    var accesser = new APIs.login.Accesser();
                    accesser.Setting(context.CookieContainer, MailAddress, Password);

                    return accesser;
                }
            },
            (data) =>
                new APIs.login.Parser().Parse(data));

            return session;
        }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:22,代码来源:NicoServicePage.cs

示例5: DownloadVideoInfo

        /// <summary>
        /// 動画の詳細情報を取得する
        /// </summary>
        public Session<Response<VideoInfo>> DownloadVideoInfo(DownloadVideoInfoUseAPI DownloadVideoInfoUseAPI)
        {
            var session = new Session<Response<VideoInfo>>();

            switch (DownloadVideoInfoUseAPI)
            {
                case DownloadVideoInfoUseAPI.html:
                    #region
                    var accessorList = new List<Func<byte[], APIs.IAccesser>>();

                    if (!htmlCache.IsAvailab)
                    {
                        accessorList.Add((data) =>
                        {
                            var accesser = new APIs.video_page_html.Accesser();
                            accesser.Setting(
                                context.CookieContainer,
                                target.ID);

                            return accesser;
                        });
                    }

                    session.SetAccessers(
                        accessorList.ToArray(),
                        (data) =>
                        {
                            if (data != null)
                                htmlCache.Value = new APIs.video_page_html.Parser().Parse(data);

                            var result = new Response<VideoInfo>();
                            result.Status = Status.OK;
                            result.Result = context.IDContainer.GetVideoInfo(target.ID);
                            result.Result.Description = new APIs.video_page_html.html_video_info().Parse(htmlCache);

                            return result;
                        });

                    #endregion
                    break;
                case DownloadVideoInfoUseAPI.getthumbinfo:
                    #region
                    session.SetAccessers(new Func<byte[], APIs.IAccesser>[]
                    {
                        (data) =>
                        {
                            var accesser = new APIs.getthumbinfo.Accesser();
                            accesser.Setting(
                                context.CookieContainer,
                                target.ID);

                            return accesser;
                        }
                    },
                    (data) =>
                        Converter.VideoInfoResponse(context, new APIs.getthumbinfo.Parser().Parse(data)));
                    #endregion
                    break;
                default: throw new Exception();
            }

            return session;
        }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:66,代码来源:VideoPage.cs

示例6: EditTag

        private Session<Response<Tag[]>> EditTag(Tag EditTag, string cmd)
        {
            var session = new Session<Response<Tag[]>>();
            var accessorList = new List<Func<byte[], APIs.IAccesser>>();

            if (!htmlCache.IsAvailab)
            {
                accessorList.Add(new Func<byte[], APIs.IAccesser>((byte[] data) =>
                {
                    var accesser = new APIs.video_page_html.Accesser();
                    accesser.Setting(
                        context.CookieContainer,
                        target.ID);

                    return accesser;
                }));
            }

            accessorList.Add(new Func<byte[], APIs.IAccesser>((byte[] data) =>
            {
                if (data != null)
                    htmlCache.Value = new APIs.video_page_html.Parser().Parse(data);

                if (token == "")
                    token = new APIs.video_page_html.csrf_token().Parse(htmlCache);

                if (watch_auth_key == "")
                    watch_auth_key = new APIs.video_page_html.watch_auth_key().Parse(htmlCache);

                var accesser = new APIs.tag_edit.UploadAccesser();
                accesser.Setting(
                    context.CookieContainer,
                    target.ID,
                    "json",
                    cmd,
                    EditTag.Name,
                    token,
                    watch_auth_key,
                    (EditTag.IsLock == true) ? "1" : "0");

                return accesser;
            }));

            session.SetAccessers(
                accessorList.ToArray(),
                (data) =>
                    Converter.TagsResponse(new APIs.tag_edit.Parser().Parse(data)));

            return session;
        }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:50,代码来源:VideoPage.cs

示例7: DownloadTags

        /// <summary>
        /// タグを取得する
        /// </summary>
        public Session<Response<Tag[]>> DownloadTags()
        {
            var session = new Session<Response<Tag[]>>();

            session.SetAccessers(new Func<byte[], APIs.IAccesser>[]
            {
                new Func<byte[], APIs.IAccesser>((byte[] data) =>
                {
                    var accesser = new APIs.tag_edit.DownloadAccesser();
                    accesser.Setting(
                        context.CookieContainer,
                        target.ID,
                        "json",
                        "tags");

                    return accesser;
                })
            }, (data) => Converter.TagsResponse(new APIs.tag_edit.Parser().Parse(data)));

            return session;
        }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:24,代码来源:VideoPage.cs

示例8: DownloadComment

        /// <summary>
        /// コメントをダウンロードする
        /// </summary>
        public Session<Response<Comment[]>> DownloadComment()
        {
            var session = new Session<Response<Comment[]>>();
            var accessorList = new List<Func<byte[], APIs.IAccesser>>();

            if (!videoCache.IsAvailab)
            {
                accessorList.Add((data) =>
                {
                    var accesser = new APIs.getflv.Accesser();
                    accesser.Setting(
                        context.CookieContainer,
                        target.ID);

                    return accesser;
                });
            }

            accessorList.AddRange(new Func<byte[], APIs.IAccesser>[]
            {
                (data) =>
                {
                    if (data != null)
                        videoCache.Value = new APIs.getflv.Parser().Parse(data);

                    var accesser = new APIs.download_comment.Accesser();
                    accesser.Setting(
                        context.CookieContainer,
                        videoCache.Value["ms"],
                        videoCache.Value["thread_id"]);

                    return accesser;
                },
            });

            session.SetAccessers(
                accessorList.ToArray(),
                (data) =>
                {
                    var Serial = new APIs.download_comment.Parser().Parse(data);
                    ticket = Serial.thread[0].ticket;
                    block_no = ((Serial.thread[0].last_res + 1) / 100).ToString();

                    return Converter.CommentResponse(Serial);
                });

            return session;
        }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:51,代码来源:VideoPage.cs

示例9: UploadComment

        /// <summary>
        /// コメントをアップロードする
        /// </summary>
        /// <param name="Comment">投稿するコメント</param>
        public Session<Response> UploadComment(Comment Comment)
        {
            var session = new Session<Response>();
            var accessorList = new List<Func<byte[], APIs.IAccesser>>();

            if (!videoCache.IsAvailab)
                accessorList.Add((data) =>
                {
                    var accesser = new APIs.getflv.Accesser();
                    accesser.Setting(
                        context.CookieContainer,
                        target.ID);

                    return accesser;
                });

            if (postkey == "")
                accessorList.Add((data) =>
                {
                    if (data != null)
                        videoCache.Value = new APIs.getflv.Parser().Parse(data);

                    var accesser = new APIs.getpostkey.Accesser();
                    accesser.Setting(
                        context.CookieContainer,
                        block_no,
                        videoCache.Value["thread_id"]);

                    return accesser;
                });

            accessorList.Add((data) =>
            {
                if (postkey == "")
                    postkey = new APIs.getpostkey.Parser().Parse(data);

                var accesser = new APIs.upload_comment.Accesser();
                accesser.Setting(
                    context.CookieContainer,
                    videoCache.Value["ms"],
                    videoCache.Value["thread_id"],
                    ((int)(Comment.PlayTime.TotalMilliseconds / 10)).ToString(),
                    Comment.Command,
                    ticket,
                    videoCache.Value["user_id"],
                    postkey,
                    Comment.Body);

                return accesser;
            });


            session.SetAccessers(
                accessorList.ToArray(),
                (data) =>
                    Converter.Response(new APIs.upload_comment.Parser().Parse(data)));

            return session;
        }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:63,代码来源:VideoPage.cs

示例10: DownloadVideo

        /// <summary>
        /// 動画をダウンロードする
        /// </summary>
        public Session<WebResponse> DownloadVideo()
        {
            var session = new Session<WebResponse>();
            var accessorList = new List<Func<byte[], APIs.IAccesser>>();
            var isVideoCacheProgress = false;
            var isHtmlCacheProgress = false;

            if (!videoCache.IsAvailab)
            {
                isVideoCacheProgress = true;
                accessorList.Add((data) =>
                {
                    var accesser = new APIs.getflv.Accesser();
                    accesser.Setting(
                        context.CookieContainer,
                        target.ID);

                    return accesser;
                });
            }

            if (!htmlCache.IsAvailab)
            {
                isHtmlCacheProgress = true;
                accessorList.Add(
                    (data) =>
                    {
                        if (data != null)
                            videoCache.Value = new APIs.getflv.Parser().Parse(data);

                        var accesser = new APIs.video_page_html.Accesser();
                        accesser.Setting(
                            context.CookieContainer,
                            target.ID);

                        return accesser;
                    });
            }

            accessorList.Add(
                (data) =>
                {
                    if (data != null)
                        if (isHtmlCacheProgress)
                            htmlCache.Value = new APIs.video_page_html.Parser().Parse(data);
                        else if (isVideoCacheProgress)
                            videoCache.Value = new APIs.getflv.Parser().Parse(data);

                    var accesser = new APIs.getvideo.Accesser();
                    accesser.Setting(
                        context.CookieContainer,
                        videoCache.Value["url"]);

                    return accesser;
                });

            session.SetAccessers(accessorList.ToArray(), null);
            return session;
        }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:62,代码来源:VideoPage.cs


注:本文中的Session.SetAccessers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。