public MockWeiboComment() { user = new MockUserExt(); text = "今天没带冈本!第一反应是----不能约炮了! "; created_at = DateTime.Now; status = new Status() { user = new User { screen_name = "what'syouname" }, text = "-不能约炮了!" }; replier = new CommentReply(0,0); }
protected async Task FetchUrlInfos(Status[] ses) { if (ses == null || ses.Length == 0) return; var mem = MemoryCache.Default; var urls = new HashSet<string>(); foreach (var s in ses) { var us = Utils.ExtractUrlFromWeibo(s.text); foreach(var url in us) { if (mem.Get("http://t.cn/" + url) == null) urls.Add(url); } //urls.Add(us); if (s.retweeted_status != null) { var rus = Utils.ExtractUrlFromWeibo(s.retweeted_status.text); foreach (var url in rus) { if (mem.Get("http://t.cn/" + url) == null) urls.Add(url); } } } if(urls.Count >= 20) { var tasks = new Task[2]; var u1 = urls.Take(20); tasks[0] = FetchUrlInfosImp(u1); var u2 = urls.Skip(20); tasks[1] = FetchUrlInfosImp(u2); await Task.WhenAll(tasks); }else { await FetchUrlInfosImp(urls); } }
public void assign_sina(Status data) { assign_sina_data(data); var para = new InitializeParam(); if(data.retweeted_status != null) { retweeted_status = new WeiboStatus(); retweeted_status.assign_sina_data(data.retweeted_status); retweeted_status.post_initialize(false,para); } post_initialize(true, para); if (url.has_media) Messenger.Default.Send(url); }