protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
 {
     byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.PropertyChangeMetadataRaw);
     if (valueOrDefault == null)
     {
         CalendarItemOccurrence calendarItemOccurrence = propertyBag.Context.StoreObject as CalendarItemOccurrence;
         if (calendarItemOccurrence == null)
         {
             return(null);
         }
         return(calendarItemOccurrence.OccurrencePropertyBag.ComputeChangeMetadataBasedOnLoadedProperties());
     }
     else
     {
         if (valueOrDefault.Length == 0)
         {
             return(null);
         }
         object result;
         try
         {
             result = PropertyChangeMetadata.Parse(valueOrDefault);
         }
         catch (PropertyChangeMetadataFormatException ex)
         {
             result = new PropertyError(this, PropertyErrorCode.CorruptedData, ex.Message);
         }
         return(result);
     }
 }
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            string folderHomePageUrl = (string)value;

            byte[] propertyValue = FolderHomePageUrlProperty.CreateWebViewInformation(folderHomePageUrl);
            propertyBag.SetValueWithFixup(InternalSchema.FolderWebViewInfo, propertyValue);
        }
 protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
 {
     if (!propertyBag.CanIgnoreUnchangedProperties || (this.CompositeProperty.PropertyFlags & PropertyFlags.SetIfNotChanged) == PropertyFlags.SetIfNotChanged || !propertyBag.IsLoaded(this.CompositeProperty) || !object.Equals(this.InternalTryGetValue(propertyBag), value))
     {
         propertyBag.SetValueWithFixup(this.CompositeProperty, value);
     }
 }
Пример #4
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);
            }
        }
Пример #5
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            string text = propertyBag.GetValueOrDefault <string>(InternalSchema.PartnerNetworkId, null);

            if (string.IsNullOrEmpty(text))
            {
                text = WellKnownNetworkNames.Outlook;
            }
            else if (text == WellKnownNetworkNames.QuickContacts)
            {
                string valueOrDefault = propertyBag.GetValueOrDefault <string>(InternalSchema.ParentDisplayName, null);
                if ("{06967759-274D-40B2-A3EB-D7F9E73727D7}" != valueOrDefault)
                {
                    text = valueOrDefault;
                }
                else
                {
                    text = ServerStrings.PeopleQuickContactsAttributionDisplayName;
                }
            }
            else if (!WellKnownNetworkNames.IsWellKnownExternalNetworkName(text))
            {
                text = WellKnownNetworkNames.Outlook;
            }
            return(text);
        }
Пример #6
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            IDictionary <RecipientItemType, HashSet <string> > recipients = null;

            foreach (ComplexParticipantExtractorBase <string> complexParticipantExtractorBase in ReplyAllDisplayNamesProperty.Extractors)
            {
                if (complexParticipantExtractorBase.ShouldExtract(propertyBag))
                {
                    IList <string> replyTo;
                    object         result;
                    if (complexParticipantExtractorBase.Extract(propertyBag, (Participant participant) => participant.DisplayName, this.ParticipantRepresentationComparer, out recipients, out replyTo))
                    {
                        IParticipant simpleParticipant  = base.GetSimpleParticipant(InternalSchema.Sender, propertyBag);
                        IParticipant simpleParticipant2 = base.GetSimpleParticipant(InternalSchema.From, propertyBag);
                        result = ReplyAllParticipantsRepresentationProperty <string> .BuildReplyAllRecipients <string>((simpleParticipant == null)?null : simpleParticipant.DisplayName, (simpleParticipant2 == null)?null : simpleParticipant2.DisplayName, replyTo, recipients, this.ParticipantRepresentationComparer);
                    }
                    else
                    {
                        result = new PropertyError(this, PropertyErrorCode.GetCalculatedPropertyError);
                    }
                    return(result);
                }
            }
            return(new PropertyError(this, PropertyErrorCode.GetCalculatedPropertyError));
        }
Пример #7
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            object value = propertyBag.GetValue(this.conversationIdPropertyDefinition);

            byte[] array = value as byte[];
            if (array != null)
            {
                object result;
                try
                {
                    result = ConversationId.Create(array);
                }
                catch (CorruptDataException)
                {
                    result = new PropertyError(this, PropertyErrorCode.CorruptedData);
                }
                return(result);
            }
            PropertyError propertyError = (PropertyError)value;

            if (propertyError.PropertyErrorCode == PropertyErrorCode.NotEnoughMemory)
            {
                return(new PropertyError(this, PropertyErrorCode.CorruptedData));
            }
            return(new PropertyError(this, propertyError.PropertyErrorCode));
        }
Пример #8
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            string valueOrDefault = propertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass);

            if (valueOrDefault == null)
            {
                return(RecurrenceType.None);
            }
            if (ObjectClass.IsTask(valueOrDefault) || ObjectClass.IsTaskRequest(valueOrDefault))
            {
                if (propertyBag.GetValueOrDefault <bool>(InternalSchema.IsOneOff))
                {
                    return(RecurrenceType.None);
                }
                byte[] valueOrDefault2 = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.TaskRecurrence);
                return(RecurrenceTypeProperty.GetTaskRecurrenceTypeFromBlob(valueOrDefault2));
            }
            else
            {
                if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(valueOrDefault) || ObjectClass.IsMeetingMessage(valueOrDefault))
                {
                    return(propertyBag.GetValueOrDefault <RecurrenceType>(InternalSchema.MapiRecurrenceType));
                }
                return(RecurrenceType.None);
            }
        }
Пример #9
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            PublicFolderFreeBusy publicFolderFreeBusy = value as PublicFolderFreeBusy;

            if (publicFolderFreeBusy == null)
            {
                throw new ArgumentException("value");
            }
            IEnumerable <PublicFolderFreeBusyAppointment> sortedAppointments = from appointment in publicFolderFreeBusy.Appointments
                                                                               orderby appointment.StartTime
                                                                               select appointment;
            ExDateTime startDate      = publicFolderFreeBusy.StartDate;
            int        numberOfMonths = publicFolderFreeBusy.NumberOfMonths;

            int[] array = new int[numberOfMonths];
            for (int i = 0; i < numberOfMonths; i++)
            {
                ExDateTime startMonth = startDate.AddMonths(i);
                array[i] = PublicFolderFreeBusyProperty.PublishMonthPropertyConverter.ToInt(startMonth);
            }
            foreach (PublicFolderFreeBusyProperty.FreeBusyPropertySet freeBusyPropertySet in PublicFolderFreeBusyProperty.FreeBusyPropertySets)
            {
                byte[][] propertyValue = PublicFolderFreeBusyProperty.AppointmentsPropertyConverter.ToBinary(sortedAppointments, freeBusyPropertySet.BusyType, startDate, numberOfMonths);
                propertyBag.SetValue(freeBusyPropertySet.Appointments, propertyValue);
                propertyBag.SetValue(freeBusyPropertySet.PublishMonths, array);
            }
        }
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("OutlookBlockStatus");
            }
            EnumValidator.ThrowIfInvalid <BlockStatus>((BlockStatus)value, "value");
            int num = (int)value;

            if (num < 3)
            {
                propertyBag.SetValueWithFixup(InternalSchema.NativeBlockStatus, (BlockStatus)num);
                return;
            }
            ExDateTime valueOrDefault = propertyBag.GetValueOrDefault <ExDateTime>(InternalSchema.ReceivedTime, ExDateTime.MinValue);

            if (valueOrDefault != ExDateTime.MinValue)
            {
                double floatDate = ExTimeZone.UtcTimeZone.ConvertDateTime(valueOrDefault).ToOADate();
                int    num2      = OutlookBlockStatusProperty.ComputeBlockStatus(floatDate);
                propertyBag.SetValueWithFixup(InternalSchema.NativeBlockStatus, (BlockStatus)num2);
                return;
            }
            propertyBag.SetValueWithFixup(InternalSchema.NativeBlockStatus, BlockStatus.DontKnow);
        }
        internal static object CalculateIsAllDayEvent(PropertyBag.BasicPropertyStore propertyBag)
        {
            object value = propertyBag.GetValue(InternalSchema.MapiIsAllDayEvent);

            if (propertyBag.TimeZone == null)
            {
                return(value);
            }
            object        value2        = propertyBag.GetValue(InternalSchema.MapiStartTime);
            object        value3        = propertyBag.GetValue(InternalSchema.MapiEndTime);
            PropertyError propertyError = value2 as PropertyError;

            if (propertyError != null && propertyError.PropertyErrorCode == PropertyErrorCode.NotFound)
            {
                value2 = propertyBag.GetValue(InternalSchema.MapiPRStartDate);
            }
            propertyError = (value3 as PropertyError);
            if (propertyError != null && propertyError.PropertyErrorCode == PropertyErrorCode.NotFound)
            {
                value3 = propertyBag.GetValue(InternalSchema.MapiPREndDate);
            }
            if (!(value is bool) || !(value2 is ExDateTime) || !(value3 is ExDateTime))
            {
                return(value);
            }
            ExDateTime exDateTime  = (ExDateTime)value2;
            ExDateTime exDateTime2 = (ExDateTime)value3;

            if ((bool)value && exDateTime == exDateTime.Date && exDateTime2 == exDateTime2.Date && exDateTime2 > exDateTime)
            {
                return(true);
            }
            return(false);
        }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            int valueOrDefault = propertyBag.GetValueOrDefault <int>(InternalSchema.NativeBlockStatus);

            if (valueOrDefault < 0)
            {
                return(new PropertyError(this, PropertyErrorCode.GetCalculatedPropertyError));
            }
            if (valueOrDefault <= 3)
            {
                return((BlockStatus)valueOrDefault);
            }
            ExDateTime valueOrDefault2 = propertyBag.GetValueOrDefault <ExDateTime>(InternalSchema.ReceivedTime, ExDateTime.MinValue);

            if (!(valueOrDefault2 != ExDateTime.MinValue))
            {
                return(BlockStatus.DontKnow);
            }
            double floatDate = ExTimeZone.UtcTimeZone.ConvertDateTime(valueOrDefault2).ToOADate();
            int    num       = OutlookBlockStatusProperty.ComputeBlockStatus(floatDate);
            int    num2      = (num >= valueOrDefault) ? (num - valueOrDefault) : (valueOrDefault - num);

            if (num2 < 1)
            {
                return(BlockStatus.NoNeverAgain);
            }
            return(BlockStatus.DontKnow);
        }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            object value = propertyBag.GetValue(this.xmlExtractedProperty);

            if (!(value is string))
            {
                return(null);
            }
            object extractions;

            try
            {
                XmlSerializer  serializer = SerializerCache.GetSerializer(typeof(TExtractionSet));
                TExtractionSet textractionSet;
                using (StringReader stringReader = new StringReader((string)value))
                {
                    textractionSet = (serializer.Deserialize(stringReader) as TExtractionSet);
                }
                extractions = textractionSet.Extractions;
            }
            catch (InvalidOperationException innerException)
            {
                throw new CorruptDataException(ServerStrings.CorruptNaturalLanguageProperty, innerException);
            }
            return(extractions);
        }
Пример #14
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            object value = propertyBag.GetValue(InternalSchema.LinkRejectHistoryRaw);

            byte[][] array = value as byte[][];
            if (array != null)
            {
                try
                {
                    PersonId[] array2 = new PersonId[array.Length];
                    for (int i = 0; i < array.Length; i++)
                    {
                        array2[i] = PersonId.Create(array[i]);
                    }
                    return(array2);
                }
                catch (ArgumentException)
                {
                }
                return(new PropertyError(this, PropertyErrorCode.CorruptedData));
            }
            if (value is PropertyError)
            {
                return(value);
            }
            return(new PropertyError(this, PropertyErrorCode.CorruptedData));
        }
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            Participant        participant        = (Participant)value;
            ParticipantEntryId participantEntryId = ParticipantEntryId.FromParticipant(participant, ParticipantEntryIdConsumer.ContactEmailSlot);

            propertyBag.SetValueWithFixup(base.DisplayNamePropertyDefinition, participant.DisplayName ?? string.Empty);
            propertyBag.SetValueWithFixup(base.EmailAddressPropertyDefinition, participant.EmailAddress ?? string.Empty);
            propertyBag.SetValueWithFixup(base.RoutingTypePropertyDefinition, participant.RoutingType ?? string.Empty);
            if (this.emailAddressForDisplayPropDef != null)
            {
                AtomicStorePropertyDefinition propertyDefinition = this.emailAddressForDisplayPropDef;
                string propertyValue;
                if ((propertyValue = participant.GetValueOrDefault <string>(ParticipantSchema.EmailAddressForDisplay)) == null)
                {
                    propertyValue = (participant.EmailAddress ?? string.Empty);
                }
                propertyBag.SetValueWithFixup(propertyDefinition, propertyValue);
            }
            if (participantEntryId != null)
            {
                propertyBag.SetValueWithFixup(base.EntryIdPropertyDefinition, participantEntryId.ToByteArray());
                return;
            }
            propertyBag.Delete(base.EntryIdPropertyDefinition);
        }
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            RecipientDisplayType recipientDisplayType = (RecipientDisplayType)value;

            propertyBag.SetValueWithFixup(InternalSchema.DisplayTypeExInternal, (int)recipientDisplayType);
            propertyBag.SetValueWithFixup(InternalSchema.DisplayType, (int)DisplayTypeExProperty.GetLegacyRecipientDisplayType(recipientDisplayType));
        }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            Participant.Builder builder = new Participant.Builder();
            bool flag = base.Get(propertyBag, builder);

            if (this.emailAddressForDisplayPropDef != null)
            {
                string valueOrDefault = propertyBag.GetValueOrDefault <string>(this.emailAddressForDisplayPropDef);
                if (!string.IsNullOrEmpty(valueOrDefault))
                {
                    builder[ParticipantSchema.EmailAddressForDisplay] = valueOrDefault;
                    if (Participant.RoutingTypeEquals(builder.RoutingType, "EX") && PropertyError.IsPropertyNotFound(builder.TryGetProperty(ParticipantSchema.SmtpAddress)) && SmtpAddress.IsValidSmtpAddress(valueOrDefault))
                    {
                        builder[ParticipantSchema.SmtpAddress] = valueOrDefault;
                    }
                }
            }
            if (!flag && PropertyError.IsPropertyNotFound(builder.TryGetProperty(ParticipantSchema.EmailAddressForDisplay)))
            {
                return(new PropertyError(this, PropertyErrorCode.NotFound));
            }
            byte[] valueOrDefault2 = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.EntryId);
            if (valueOrDefault2 != null)
            {
                builder.Origin = new StoreParticipantOrigin(StoreObjectId.FromProviderSpecificId(valueOrDefault2), this.emailAddressIndex);
            }
            return(builder.ToParticipant());
        }
Пример #18
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            int num = propertyBag.GetValueOrDefault <int>(InternalSchema.OutlookPhishingStamp);

            if (num <= 0)
            {
                byte[] array = LinkEnabled.GetMovingStamp(propertyBag.Context.Session);
                if (array.Length != 4)
                {
                    array = new byte[]
                    {
                        1,
                        2,
                        3,
                        4
                    };
                }
                num = BitConverter.ToInt32(array, 0);
            }
            if ((bool)value)
            {
                num |= 268435456;
            }
            else
            {
                num &= -268435457;
            }
            propertyBag.SetValueWithFixup(InternalSchema.OutlookPhishingStamp, num);
        }
Пример #19
0
        internal static StoreObjectType GetFolderType(PropertyBag.BasicPropertyStore propertyBag)
        {
            int?            num             = propertyBag.GetValue(InternalSchema.MapiFolderType) as int?;
            FolderType?     folderType      = (num != null) ? new FolderType?((FolderType)num.GetValueOrDefault()) : null;
            StoreObjectType storeObjectType = ObjectClass.GetObjectType(propertyBag.GetValue(InternalSchema.ContainerClass) as string);
            bool?           flag            = propertyBag.GetValue(InternalSchema.IsOutlookSearchFolder) as bool?;

            if (storeObjectType == StoreObjectType.TasksFolder && folderType == FolderType.Search)
            {
                storeObjectType = StoreObjectType.SearchFolder;
            }
            else if (!Folder.IsFolderType(storeObjectType) || storeObjectType == StoreObjectType.Folder)
            {
                if (folderType == FolderType.Search)
                {
                    if (flag == true)
                    {
                        storeObjectType = StoreObjectType.OutlookSearchFolder;
                    }
                    else
                    {
                        storeObjectType = StoreObjectType.SearchFolder;
                    }
                }
                else
                {
                    storeObjectType = StoreObjectType.Folder;
                }
            }
            return(storeObjectType);
        }
Пример #20
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            object value = propertyBag.GetValue(InternalSchema.ConversationIndex);

            byte[] array = value as byte[];
            if (array == null)
            {
                PropertyError propertyError = (PropertyError)value;
                if (propertyError.PropertyErrorCode == PropertyErrorCode.NotEnoughMemory)
                {
                    return(new PropertyError(this, PropertyErrorCode.CorruptedData));
                }
                return(new PropertyError(this, propertyError.PropertyErrorCode));
            }
            else
            {
                if (array.Length < 22)
                {
                    return(new PropertyError(this, PropertyErrorCode.CorruptedData));
                }
                byte[] array2 = new byte[16];
                Array.Copy(array, 6, array2, 0, 16);
                object result;
                try
                {
                    result = PersonId.Create(array2);
                }
                catch (CorruptDataException)
                {
                    result = new PropertyError(this, PropertyErrorCode.CorruptedData);
                }
                return(result);
            }
        }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            bool flagValue  = AutoResponseFlagProperty.GetFlagValue(propertyBag, InternalSchema.Flags, (int)this.nativeFlag);
            bool flagValue2 = AutoResponseFlagProperty.GetFlagValue(propertyBag, InternalSchema.AutoResponseSuppressInternal, (int)this.suppressMask);

            return(flagValue && !flagValue2);
        }
Пример #22
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            if (!(value is bool))
            {
                string message = ServerStrings.ExInvalidValueForFlagsCalculatedProperty(this.flag);
                ExTraceGlobals.StorageTracer.TraceError((long)this.GetHashCode(), message);
                throw new ArgumentException(message);
            }
            object        value2        = propertyBag.GetValue(this.nativeProperty);
            PropertyError propertyError = value2 as PropertyError;
            int           num;

            if (propertyError == null)
            {
                num = (int)value2;
            }
            else
            {
                if (propertyError.PropertyErrorCode != PropertyErrorCode.NotFound)
                {
                    throw PropertyError.ToException(new PropertyError[]
                    {
                        propertyError
                    });
                }
                num = 0;
            }
            if ((bool)value)
            {
                propertyBag.SetValueWithFixup(this.nativeProperty, num | this.flag);
                return;
            }
            propertyBag.SetValueWithFixup(this.nativeProperty, num & ~this.flag);
        }
Пример #23
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            object obj = ExtendedFolderFlagsProperty.DecodeFolderFlags(propertyBag.GetValue(InternalSchema.ExtendedFolderFlagsInternal));

            ExtendedFolderFlagsProperty.ParsedFlags parsedFlags = obj as ExtendedFolderFlagsProperty.ParsedFlags;
            return(parsedFlags != null && parsedFlags.ContainsKey(ExtendedFolderFlagsProperty.FlagTag.Clsid));
        }
Пример #24
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            Sensitivity sensitivity = (Sensitivity)value;

            propertyBag.SetValueWithFixup(InternalSchema.MapiSensitivity, (int)value);
            propertyBag.SetValueWithFixup(InternalSchema.Privacy, sensitivity == Sensitivity.Private);
        }
Пример #25
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            object value2 = propertyBag.GetValue(InternalSchema.MeetingRequestWasSent);

            if (value2 is bool && (bool)value2 && !(bool)value)
            {
                throw new InvalidOperationException(ServerStrings.ExCannotRevertSentMeetingToAppointment);
            }
            int    num    = 0;
            object value3 = propertyBag.GetValue(InternalSchema.AppointmentStateInternal);

            if (value3 is int)
            {
                num = (int)value3;
            }
            if ((bool)value)
            {
                num |= 1;
            }
            else
            {
                num &= -2;
            }
            propertyBag.SetValueWithFixup(InternalSchema.AppointmentStateInternal, num);
        }
Пример #26
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("FlagStatusProperty");
            }
            EnumValidator.ThrowIfInvalid <FlagStatus>((FlagStatus)value);
            switch ((FlagStatus)value)
            {
            case FlagStatus.NotFlagged:
                FlagStatusProperty.ClearFlagStatus(propertyBag);
                return;

            case FlagStatus.Complete:
                FlagStatusProperty.CompleteFlagStatus(propertyBag);
                return;

            case FlagStatus.Flagged:
                FlagStatusProperty.SetFlagStatus(propertyBag);
                return;

            default:
                return;
            }
        }
        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));
        }
Пример #28
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            Participant        participant        = (Participant)value;
            ParticipantEntryId participantEntryId = ParticipantEntryId.FromParticipant(participant, this.entryIdConsumer);

            propertyBag.Update(this.displayNamePropDef, participant.DisplayName);
            propertyBag.Update(this.emailAddressPropDef, participant.EmailAddress);
            propertyBag.Update(this.routingTypePropDef, participant.RoutingType);
            propertyBag.Update(this.entryIdPropDef, (participantEntryId != null) ? participantEntryId.ToByteArray() : null);
            if (this.smtpAddressPropDef != null)
            {
                propertyBag.Update(this.smtpAddressPropDef, participant.TryGetProperty(ParticipantSchema.SmtpAddress));
            }
            if (this.sipUriPropDef != null)
            {
                propertyBag.Update(this.sipUriPropDef, participant.TryGetProperty(ParticipantSchema.SipUri));
            }
            if (this.sidPropDef != null)
            {
                propertyBag.Update(this.sidPropDef, participant.TryGetProperty(ParticipantSchema.ParticipantSID));
            }
            if (this.guidPropDef != null)
            {
                propertyBag.Update(this.guidPropDef, participant.TryGetProperty(ParticipantSchema.ParticipantGuid));
            }
        }
        protected sealed override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            ConversationId conversationId = value as ConversationId;

            if (conversationId == null)
            {
                throw new ArgumentException("value", "Must be a non-null ConversationId instance");
            }
            ConversationIndex conversationIndex;

            if (!ConversationIndex.TryCreate(propertyBag.GetValueOrDefault <byte[]>(InternalSchema.ConversationIndex), out conversationIndex))
            {
                conversationIndex = ConversationIndex.Create(conversationId);
            }
            else
            {
                conversationIndex = conversationIndex.UpdateGuid(new Guid(conversationId.GetBytes()));
            }
            byte[] array          = conversationIndex.ToByteArray();
            string valueOrDefault = propertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass);

            if (valueOrDefault != null && ObjectClass.IsOfClass(valueOrDefault, "IPM.ConversationAction"))
            {
                array[0] = 1;
                array[1] = (array[2] = (array[3] = (array[4] = (array[5] = 0))));
            }
            propertyBag.SetValueWithFixup(InternalSchema.ConversationIndex, array);
        }
Пример #30
0
        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)));
        }