public void Add(IBoardTable table) { if (table == null) { throw new ArgumentNullException("table"); } foreach (ICategory category in table) { Add(category); } }
public void Add(IBoardTable table) { if (table == null) { throw new ArgumentNullException("table"); } foreach (Category cate in table.Items) { items.Add(cate); } }
/// <summary> /// 指定したテーブルのすべての板の既得スレッド情報を取得 /// </summary> /// <param name="table"></param> /// <returns></returns> public static List <ThreadHeader> GetAllThreads(Cache cache, IBoardTable table) { List <ThreadHeader> items = new List <ThreadHeader>(); foreach (Category categ in table.Items) { foreach (BoardInfo board in categ.Children) { items.AddRange(GotThreadListIndexer.Read(cache, board)); } } return(items); }
/// <summary> /// お気に入り以外の既得スレッドを削除します。 /// </summary> /// <param name="bookmarkRoot"></param> public void RemoveWithoutBookmarks(IBoardTable table, BookmarkRoot bookmarkRoot) { if (bookmarkRoot == null) { throw new ArgumentNullException("bookmarkRoot"); } // すべての板の既得インデックスを読み込む List <ThreadHeader> targets = Twin.IO.GotThreadListReader.GetAllThreads(cache, table); int count1 = targets.Count; // 読み込まれたインデックスで、お気に入りに登録されている物は除外 for (int i = 0; i < targets.Count;) { ThreadHeader h = targets[i]; BookmarkThread match = bookmarkRoot.Search(h); if (match != null) { targets.RemoveAt(i); } else { i++; } } int count2 = count1 - targets.Count; foreach (ThreadHeader h in targets) { cache.Remove(h); } cache.ClearEmptyFolders(); #if DEBUG int count3 = Twin.IO.GotThreadListReader.GetAllThreads(cache, table).Count; MessageBox.Show(String.Format("削除前={0}, お気に入りの数={1}, 削除後のログ数={2}", count1, count2, count3)); #endif }