private void StoreEntry(HtmlDocument doc, List <NicoNicoCommentEntry> list) { var nodes = doc.DocumentNode.SelectNodes("/packet/chat"); if (nodes == null) { return; } foreach (var node in nodes) { var attr = node.Attributes; //削除されていたら登録しない もったいないしね if (attr.Contains("deleted")) { continue; } var entry = new NicoNicoCommentEntry(); entry.No = attr["no"].Value; entry.Vpos = attr["vpos"].Value; entry.RenderTime = NicoNicoUtil.GetTimeFromVpos(entry.Vpos); var unix = UnixTime.FromUnixTime(long.Parse(attr["date"].Value)); entry.Date = unix.ToLongDateString() + " " + unix.ToLongTimeString(); entry.UserId = attr.Contains("user_id") ? attr["user_id"].Value : "contributor"; entry.Mail = attr.Contains("mail") ? attr["mail"].Value : ""; entry.Content = HttpUtility.HtmlDecode(node.InnerText); entry.Score = attr.Contains("score") ? int.Parse(attr["score"].Value) : 0; if (!NicoNicoNGComment.Filter(entry)) { list.Add(entry); } } }
//ログイン後の初期化処理 public void LogedInInit() { User = new NicoNicoUserEntry(); User.UserId = NicoNicoWrapperMain.Session.UserId; User.UserName = NicoNicoUser.LookupUserName(User.UserId); App.ViewModelRoot.Title += "(user:"******")"; TabItems.Add(WebView = new WebViewViewModel()); TabItems.Add(Ranking = new RankingViewModel()); TabItems.Add(Search = new SearchViewModel()); TabItems.Add(new FavoriteViewModel()); TabItems.Add(new NicoRepoViewModel()); TabItems.Add(new MylistViewModel()); TabItems.Add(NotifyLive = new NotifyLiveViewModel()); TabItems.Add(new HistoryViewModel()); TabItems.Add(new OtherViewModel()); TabItems.Add(Config = new ConfigViewModel()); //生放送通知を更新するタイマーを動かす StatusBar.StartRefreshTimer(); //サーバーからアップデートがあるか確認してあったらアップデートダイアログを出す Update.CheckUpdate(); //公式NG機能を初期化 NGCommentInstance = new NicoNicoNGComment(); //NGCommentInstance.GetNGClient(); if(Environment.GetCommandLineArgs().Length > 1) { Task.Run(() => NicoNicoOpener.Open(Environment.GetCommandLineArgs()[1])); } }