Esempio n. 1
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            ExTimeZone exTimeZone = value as ExTimeZone;

            if (exTimeZone == ExTimeZone.UnspecifiedTimeZone)
            {
                throw new InvalidOperationException("unspecified time zone is not allowed to set");
            }
            StartTimeZoneProperty.RecalculateNormalizedTimeProperty(propertyBag, InternalSchema.MapiStartTime, InternalSchema.MapiPRStartDate, exTimeZone);
            StartTimeZoneProperty.RecalculateNormalizedTimeProperty(propertyBag, InternalSchema.MapiEndTime, InternalSchema.MapiPREndDate, exTimeZone);
            StartTimeZoneProperty.RecalculateNormalizedTimeProperty(propertyBag, InternalSchema.ReminderNextTime, null, exTimeZone);
            if (exTimeZone == ExTimeZone.UtcTimeZone)
            {
                if (!(propertyBag.Context.StoreObject is CalendarItemOccurrence))
                {
                    propertyBag.Delete(InternalSchema.TimeZoneDefinitionStart);
                    return;
                }
            }
            else
            {
                byte[] timeZoneBlob = O12TimeZoneFormatter.GetTimeZoneBlob(exTimeZone);
                propertyBag.SetValueWithFixup(InternalSchema.TimeZoneDefinitionStart, timeZoneBlob);
                StartTimeZoneProperty.SyncRecurringTimeZoneProperties(propertyBag, exTimeZone, timeZoneBlob);
            }
        }
        internal static void SetCalendarTime(PropertyBag.BasicPropertyStore propertyBag, GuidIdPropertyDefinition utcTimeProperty, PropertyTagPropertyDefinition legacyUtcTimeProperty, GuidIdPropertyDefinition timeZoneDefinition, bool isEndTime, object value)
        {
            StoreObject      storeObject      = propertyBag.Context.StoreObject;
            CalendarItemBase calendarItemBase = storeObject as CalendarItemBase;

            if (calendarItemBase != null && calendarItemBase.PropertyBag.ExTimeZone != null && calendarItemBase.IsAllDayEventCache == null)
            {
                object obj = IsAllDayEventProperty.CalculateIsAllDayEvent(propertyBag);
                if (obj is bool)
                {
                    calendarItemBase.IsAllDayEventCache = new bool?((bool)obj);
                }
            }
            propertyBag.SetValueWithFixup(utcTimeProperty, value);
            propertyBag.SetValueWithFixup(legacyUtcTimeProperty, value);
            ExTimeZone timeZone = propertyBag.TimeZone;

            if (value is ExDateTime && ((ExDateTime)value).TimeZone != null && ((ExDateTime)value).TimeZone != ExTimeZone.UnspecifiedTimeZone)
            {
                timeZone = ((ExDateTime)value).TimeZone;
            }
            if (timeZone == ExTimeZone.UtcTimeZone)
            {
                if (!(storeObject is CalendarItemOccurrence))
                {
                    propertyBag.Delete(timeZoneDefinition);
                }
            }
            else if (value is ExDateTime && timeZone != ExTimeZone.UnspecifiedTimeZone)
            {
                if (timeZoneDefinition == InternalSchema.TimeZoneDefinitionStart)
                {
                    byte[] timeZoneBlob = O12TimeZoneFormatter.GetTimeZoneBlob(timeZone);
                    StartTimeZoneProperty.RecalculateNormalizedTimeProperty(propertyBag, InternalSchema.MapiEndTime, InternalSchema.MapiPREndDate, timeZone);
                    StartTimeZoneProperty.RecalculateNormalizedTimeProperty(propertyBag, InternalSchema.ReminderNextTime, null, timeZone);
                    StartTimeZoneProperty.SyncRecurringTimeZoneProperties(propertyBag, timeZone, timeZoneBlob);
                    propertyBag.SetValueWithFixup(timeZoneDefinition, timeZoneBlob);
                }
                else
                {
                    byte[] timeZoneBlob2 = O12TimeZoneFormatter.GetTimeZoneBlob(timeZone, (ExDateTime)value);
                    propertyBag.SetValueWithFixup(timeZoneDefinition, timeZoneBlob2);
                }
            }
            if (!isEndTime)
            {
                propertyBag.SetValueWithFixup(InternalSchema.ReminderDueByInternal, value);
            }
            if (storeObject != null)
            {
                Reminder.Adjust(storeObject);
            }
        }
Esempio n. 3
0
 internal static void SyncRecurringTimeZoneProperties(PropertyBag.BasicPropertyStore propertyBag, ExTimeZone timeZone, byte[] o12TimeZoneBlob)
 {
     if (o12TimeZoneBlob == null)
     {
         o12TimeZoneBlob = O12TimeZoneFormatter.GetTimeZoneBlob(timeZone);
     }
     if (propertyBag.GetValueOrDefault <bool>(InternalSchema.AppointmentRecurring) && timeZone != ExTimeZone.UtcTimeZone && timeZone != ExTimeZone.UnspecifiedTimeZone)
     {
         propertyBag.SetValueWithFixup(InternalSchema.TimeZone, timeZone.LocalizableDisplayName.ToString());
         propertyBag.SetValueWithFixup(InternalSchema.TimeZoneBlob, O11TimeZoneFormatter.GetTimeZoneBlob(timeZone));
         propertyBag.SetValueWithFixup(InternalSchema.TimeZoneDefinitionRecurring, o12TimeZoneBlob);
     }
 }
Esempio n. 4
0
        private static List <ExTimeZone> MatchCustomTimeZoneByRules(ExTimeZone customTimeZone, List <ExTimeZone> candidates)
        {
            List <ExTimeZone> list = new List <ExTimeZone>();

            byte[] timeZoneBlob = O12TimeZoneFormatter.GetTimeZoneBlob(customTimeZone);
            foreach (ExTimeZone exTimeZone in candidates)
            {
                byte[] timeZoneBlob2 = O12TimeZoneFormatter.GetTimeZoneBlob(exTimeZone);
                if (O12TimeZoneFormatter.CompareBlob(timeZoneBlob, timeZoneBlob2, false))
                {
                    list.Add(exTimeZone);
                }
            }
            return(list);
        }
Esempio n. 5
0
        private void AppendTimeZoneInfo()
        {
            MailboxSession mailboxSession = this.item.Session as MailboxSession;

            if (mailboxSession == null)
            {
                return;
            }
            ExTimeZone timeZone;

            byte[] timeZoneBlob;
            if (TimeZoneSettings.TryFindOwaTimeZone(mailboxSession, out timeZone))
            {
                timeZoneBlob = O12TimeZoneFormatter.GetTimeZoneBlob(timeZone);
                this.tnefWriter.WriteProperty(InternalSchema.TimeZoneDefinitionStart, timeZoneBlob);
                return;
            }
            if (TimeZoneSettings.TryFindOutlookTimeZone(mailboxSession, out timeZoneBlob))
            {
                this.tnefWriter.WriteProperty(InternalSchema.TimeZoneDefinitionStart, timeZoneBlob);
            }
        }
Esempio n. 6
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            ExTimeZone exTimeZone = value as ExTimeZone;

            if (exTimeZone == ExTimeZone.UnspecifiedTimeZone)
            {
                throw new InvalidOperationException("unspecified time zone is not allowed to set");
            }
            if (exTimeZone == ExTimeZone.UtcTimeZone)
            {
                if (!(propertyBag.Context.StoreObject is CalendarItemOccurrence))
                {
                    propertyBag.Delete(InternalSchema.TimeZoneDefinitionStart);
                    return;
                }
            }
            else
            {
                ExDateTime valueOrDefault = propertyBag.GetValueOrDefault <ExDateTime>(InternalSchema.MapiEndTime, ExDateTime.UtcNow);
                propertyBag.SetValueWithFixup(InternalSchema.TimeZoneDefinitionEnd, (exTimeZone != null) ? O12TimeZoneFormatter.GetTimeZoneBlob(exTimeZone, valueOrDefault) : null);
            }
        }
        internal List <object[]> Expand(object[] masterValues, ExDateTime start, ExDateTime end, int codePage, PropertyDefinition[] columns, RecurrenceExpansionOption options)
        {
            List <object[]> list = new List <object[]>();

            if (masterValues.Length != columns.Length)
            {
                throw new ArgumentException(ServerStrings.ExInvalidMasterValueAndColumnLength);
            }
            object[] array = null;
            if ((options & RecurrenceExpansionOption.TruncateMaster) == RecurrenceExpansionOption.TruncateMaster)
            {
                array = this.GetTruncatedRecurringMaster(masterValues, start, end, columns);
                if (array == null)
                {
                    return(list);
                }
            }
            else
            {
                array = masterValues;
            }
            int                  num                  = Array.IndexOf <PropertyDefinition>(columns, InternalSchema.ItemId);
            VersionedId          versionedId          = (VersionedId)array[num];
            Item                 item                 = null;
            AttachmentCollection attachmentCollection = null;
            bool                 flag;

            try
            {
                byte[] timeZoneBlob = O12TimeZoneFormatter.GetTimeZoneBlob(this.recurrence.CreatedExTimeZone);
                IList <OccurrenceInfo> occurrenceInfoList = this.recurrence.GetOccurrenceInfoList(start, end);
                flag = (occurrenceInfoList.Count != 0);
                foreach (OccurrenceInfo occurrenceInfo in occurrenceInfoList)
                {
                    bool flag2 = occurrenceInfo is ExceptionInfo;
                    if (flag2 || (options & RecurrenceExpansionOption.IncludeRegularOccurrences) == RecurrenceExpansionOption.IncludeRegularOccurrences)
                    {
                        object[] array2 = new object[array.Length];
                        array.CopyTo(array2, 0);
                        if (flag2)
                        {
                            this.PopulateExceptionOccurrence(array2, columns, (ExceptionInfo)occurrenceInfo, ref attachmentCollection, ref item, occurrenceInfo.VersionedId);
                        }
                        this.AdjustOccurrenceColumnsForExpansion(array2, columns, occurrenceInfo, codePage, timeZoneBlob, flag2);
                        list.Add(array2);
                    }
                }
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
            }
            if (flag && (options & RecurrenceExpansionOption.IncludeMaster) == RecurrenceExpansionOption.IncludeMaster)
            {
                list.Insert(0, array);
            }
            return(list);
        }