Example #1
0
        public static Tag[] Tags(APIs.getthumbinfo.Serial.tags Serial)
        {
            var result = new Tag[Serial.tag.Length];

            for (int i = 0; i < result.Length; i++)
            {
                result[i] = new Tag()
                {
                    IsCategory = Serial.tag[i].category != 0,
                    IsLock = Serial.tag[i]._lock != 0,
                    Name = Serial.tag[i]._tag,
                };
            }

            return result;
        }
Example #2
0
        /********************************************/
        public static Tag[] Tags(APIs.tag_edit.Serial._tag[] Serial)
        {
            if (Serial == null)
                return null;

            var result = new Tag[Serial.Length];

            for (int i = 0; i < result.Length; i++)
            {
                result[i] = new Tag()
                {
                    IsNicopedia = Serial[i].dic,
                    IsCategory = Serial[i].can_cat,
                    IsLock = Serial[i].owner_lock != 0,
                    Name = Serial[i].tag,
                };
            }

            return result;
        }
Example #3
0
 /// <summary>
 /// タグを削除する
 /// </summary>
 /// <param name="RemoveTag">削除するタグ</param>
 public Session<Response<Tag[]>> RemoveTag(Tag RemoveTag)
 {
     return EditTag(RemoveTag, "remove");
 }
Example #4
0
        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;
        }
Example #5
0
 /// <summary>
 /// タグを追加する
 /// </summary>
 /// <param name="AddTag">追加するタグ</param>
 public Session<Response<Tag[]>> AddTag(Tag AddTag)
 {
     return EditTag(AddTag, "add");
 }