public Column[] GetColumns() { string json = Post("blog/getcolumn"); string[] items = json.Split(new string[] { "},{" }, StringSplitOptions.None); if (!items[0].Contains("\"alias\"")) { return new Column[0]; } var list = new Column[items.Length]; for (int i = 0; i < items.Length; i++) { list[i] = new Column() { Alias = GetValue("alias", items[i]), Channel = GetValue("channel", items[i]).ToInt(), Title = GetValue("title", items[i]), Description = GetValue("description", items[i]), Url = GetValue("url", items[i]), Logo = GetValue("logo", items[i]), ViewCount = GetValue("view_count", items[i]).ToInt() }; } return list; }
public Column[] GetColumns(ref PageParameter page, int channel = 0) { if (page == null) page = new PageParameter(); string data = string.Format("channel={0}&page={1}&size={2}" , channel, page.PageIndex, page.PageSize); string json = Post("blog/getcolumnlist"); page.RowCount = GetValue("count", json).ToInt(); string[] items = json.Split(new string[] { "},{" }, StringSplitOptions.None); if (!items[0].Contains("\"alias\"")) { return new Column[0]; } var list = new Column[items.Length]; for (int i = 0; i < items.Length; i++) { list[i] = new Column() { Alias = GetValue("alias", items[i]), Channel = GetValue("channel", items[i]).ToInt(), Title = GetValue("title", items[i]), Description = GetValue("description", items[i]), Url = GetValue("url", items[i]), Logo = GetValue("logo", items[i]) }; } return list; }