예제 #1
0
        public int CompareTo(MeetingData other)
        {
            if (other == null)
            {
                return(1);
            }
            if (this.Id == other.Id)
            {
                return(0);
            }
            if (this.Exception != null || other.Exception != null)
            {
                return(((other.Exception != null) ? 1 : 0) - ((this.Exception != null) ? 1 : 0));
            }
            int num;

            if (GlobalObjectId.CompareCleanGlobalObjectIds(this.GlobalObjectId.CleanGlobalObjectIdBytes, other.GlobalObjectId.CleanGlobalObjectIdBytes))
            {
                num = Nullable.Compare <int>(new int?(this.SequenceNumber), new int?(other.SequenceNumber));
                if (num != 0)
                {
                    return(num);
                }
                num = this.LastModifiedTime.CompareTo(other.LastModifiedTime, MeetingData.LastModifiedTimeTreshold);
                if (num != 0)
                {
                    return(num);
                }
                num = this.OwnerCriticalChangeTime.CompareTo(other.OwnerCriticalChangeTime);
                if (num != 0)
                {
                    return(num);
                }
                num = this.DocumentId.CompareTo(other.DocumentId);
                if (num != 0)
                {
                    return(num);
                }
                if (this.ItemVersion != null && other.ItemVersion != null)
                {
                    num = Nullable.Compare <int>(this.ItemVersion, other.ItemVersion);
                    if (num != 0)
                    {
                        return(num);
                    }
                }
            }
            else
            {
                ExDateTime startTime  = this.StartTime;
                ExDateTime startTime2 = other.StartTime;
                num = ExDateTime.Compare(this.StartTime, other.StartTime);
            }
            return(num);
        }
예제 #2
0
        private static bool FixupMeetingMessage(IXSOFactory xsoFactory, IMailboxSession session, AggregationByItemClassReferencesSubjectProcessor.PropertyDefinitionListConstructorDelegate propertyDefinitionListConstructorDelegate, ICorePropertyBag corePropertyBag, ref ConversationIndex newIndex, ref ConversationIndex.FixupStage stage, out IStorePropertyBag parentItemPropertyBag)
        {
            corePropertyBag.Load(propertyDefinitionListConstructorDelegate(new PropertyDefinition[]
            {
                CalendarItemBaseSchema.GlobalObjectId,
                CalendarItemBaseSchema.CleanGlobalObjectId,
                CalendarItemBaseSchema.OwnerCriticalChangeTime,
                InternalSchema.AppointmentSequenceNumber
            }));
            byte[] array = corePropertyBag.TryGetProperty(CalendarItemBaseSchema.GlobalObjectId) as byte[];
            if (array == null)
            {
                parentItemPropertyBag = null;
                return(false);
            }
            GlobalObjectId globalObjectId;
            GlobalObjectId globalObjectId3;

            try
            {
                globalObjectId  = new GlobalObjectId(array);
                globalObjectId3 = new GlobalObjectId(array);
            }
            catch (CorruptDataException)
            {
                parentItemPropertyBag = null;
                return(false);
            }
            globalObjectId3.Date = ExDateTime.MinValue;
            string     valueOrDefault          = corePropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty);
            bool       isRequest               = ObjectClass.IsMeetingRequest(valueOrDefault);
            object     fixupStage              = null;
            ExDateTime ownerCriticalChangeTime = corePropertyBag.GetValueOrDefault <ExDateTime>(CalendarItemBaseSchema.OwnerCriticalChangeTime, ExDateTime.MaxValue);
            int        sequenceNumber          = corePropertyBag.GetValueOrDefault <int>(InternalSchema.AppointmentSequenceNumber, -1);

            if (sequenceNumber == -1)
            {
                parentItemPropertyBag = null;
                return(false);
            }
            parentItemPropertyBag = xsoFactory.RunQueryOnAllItemsFolder <IStorePropertyBag>(session, AllItemsFolderHelper.SupportedSortBy.CleanGlobalObjectId, globalObjectId3.Bytes, null, delegate(QueryResult queryResult)
            {
                IStorePropertyBag result = null;
                bool flag2 = false;
                while (!flag2)
                {
                    IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(50);
                    flag2 = (propertyBags.Length == 0);
                    IStorePropertyBag[] array2 = propertyBags;
                    int i = 0;
                    while (i < array2.Length)
                    {
                        IStorePropertyBag storePropertyBag = array2[i];
                        VersionedId versionedId            = (VersionedId)storePropertyBag.TryGetProperty(ItemSchema.Id);
                        byte[] array3 = (storePropertyBag.TryGetProperty(CalendarItemBaseSchema.GlobalObjectId) as byte[]) ?? (storePropertyBag.TryGetProperty(CalendarItemBaseSchema.CleanGlobalObjectId) as byte[]);
                        if (array3 != null && GlobalObjectId.CompareCleanGlobalObjectIds(array3, globalObjectId.Bytes))
                        {
                            GlobalObjectId globalObjectId2 = new GlobalObjectId(array3);
                            if (versionedId.ObjectId.ObjectType == StoreObjectType.MeetingRequest)
                            {
                                ConversationId conversationId = storePropertyBag.TryGetProperty(ConversationItemSchema.ConversationId) as ConversationId;
                                if (conversationId != null)
                                {
                                    if (isRequest)
                                    {
                                        fixupStage = ConversationIndex.FixupStage.M1;
                                        return(storePropertyBag);
                                    }
                                    if (AggregationByItemClassReferencesSubjectProcessor.IsMatchForMeetingResponse(globalObjectId, ownerCriticalChangeTime, sequenceNumber, storePropertyBag))
                                    {
                                        if (globalObjectId.Date != ExDateTime.MinValue && globalObjectId.Date == globalObjectId2.Date)
                                        {
                                            fixupStage = ConversationIndex.FixupStage.M3;
                                            return(storePropertyBag);
                                        }
                                        if (globalObjectId.Date == ExDateTime.MinValue)
                                        {
                                            fixupStage = ConversationIndex.FixupStage.M2;
                                            return(storePropertyBag);
                                        }
                                        fixupStage = ConversationIndex.FixupStage.M4;
                                        result     = storePropertyBag;
                                    }
                                }
                            }
                            i++;
                            continue;
                        }
                        return(result);
                    }
                }
                return(result);
            }, propertyDefinitionListConstructorDelegate(new PropertyDefinition[]
            {
                CalendarItemBaseSchema.GlobalObjectId,
                CalendarItemBaseSchema.CleanGlobalObjectId,
                InternalSchema.AppointmentSequenceNumber,
                CalendarItemBaseSchema.OwnerCriticalChangeTime,
                ConversationItemSchema.ConversationId
            }));
            if (parentItemPropertyBag == null)
            {
                return(false);
            }
            ConversationIndex conversationIndex;

            if (!ConversationIndex.TryCreate(parentItemPropertyBag.TryGetProperty(ItemSchema.ConversationIndex) as byte[], out conversationIndex))
            {
                return(false);
            }
            bool?flag = parentItemPropertyBag.TryGetProperty(ItemSchema.ConversationIndexTracking) as bool?;

            stage = ((flag == null || !flag.Value) ? ConversationIndex.FixupStage.L1 : ((ConversationIndex.FixupStage)fixupStage));
            if (isRequest)
            {
                byte[]            valueOrDefault2 = corePropertyBag.GetValueOrDefault <byte[]>(ItemSchema.ConversationIndex);
                ConversationIndex conversationIndex2;
                if (valueOrDefault2 != null && ConversationIndex.TryCreate(valueOrDefault2, out conversationIndex2))
                {
                    newIndex = conversationIndex.UpdateHeader(conversationIndex2.Components[0]);
                }
                else
                {
                    newIndex = ConversationIndex.Create(conversationIndex.Guid);
                }
            }
            else
            {
                newIndex = ConversationIndex.CreateFromParent(conversationIndex.Bytes);
            }
            return(true);
        }