public override void CopyFrom(object obj) { if (obj is ByDay) { ByDay bd = (ByDay)obj; this.Num = bd.Num; this.DayOfWeek = bd.DayOfWeek; } }
public override bool Equals(object obj) { if (obj is Recur) { Recur r = (Recur)obj; if (!ArrayEquals(r.ByDay.ToArray(), ByDay.ToArray()) || !ArrayEquals(r.ByHour.ToArray(), ByHour.ToArray()) || !ArrayEquals(r.ByMinute.ToArray(), ByMinute.ToArray()) || !ArrayEquals(r.ByMonth.ToArray(), ByMonth.ToArray()) || !ArrayEquals(r.ByMonthDay.ToArray(), ByMonthDay.ToArray()) || !ArrayEquals(r.BySecond.ToArray(), BySecond.ToArray()) || !ArrayEquals(r.BySetPos.ToArray(), BySetPos.ToArray()) || !ArrayEquals(r.ByWeekNo.ToArray(), ByWeekNo.ToArray()) || !ArrayEquals(r.ByYearDay.ToArray(), ByYearDay.ToArray())) { return(false); } if (r.Count != Count) { return(false); } if (r.Frequency != Frequency) { return(false); } if (r.Interval != Interval && // MinValue and 1 are treated as identical for Interval ((r.Interval != int.MinValue && r.Interval != 1) || (Interval != int.MinValue && Interval != 1))) { return(false); } if (r.Until != null) { if (!r.Until.Equals(Until)) { return(false); } } else if (Until != null) { return(false); } if (r.Wkst != Wkst) { return(false); } return(true); } return(base.Equals(obj)); }
public override int GetHashCode() { int hashCode = ByDay.GetHashCode() ^ ByHour.GetHashCode() ^ ByMinute.GetHashCode() ^ ByMonth.GetHashCode() ^ ByMonthDay.GetHashCode() ^ BySecond.GetHashCode() ^ BySetPos.GetHashCode() ^ ByWeekNo.GetHashCode() ^ ByYearDay.GetHashCode() ^ Count.GetHashCode() ^ Frequency.GetHashCode(); if (Interval.Equals(1) || Interval.Equals(int.MinValue)) { hashCode ^= 0x1; } else { hashCode ^= Interval.GetHashCode(); } hashCode ^= Until.GetHashCode(); hashCode ^= Wkst.GetHashCode(); return(hashCode); }
public override bool TryParse(string value, ref object obj) { ByDay bd = (ByDay)obj; Match bdMatch = Regex.Match(value, @"(\+|-)?(\d{1,2})?(\w{2})"); if (bdMatch.Success) { if (bdMatch.Groups[2].Success) { bd.Num = Convert.ToInt32(bdMatch.Groups[2].Value); if (bdMatch.Groups[1].Success && bdMatch.Groups[1].Value.Contains("-")) { bd.Num *= -1; } } bd.DayOfWeek = Recur.GetDayOfWeek(bdMatch.Groups[3].Value); return(true); } return(false); }
public int CompareTo(object obj) { ByDay bd = null; if (obj is string) { bd = new ByDay(obj as string); } else if (obj is ByDay) { bd = (ByDay)obj; } if (bd == null) { throw new ArgumentException(); } else { return(this.DayOfWeek.CompareTo(bd.DayOfWeek)); } }
public int CompareTo(object obj) { ByDay bd = null; if (obj is string) bd = new ByDay(obj as string); else if (obj is ByDay) bd = (ByDay)obj; if (bd == null) throw new ArgumentException(); else return this.DayOfWeek.CompareTo(bd.DayOfWeek); }