public basePost(userInBar author, postContent[] content, long floor, long id, long supn, long time, String title) { this.author = author; this.content = content; this.floor = floor; this.id = id; this.sub_post_number = supn; this.time = time; this.title = title; }
public TiePost(long pid, long tid) : base(pid, tid) { JToken tiejt = JSON.parse(_stbapi.sendTieba("/c/f/pb/floor", "kz=" + tid + "&pid=" + pid + "&pn=1", "")); if (tiejt["error_code"].Value <int>() != 0) { throw new PostNotFindField(tiejt["error_code"].Value <int>(), tiejt["error_msg"].Value <String>()); } maxPage = tiejt["page"]["total_page"].Value <long>(); this.tid = tiejt["thread"]["id"].Value <long>(); try { author = new userInBar(tiejt["post"]["author"]["id"].Value <long>(), tiejt["post"]["author"]["name"].Value <String>(), tiejt["post"]["author"]["is_like"].Value <int>() == 1, tiejt["post"]["author"]["level_id"].Value <int>(), tiejt["post"]["author"]["portrait"].Value <String>()); } catch (FormatException e) { author = new userInBar(0, tiejt["post"]["author"]["name"].Value <String>(), false, 0, tiejt["post"]["author"]["portrait"].Value <String>()); } JToken[] jt = tiejt["post"]["content"].Children().ToArray <JToken>(); List <postContent> lpc = new List <postContent>(); foreach (JToken jcont in jt) { lpc.Add(postContent.byJtoken(jcont)); } content = lpc.ToArray(); id = tiejt["post"]["id"].Value <long>(); time = tiejt["post"]["time"].Value <long>(); pinfo = tiejt; try { inFloor = tiejt["post"]["floor"].Value <long>(); } catch (Exception e) { inFloor = 0; } }
public TiePost(long pid, long tid) { JToken tiejt = JSON.parse(_stbapi.sendTieba("/c/f/pb/floor", "kz=" + tid + "&pid=" + pid + "&pn=1", "")); if (tiejt["error_code"].Value<int>() != 0) { throw new PostNotFindField(tiejt["error_code"].Value<int>(), tiejt["error_msg"].Value<String>()); } maxPage = tiejt["page"]["total_page"].Value<long>(); this.tid = tiejt["thread"]["id"].Value<long>(); try { author = new userInBar(tiejt["post"]["author"]["id"].Value<long>(), tiejt["post"]["author"]["name"].Value<String>(), tiejt["post"]["author"]["is_like"].Value<int>() == 1, tiejt["post"]["author"]["level_id"].Value<int>(), tiejt["post"]["author"]["portrait"].Value<String>()); } catch (FormatException e) { author = new userInBar(0, tiejt["post"]["author"]["name"].Value<String>(), false, 0, tiejt["post"]["author"]["portrait"].Value<String>()); } JToken[] jt = tiejt["post"]["content"].Children().ToArray<JToken>(); List<postContent> lpc = new List<postContent>(); foreach (JToken jcont in jt) { lpc.Add(postContent.byJtoken(jcont)); } content = lpc.ToArray(); id = tiejt["post"]["id"].Value<long>(); time = tiejt["post"]["time"].Value<long>(); pinfo = tiejt; try { inFloor = tiejt["post"]["floor"].Value<long>(); } catch (Exception e) { inFloor = 0; } }