/// <summary> /// Gets the differences between two CalendarItems /// </summary> /// <param name="other">The other CalendarItem to compare</param> private void GetCalendarDifferences(CalendarItem other) { var s = DateTime.Parse(!Start.Equals(StartTimeInTimeZone) ? StartTimeInTimeZone : Start).ToUniversalTime(); var e = DateTime.Parse(!End.Equals(EndTimeInTimeZone) ? EndTimeInTimeZone : End).ToUniversalTime(); var ss = DateTime.Parse(!other.Start.Equals(other.StartTimeInTimeZone) ? other.StartTimeInTimeZone : other.Start).ToUniversalTime(); var ee = DateTime.Parse(!other.End.Equals(other.EndTimeInTimeZone) ? other.EndTimeInTimeZone : other.End).ToUniversalTime(); if (!s.Equals(ss)) { Changes |= CalendarItemChanges.StartDate; } if (!e.Equals(ee)) { Changes |= CalendarItemChanges.EndDate; } if (!Subject.Equals(other.Subject)) { Changes |= CalendarItemChanges.Subject; } if (!string.IsNullOrEmpty(Location) || !string.IsNullOrEmpty(other.Location)) { if (!IgnoreSpaceAndNewLineEquals(Location, other.Location)) { Changes |= CalendarItemChanges.Location; } } if (!string.IsNullOrEmpty(Body) || !string.IsNullOrEmpty(other.Body)) { if (!IgnoreSpaceAndNewLineEquals(Body, other.Body)) { Changes |= CalendarItemChanges.Body; } } if (!string.IsNullOrEmpty(StartTimeZone) || !string.IsNullOrEmpty(other.StartTimeZone)) { if (!IgnoreNullEquals(StartTimeZone, other.StartTimeZone)) { Changes |= CalendarItemChanges.StartTimeZone; } } if (!string.IsNullOrEmpty(EndTimeZone) || !string.IsNullOrEmpty(other.EndTimeZone)) { if (!IgnoreNullEquals(EndTimeZone, other.EndTimeZone)) { Changes |= CalendarItemChanges.EndTimeZone; } } if (ReminderTime >= 0 && other.ReminderTime >= 0) { if (ReminderTime != 1080 || other.ReminderTime != 1080) { if (ReminderTime != other.ReminderTime) { Changes |= CalendarItemChanges.ReminderTime; } } } if (Attendees.Count > 0 && other.Attendees.Count > 0) { if (!Attendees.All(other.Attendees.Contains)) { Changes |= CalendarItemChanges.Attendees; } } if (Recurrence != null && other.Recurrence != null) { if (Recurrence.Equals(other.Recurrence)) { Changes |= CalendarItemChanges.Recurrence; } } else if (Recurrence != null || other.Recurrence != null) { Changes |= CalendarItemChanges.Recurrence; } other.Changes = Changes; }