/// <summary> /// 指定したインデックスをあぼーん /// </summary> /// <param name="index">削除するレス番号</param> /// <param name="visible">可視あぼーんならtrue</param> public ResSet ABone(int index, bool visible, ABoneType type, string description) { int st = 0; int ed = Count - 1; while (st <= ed) { int mid = (st + ed) / 2; ResSet res = this[mid]; if (res.Index > index) { ed = mid - 1; } else if (res.Index < index) { st = mid + 1; } else { st = mid; break; } } // あぼーん this[st] = ResSet.ABone(this[st], visible, type, description); return(this[st]); }
/// <summary> /// 指定したレスをあぼーん /// </summary> /// <param name="resSet"></param> /// <param name="abone"></param> /// <returns></returns> public static ResSet ABone(ResSet resSet, bool visible, ABoneType type, string description) { resSet.IsABone = true; resSet.Visible = visible; if (type == ABoneType.Tomei) { resSet.visible = false; resSet.Name = resSet.Email = resSet.DateString = resSet.Body = "透明あぼーん"; } else if (type == ABoneType.Normal) { resSet.visible = true; resSet.Name = resSet.Email = resSet.DateString = resSet.Body = "あぼーん"; } else if (type == ABoneType.NG) { resSet.Name = resSet.Email = resSet.DateString = resSet.Body = "<i>NGあぼーん</i>"; } else if (type == ABoneType.Chain) { resSet.Body = "連鎖あぼーん"; } else if (type == ABoneType.Syria) { resSet.Body = "シリア語あぼーん"; resSet.Name = resSet.Email = "<i>あぼーん</i>"; } else if (type == ABoneType.NGBody) { resSet.Body = "本文あぼーん"; } else if (type == ABoneType.NGID) { resSet.Body = "NGIDあぼーん"; } else if (type == ABoneType.NGMail) { resSet.Body = "NGMailあぼーん"; } else if (type == ABoneType.NGName) { resSet.Body = "NGNameあぼーん"; } if (!String.IsNullOrEmpty(description)) { resSet.Body += ":" + description; } resSet.Body = "<i>" + resSet.Body + "</i>"; return(resSet); }
/// <summary> /// ResSetクラスのインスタンスを初期化 /// </summary> /// <param name="index">レス番号</param> /// <param name="name">投稿者の名前</param> /// <param name="email">投稿者のE-mail</param> /// <param name="dateString">投稿日</param> /// <param name="body">本分</param> public ResSet(int index, string name, string email, string dateString, string body) : this() { if (name == null) { throw new ArgumentNullException("name"); } if (email == null) { throw new ArgumentNullException("email"); } if (dateString == null) { throw new ArgumentNullException("dateString"); } if (body == null) { throw new ArgumentNullException("body"); } this.index = index; this.name = name; this.email = email; this.body = body; this.dateString = dateString; this.host = null; this.id = null; this.tag = null; this.isNew = true; this.abone = false; this.visible = true; this.bookmark = false; this.serverAboned = false; this.links = null; this.refidx = null; this.aboneTyoe = ABoneType.NG; this.BackReferencedList = new List <int>(); }