Пример #1
0
        public static NewsInfo Parse(string stringify)
        {
            string[] ret = stringify.Split(new char[] { '|' }, 8, StringSplitOptions.None);
            if (ret.Length != 8)
            {
                throw new Exception("格式不正确,NewsInfo:" + stringify);
            }
            NewsInfo item = new NewsInfo();

            if (string.Compare("null", ret[0]) != 0)
            {
                item.Id = uint.Parse(ret[0]);
            }
            if (string.Compare("null", ret[1]) != 0)
            {
                item.Create_time = new DateTime(long.Parse(ret[1]));
            }
            if (string.Compare("null", ret[2]) != 0)
            {
                item.Intro = ret[2].Replace(StringifySplit, "|");
            }
            if (string.Compare("null", ret[3]) != 0)
            {
                item.Pv = uint.Parse(ret[3]);
            }
            if (string.Compare("null", ret[4]) != 0)
            {
                item.Source = ret[4].Replace(StringifySplit, "|");
            }
            if (string.Compare("null", ret[5]) != 0)
            {
                item.State = (NewsSTATE)long.Parse(ret[5]);
            }
            if (string.Compare("null", ret[6]) != 0)
            {
                item.Title = ret[6].Replace(StringifySplit, "|");
            }
            if (string.Compare("null", ret[7]) != 0)
            {
                item.Update_time = new DateTime(long.Parse(ret[7]));
            }
            return(item);
        }
Пример #2
0
 public int UnflagNews(NewsInfo News) => UnflagNews(News.Id);
Пример #3
0
 public News_newstagInfo FlagNews(NewsInfo News) => FlagNews(News.Id);
Пример #4
0
 public static string ToJson(this NewsInfo item)
 {
     return(string.Concat(item));
 }