示例#1
0
        public void unlike(kwf kw)
        {
            JObject jors = JSON.parse(_stbapi.sendTieba("/c/c/forum/unlike", "kw=" + _.encodeURIComponent(kw.kw) + "&tbs=" + getTbs(), bduss));

            if (jors["error_code"].Value <int>() != 0)
            {
                throw new TiebaField(new EntryResult(), jors["error_code"].Value <int>(), jors["error_msg"].Value <String>());
            }
        }
示例#2
0
 public addThreadResult(int cd, String ms, long kz, kwf kw, bool needVcd, String vcd, String vcmd5)
 {
     error_code    = cd;
     error_msg     = ms;
     this.kz       = kz;
     this.kw       = kw;
     needVcode     = needVcd;
     vcode_pic_url = vcd;
     vcode_md5     = vcmd5;
 }
示例#3
0
        public void delThread(long tid, kwf kw)
        {
            String  tbs  = getTbs();
            JObject jors = JSON.parse(_stbapi.sendTieba("/c/c/bawu/delthread", "z=" + tid + "&word=" + _.encodeURIComponent(kw.kw) + "&tbs=" + tbs,
                                                        bduss));

            if (jors["error_code"].Value <int>() != 0)
            {
                throw new TiebaField(new EntryResult(), jors["error_code"].Value <int>(), jors["error_msg"].Value <String>());
            }
        }
示例#4
0
        /// <summary>
        /// 发帖
        /// </summary>
        /// <param name="kw">吧对象</param>
        /// <param name="content">内容</param>
        /// <param name="title">标题</param>
        /// <param name="vcode">验证码</param>
        /// <param name="vcodemd5">验证码标识</param>
        /// <returns></returns>
        public addThreadResult addThread(kwf kw, String content, String title, String vcode, String vcodemd5)
        {
            String  tbs = getTbs();
            JObject res = JSON.parse(_stbapi.sendTieba("/c/c/thread/add", "content=" + _.encodeURIComponent(content) + "&" +
                                                       "kw=" + _.encodeURIComponent(kw.kw) + "&vcode=" + _.encodeURIComponent(vcode) + "&vcode_md5=" +
                                                       _.encodeURIComponent(vcodemd5) + "&tbs=" + _.encodeURIComponent(tbs) + "&fid=" +
                                                       kw.fid + "&title=" + _.encodeURIComponent(title), bduss));

            if (res["error_code"].Value <int>() != 0)
            {
                try
                {
                    if (res["info"]["need_vcode"].Value <int>() > 0)
                    {
                        throw new AddThreadField(new addThreadResult(res["error_code"].Value <int>(), res["error_msg"].Value <String>(),
                                                                     0, kw, true, res["info"]["vcode_pic_url"].Value <String>(), res["info"]["vcode_md5"].Value <String>())
                                                 , res["error_code"].Value <int>(), res["error_msg"].Value <String>());
                    }
                    else
                    {
                        throw new NullReferenceException();
                    }
                }
                catch (NullReferenceException)
                {
                    throw new AddThreadField(new addThreadResult(res["error_code"].Value <int>(), res["error_msg"].Value <String>(),
                                                                 0, kw, false, "", ""), res["error_code"].Value <int>(), res["error_msg"].Value <String>());
                }
                catch (ArgumentNullException)
                {
                    throw new AddThreadField(new addThreadResult(res["error_code"].Value <int>(), res["error_msg"].Value <String>(),
                                                                 0, kw, false, "", ""), res["error_code"].Value <int>(), res["error_msg"].Value <String>());
                }
                catch (InvalidOperationException)
                {
                    throw new AddThreadField(new addThreadResult(res["error_code"].Value <int>(), res["error_msg"].Value <String>(),
                                                                 0, kw, false, "", ""), res["error_code"].Value <int>(), res["error_msg"].Value <String>());
                }
                catch (ArgumentException)
                {
                    throw new addPostField(res["error_code"].Value <int>(), res["error_msg"].Value <String>(),
                                           "", "");
                }
                catch (InvalidCastException)
                {
                    throw new addPostField(res["error_code"].Value <int>(), res["error_msg"].Value <String>(),
                                           "", "");
                }
            }
            return(new addThreadResult(0, "", res["tid"].Value <long>(), kw, false, "", ""));
        }
示例#5
0
        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="tid">帖子的ID</param>
        public TieThread(long tid)
        {
            JObject th = JSON.parse(_stbapi.sendTieba("/c/f/pb/page", "kz=" + tid + "&pn=1", ""));

            this.tid = tid;
            if (th["error_code"].Value <int>() != 0)
            {
                throw new ThreadNotFindField(tid, th["error_code"].Value <int>(), th["error_msg"].Value <String>());
            }
            maxPage   = th["page"]["total_page"].Value <long>();
            title     = th["thread"]["title"].Value <String>();
            reply_num = th["thread"]["reply_num"].Value <long>();
            author    = new userInBar(th["thread"]["author"]["id"].Value <long>(),
                                      th["thread"]["author"]["name"].Value <String>(), th["thread"]["author"]["is_like"].Value <int>() == 1,
                                      th["thread"]["author"]["level_id"].Value <int>(), th["thread"]["author"]["portrait"].Value <String>());
            maxPage = th["page"]["total_page"].Value <long>();
            time    = th["thread"]["create_time"].Value <long>();
            kw      = new kwf(th["forum"]["id"].Value <long>(), th["forum"]["name"].Value <String>());
            tinfo   = (JToken)th;
        }
示例#6
0
 public tkwtid(long tid, kwf k)
     : base(tid)
 {
     kw = k;
 }
示例#7
0
 public tkwtid()
 {
     kw = new kwf();
 }
示例#8
0
 public tkwtid(long tid, kwf k)
     : base(tid)
 {
     kw = k;
 }
示例#9
0
 public tkwtid()
 {
     kw = new kwf();
 }
示例#10
0
 /// <summary>
 /// 构造器
 /// </summary>
 /// <param name="tid">帖子的ID</param>
 public TieThread(long tid)
 {
     JObject th = JSON.parse(_stbapi.sendTieba("/c/f/pb/page", "kz=" + tid + "&pn=1", ""));
     this.tid = tid;
     if (th["error_code"].Value<int>() != 0)
     {
         throw new ThreadNotFindField(tid, th["error_code"].Value<int>(), th["error_msg"].Value<String>());
     }
     maxPage = th["page"]["total_page"].Value<long>();
     title = th["thread"]["title"].Value<String>();
     reply_num = th["thread"]["reply_num"].Value<long>();
     author = new userInBar(th["thread"]["author"]["id"].Value<long>(),
         th["thread"]["author"]["name"].Value<String>(), th["thread"]["author"]["is_like"].Value<int>() == 1,
         th["thread"]["author"]["level_id"].Value<int>(), th["thread"]["author"]["portrait"].Value<String>());
     maxPage = th["page"]["total_page"].Value<long>();
     kw = new kwf(th["forum"]["id"].Value<long>(), th["forum"]["name"].Value<String>());
     tinfo = th;
 }