internal static ExDateTime?GetWallClockTime(PropertyBag.BasicPropertyStore propertyBag, GuidIdPropertyDefinition utcTimeProperty, PropertyTagPropertyDefinition legacyUtcTimeProperty, NativeStorePropertyDefinition[] timeZoneBlobPropertyDefinitions) { ExDateTime?normalizedTime = StartTimeProperty.GetNormalizedTime(propertyBag, utcTimeProperty, legacyUtcTimeProperty); if (normalizedTime == null) { return(null); } byte[] array = null; foreach (NativeStorePropertyDefinition propertyDefinition in timeZoneBlobPropertyDefinitions) { array = propertyBag.GetValueOrDefault <byte[]>(propertyDefinition); if (array != null) { break; } } if (array == null) { ExTraceGlobals.StorageTracer.TraceWarning(0L, "Could not determine suitable time zone"); } ExTimeZone exTimeZone = StartWallClockProperty.FindBestMatchingTimeZone(array); if (exTimeZone != null) { return(new ExDateTime?(exTimeZone.ConvertDateTime(normalizedTime.Value))); } return(new ExDateTime?(normalizedTime.Value)); }
internal static object InternalTryGetDateTimeValue(PropertyBag.BasicPropertyStore propertyBag, StorePropertyDefinition property, GuidIdPropertyDefinition mapiUtcTimeProperty, PropertyTagPropertyDefinition mapiLegacyUtcTimeProperty) { ExDateTime?normalizedTime = StartTimeProperty.GetNormalizedTime(propertyBag, mapiUtcTimeProperty, mapiLegacyUtcTimeProperty); if (normalizedTime != null) { return(normalizedTime.Value); } return(new PropertyError(property, PropertyErrorCode.NotFound)); }
internal static void RecalculateNormalizedTimeProperty(PropertyBag.BasicPropertyStore propertyBag, GuidIdPropertyDefinition utcTimeProperty, PropertyTagPropertyDefinition legacyUtcTimeProperty, ExTimeZone newTimeZone) { if (newTimeZone == null || newTimeZone == ExTimeZone.UtcTimeZone || newTimeZone == ExTimeZone.UnspecifiedTimeZone) { return; } ExDateTime?normalizedTime = StartTimeProperty.GetNormalizedTime(propertyBag, utcTimeProperty, legacyUtcTimeProperty); if (normalizedTime != null) { ExDateTime exDateTime = newTimeZone.ConvertDateTime(normalizedTime.Value); propertyBag.SetValueWithFixup(utcTimeProperty, exDateTime.ToUtc()); if (legacyUtcTimeProperty != null) { propertyBag.SetValueWithFixup(legacyUtcTimeProperty, exDateTime.ToUtc()); } } }
internal static ExDateTime?GetNormalizedTime(PropertyBag propertyBag, GuidIdPropertyDefinition utcTimeProperty, PropertyTagPropertyDefinition legacyUtcTimeProperty) { return(StartTimeProperty.GetNormalizedTime((PropertyBag.BasicPropertyStore)propertyBag, utcTimeProperty, legacyUtcTimeProperty)); }