private bool IsMeetingChanged(GlobalObjectId goid, Item promotedItem, object[] matchedItem) { for (int i = 0; i < InternetCalendarSchema.ImportCompare.Length; i++) { PropertyDefinition propertyDefinition = InternetCalendarSchema.ImportCompare[i]; object obj = matchedItem[i]; object obj2 = promotedItem.TryGetProperty(propertyDefinition); if (!Util.ValueEquals(obj, obj2)) { if (!(obj is PropertyError) && !(obj2 is PropertyError)) { if (propertyDefinition == CalendarItemBaseSchema.AppointmentRecurrenceBlob) { InternalRecurrence internalRecurrence = InternalRecurrence.InternalParse((byte[])obj, (VersionedId)matchedItem[this.QueryIndexId], CalendarImporter.GetRecurringTimeZoneFromQueryItem(matchedItem), promotedItem.PropertyBag.ExTimeZone, CalendarItem.DefaultCodePage); InternalRecurrence recurrenceFromItem = CalendarItem.GetRecurrenceFromItem(promotedItem); ExTraceGlobals.SharingTracer.TraceDebug <InternalRecurrence, InternalRecurrence, GlobalObjectId>((long)this.GetHashCode(), "CalendarImporter::IsMeetingChanged. Comparing property AppointmentRecurrenceBlob: old Recurrence is {0}; new Recurrence is {1}. GOID:{2}.", internalRecurrence, recurrenceFromItem, goid); if (Util.ValueEquals(internalRecurrence, recurrenceFromItem) && Util.ValueEquals(internalRecurrence.GetDeletedOccurrences(false), recurrenceFromItem.GetDeletedOccurrences(false))) { goto IL_214; } } if (true.Equals(promotedItem.TryGetProperty(CalendarItemBaseSchema.IsException)) && (propertyDefinition == ItemSchema.TimeZoneDefinitionStart || propertyDefinition == CalendarItemBaseSchema.TimeZoneDefinitionEnd)) { ExTimeZone exTimeZone; O12TimeZoneFormatter.TryParseTimeZoneBlob((byte[])obj, string.Empty, out exTimeZone); ExTimeZone exTimeZone2; O12TimeZoneFormatter.TryParseTimeZoneBlob((byte[])obj2, string.Empty, out exTimeZone2); ExTraceGlobals.SharingTracer.TraceDebug((long)this.GetHashCode(), "CalendarImporter::IsMeetingChanged. Comparing property {0}: old TimeZone is {1}; new TimeZone is {2}. GOID:{3}.", new object[] { propertyDefinition.Name, (exTimeZone != null) ? exTimeZone.AlternativeId : "null", (exTimeZone2 != null) ? exTimeZone2.AlternativeId : "null", goid }); if (exTimeZone != null && exTimeZone2 != null) { REG_TIMEZONE_INFO reg_TIMEZONE_INFO = TimeZoneHelper.RegTimeZoneInfoFromExTimeZone(exTimeZone, (ExDateTime)matchedItem[CalendarImporter.QueryIndexOfProperty(CalendarItemInstanceSchema.StartTime)]); REG_TIMEZONE_INFO reg_TIMEZONE_INFO2 = TimeZoneHelper.RegTimeZoneInfoFromExTimeZone(exTimeZone2, (ExDateTime)promotedItem.TryGetProperty(CalendarItemInstanceSchema.StartTime)); if (Util.ValueEquals(reg_TIMEZONE_INFO, reg_TIMEZONE_INFO2)) { goto IL_214; } } } } ExTraceGlobals.SharingTracer.TraceDebug((long)this.GetHashCode(), "CalendarImporter::IsMeetingChanged. Change is detected on property {0}: old value is {1}; new value is {2}. GOID:{3}; Subject:{4}; StartTime:{5}.", new object[] { propertyDefinition.Name, obj, obj2, goid, promotedItem.TryGetProperty(ItemSchema.Subject), promotedItem.TryGetProperty(CalendarItemInstanceSchema.StartTime) }); return(true); } IL_214 :; } return(false); }
internal static ExDateTime?GetNormalizedTime(PropertyBag.BasicPropertyStore propertyBag, GuidIdPropertyDefinition utcTimeProperty, PropertyTagPropertyDefinition legacyUtcTimeProperty) { ExDateTime?valueAsNullable = propertyBag.GetValueAsNullable <ExDateTime>(utcTimeProperty); if (valueAsNullable == null) { if (legacyUtcTimeProperty != null) { valueAsNullable = propertyBag.GetValueAsNullable <ExDateTime>(legacyUtcTimeProperty); } if (valueAsNullable == null) { return(null); } } ExDateTime exDateTime = ExTimeZone.UtcTimeZone.ConvertDateTime(valueAsNullable.Value); byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.TimeZoneDefinitionStart); ExTimeZone legacyTimeZone; if (O12TimeZoneFormatter.TryParseTimeZoneBlob(valueOrDefault, string.Empty, out legacyTimeZone)) { exDateTime = TimeZoneHelper.NormalizeUtcTime(exDateTime, legacyTimeZone); } exDateTime = StartTimeProperty.DynamicAdjustForAllDayEvent(propertyBag, exDateTime, utcTimeProperty == InternalSchema.MapiEndTime); return(new ExDateTime?(propertyBag.TimeZone.ConvertDateTime(exDateTime))); }
internal static ExTimeZone FindBestMatchingTimeZone(byte[] timeZoneBlob) { ExTimeZone exTimeZone = null; if (O12TimeZoneFormatter.TryParseTimeZoneBlob(timeZoneBlob, string.Empty, out exTimeZone) && exTimeZone.IsCustomTimeZone) { exTimeZone = TimeZoneHelper.PromoteCustomizedTimeZone(exTimeZone); } return(exTimeZone); }
internal static ExTimeZone GetExTimeZoneFromLegacyBlob(PropertyBag.BasicPropertyStore propertyBag, NativeStorePropertyDefinition propertyDefinition) { byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(propertyDefinition); ExTimeZone exTimeZone; if (O12TimeZoneFormatter.TryParseTimeZoneBlob(valueOrDefault, string.Empty, out exTimeZone)) { return(TimeZoneHelper.PromoteCustomizedTimeZone(exTimeZone) ?? exTimeZone); } return(ExTimeZone.UtcTimeZone); }
internal static void DenormalizeTimeProperty(PropertyBag propertyBag, ExDateTime newTime, GuidIdPropertyDefinition utcTimeProperty, PropertyTagPropertyDefinition legacyUtcTimeProperty) { byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.TimeZoneDefinitionStart); ExTimeZone legacyTimeZone; if (O12TimeZoneFormatter.TryParseTimeZoneBlob(valueOrDefault, string.Empty, out legacyTimeZone)) { ExDateTime exDateTime = TimeZoneHelper.DeNormalizeToUtcTime(newTime, legacyTimeZone); propertyBag.SetProperty(utcTimeProperty, exDateTime); if (legacyUtcTimeProperty != null) { propertyBag.SetProperty(legacyUtcTimeProperty, exDateTime); } } }
internal static ExTimeZone GetTimeZoneFromProperties(string timeZoneDisplayName, byte[] o11TimeZoneBlob, byte[] o12TimeZoneBlob) { string text = timeZoneDisplayName ?? string.Empty; ExTimeZone result; if (O12TimeZoneFormatter.TryParseTimeZoneBlob(o12TimeZoneBlob, text, out result)) { return(result); } ExTimeZone result2; if (O11TimeZoneFormatter.TryParseTimeZoneBlob(o11TimeZoneBlob, text, out result2)) { return(result2); } return(null); }