コード例 #1
0
 public void MoveNext()
 {
     this.CheckDisposed("MoveNext");
     for (;;)
     {
         this.currentRow++;
         if (this.rows == null || this.currentRow >= this.rows.Length)
         {
             this.currentRow = 0;
             this.rows       = this.query.GetPropertyBags(this.chunkSize);
             if (this.rows.Length == 0)
             {
                 break;
             }
             this.chunkSize = Math.Min(this.chunkSize * 2, 1000);
         }
         IStorePropertyBag storePropertyBag = this.Current;
         object            obj = storePropertyBag.TryGetProperty(StoreObjectSchema.ItemClass);
         if (storePropertyBag != null && !(storePropertyBag.TryGetProperty(ItemSchema.Id) is PropertyError) && !(obj is PropertyError) && (ObjectClass.IsContact((string)obj) || ObjectClass.IsDistributionList((string)obj)))
         {
             return;
         }
         AllContactsCursor.Tracer.TraceDebug(0L, "AllContactsCursor.MoveNext: Skipping bogus contact");
     }
     this.rows = null;
 }
コード例 #2
0
            public override bool IsSelectable(IStorePropertyBag source)
            {
                Util.ThrowOnNullArgument(source, "source");
                string valueOrDefault = source.GetValueOrDefault <string>(ContactBaseSchema.DisplayNameFirstLast, null);

                return(!string.IsNullOrWhiteSpace(valueOrDefault));
            }
コード例 #3
0
        private PostalAddress GetFromAllPropertiesForConversationViewInternal(IStorePropertyBag propertyBag)
        {
            PostalAddress postalAddress = new PostalAddress
            {
                Street         = propertyBag.GetValueOrDefault <string>(this.Street, null),
                City           = propertyBag.GetValueOrDefault <string>(this.City, null),
                State          = propertyBag.GetValueOrDefault <string>(this.State, null),
                Country        = propertyBag.GetValueOrDefault <string>(this.Country, null),
                PostalCode     = propertyBag.GetValueOrDefault <string>(this.PostalCode, null),
                Latitude       = propertyBag.GetValueOrDefault <double?>(this.Latitude, null),
                Longitude      = propertyBag.GetValueOrDefault <double?>(this.Longitude, null),
                LocationSource = propertyBag.GetValueOrDefault <LocationSource>(this.LocationSource, Microsoft.Exchange.Data.Storage.LocationSource.None),
                LocationUri    = propertyBag.GetValueOrDefault <string>(this.LocationUri, null),
                Type           = this.PostalAddressType
            };

            if (!postalAddress.IsEmpty() && postalAddress.LocationSource == Microsoft.Exchange.Data.Storage.LocationSource.None)
            {
                postalAddress.LocationSource = Microsoft.Exchange.Data.Storage.LocationSource.Contact;
                foreach (NativeStorePropertyDefinition propertyDefinition in PostalAddressProperties.AdditionalProperties)
                {
                    string valueOrDefault = propertyBag.GetValueOrDefault <string>(propertyDefinition, null);
                    if (valueOrDefault != null)
                    {
                        postalAddress.LocationUri = valueOrDefault;
                        break;
                    }
                }
            }
            return(postalAddress);
        }
        private static IStorePropertyBag CloneToWritablePropertyBag(IStorePropertyBag propertyBag, ICollection <PropertyDefinition> loadedProperties)
        {
            MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag();

            memoryPropertyBag.LoadFromStorePropertyBag(propertyBag, loadedProperties);
            return(memoryPropertyBag.AsIStorePropertyBag());
        }
コード例 #5
0
 public void AddToAggregation(IStorePropertyBag propertyBag)
 {
     if (object.Equals(this.compareValue, propertyBag.TryGetProperty(this.propertyDefinition)))
     {
         this.result++;
     }
 }
コード例 #6
0
            public override bool IsSelectable(IStorePropertyBag source)
            {
                Util.ThrowOnNullArgument(source, "source");
                object value = this.GetValue(source);

                return(value != null && !(value is PropertyError));
            }
        // Token: 0x060014A1 RID: 5281 RVA: 0x000491C4 File Offset: 0x000473C4
        public int DetermineSortGroupPriority(IStorePropertyBag folder)
        {
            StoreObjectId objectId        = ((VersionedId)folder.TryGetProperty(FolderSchema.Id)).ObjectId;
            int           valueOrDefault  = folder.GetValueOrDefault <int>(FolderSchema.PeopleHubSortGroupPriorityVersion, -1);
            int           num             = folder.GetValueOrDefault <int>(FolderSchema.PeopleHubSortGroupPriority, -1);
            bool          valueOrDefault2 = folder.GetValueOrDefault <bool>(FolderSchema.IsPeopleConnectSyncFolder, false);

            if (valueOrDefault == 2 && num >= 0)
            {
                return(num);
            }
            if (object.Equals(objectId, this.DefaultContactsFolderId))
            {
                num = 2;
            }
            else if (object.Equals(objectId, this.QuickContactsFolderId))
            {
                num = 4;
            }
            else if (valueOrDefault2)
            {
                num = 3;
            }
            else
            {
                num = 10;
            }
            using (IFolder folder2 = this.xsoFactory.BindToFolder(this.session, objectId))
            {
                PeopleFilterGroupPriorityManager.SetSortGroupPriorityOnFolder(folder2, num);
                folder2.Save();
            }
            return(num);
        }
コード例 #8
0
 public void SetTo(IStorePropertyBag propertyBag, EmailAddress emailAddress)
 {
     EmailAddressProperties.SetOrDeleteValue(propertyBag, this.RoutingType, emailAddress.RoutingType);
     EmailAddressProperties.SetOrDeleteValue(propertyBag, this.Address, emailAddress.Address);
     EmailAddressProperties.SetOrDeleteValue(propertyBag, this.DisplayName, emailAddress.Name);
     EmailAddressProperties.SetOrDeleteValue(propertyBag, this.OriginalDisplayName, emailAddress.OriginalDisplayName);
 }
コード例 #9
0
            public override void Convert(ADRawEntry adObject, IStorePropertyBag contact)
            {
                Util.ThrowOnNullArgument(adObject, "adObject");
                Util.ThrowOnNullArgument(contact, "contact");
                object obj;

                if (adObject.TryGetValueWithoutDefault(ADRecipientSchema.GeoCoordinates, out obj))
                {
                    GeoCoordinates geoCoordinates = (GeoCoordinates)obj;
                    contact[ContactSchema.HomeLatitude]       = geoCoordinates.Latitude;
                    contact[ContactSchema.HomeLongitude]      = geoCoordinates.Longitude;
                    contact[ContactSchema.HomeLocationSource] = LocationSource.Contact;
                    if (geoCoordinates.Altitude != null)
                    {
                        contact[ContactSchema.HomeAltitude] = geoCoordinates.Altitude;
                    }
                    else
                    {
                        ADPersonToContactConverter.Tracer.TraceDebug(0L, "Deleting contact HomeAltitude property it is not found on AD GeoCoordinates property.");
                        contact.Delete(ContactSchema.HomeAltitude);
                    }
                    ADPersonToContactConverter.GeoCoordinatesConverter.locationUriConverter.Convert(adObject, contact);
                    return;
                }
                ADPersonToContactConverter.Tracer.TraceDebug(0L, "Deleting contact location properties since AD GeoCoordinates property not found.");
                contact.Delete(ContactSchema.HomeLatitude);
                contact.Delete(ContactSchema.HomeLongitude);
                contact.Delete(ContactSchema.HomeLocationSource);
                contact.Delete(ContactSchema.HomeAltitude);
                ADPersonToContactConverter.GeoCoordinatesConverter.locationUriConverter.Convert(adObject, contact);
            }
コード例 #10
0
        public void LoadMailboxMessage(string internetMessageId)
        {
            MailboxSession session = (MailboxSession)this.storeSession;

            try
            {
                this.context.BeginTrackLatency(LatencyComponent.StoreDriverDeliveryRpc);
                IEnumerable <IStorePropertyBag> source = AllItemsFolderHelper.FindItemsFromInternetId(session, internetMessageId, ItemQueryType.NoNotifications, new PropertyDefinition[]
                {
                    ItemSchema.Id
                });
                if (source.Count <IStorePropertyBag>() != 1)
                {
                    throw new UnexpectedMessageCountException(string.Format("The number of messages found was unexpected. Count: {0}", source.Count <IStorePropertyBag>()));
                }
                IStorePropertyBag storePropertyBag = source.First <IStorePropertyBag>();
                StoreObjectId     objectId         = ((VersionedId)storePropertyBag[ItemSchema.Id]).ObjectId;
                this.messageItem = MessageItem.Bind(session, objectId);
                if (this.messageItem == null)
                {
                    throw new System.Data.ObjectNotFoundException("The requested message was not loaded.");
                }
                this.messageItem.OpenAsReadWrite();
            }
            catch (Microsoft.Exchange.Data.Storage.ObjectNotFoundException innerException)
            {
                throw new System.Data.ObjectNotFoundException("The requested message was not loaded.", innerException);
            }
            finally
            {
                TimeSpan additionalLatency = this.context.EndTrackLatency(LatencyComponent.StoreDriverDeliveryRpc);
                this.context.AddRpcLatency(additionalLatency, "Load message");
            }
        }
コード例 #11
0
        private LoadedItemPart CreateLoadedItemPart(IItem item, IStorePropertyBag propertyBagFromTree, HtmlStreamOptionCallback htmlCallback, PropertyDefinition[] additionalPropertyDefinitions, ItemPartIrmInfo itemPartIrmInfo, bool isIrmEnabled, long bytesLoadedForConversation, bool isSmimeSupported, string domainName)
        {
            ConversationBodyScanner bodyScanner = null;
            long bytesLoaded = 0L;

            PropertyDefinition[] loadedProperties = InternalSchema.Combine <PropertyDefinition>(this.queriedPropertyDefinitions, additionalPropertyDefinitions).ToArray <PropertyDefinition>();
            IStorePropertyBag    propertyBag      = this.CalculatePropertyBag(propertyBagFromTree, item, additionalPropertyDefinitions);
            BodyFragmentInfo     bodyFragmentInfo = null;
            bool didLoadSucceed = false;

            if (this.TryLoadBodyScanner(item, htmlCallback, bytesLoadedForConversation, isIrmEnabled, out bodyScanner, out bytesLoaded))
            {
                bodyFragmentInfo = new BodyFragmentInfo(bodyScanner);
                didLoadSucceed   = true;
            }
            AttachmentCollection attachmentCollection = item.AttachmentCollection;

            if (isIrmEnabled)
            {
                this.InitializeIrmInfo(item, itemPartIrmInfo, out attachmentCollection);
            }
            string itemClass = item.TryGetProperty(StoreObjectSchema.ItemClass) as string;

            if (isSmimeSupported && ObjectClass.IsSmimeClearSigned(itemClass))
            {
                this.InitializeSmimeInfo(item, domainName, out attachmentCollection);
            }
            return(new LoadedItemPart(item, propertyBag, bodyFragmentInfo, loadedProperties, itemPartIrmInfo, didLoadSucceed, bytesLoaded, attachmentCollection));
        }
コード例 #12
0
 public bool ShouldAggregate(ICorePropertyBag message, IStorePropertyBag parentMessage, ConversationIndex.FixupStage previousStage)
 {
     if (AudienceBasedConversationAggregator.IsMessageCreatingNewConversation(parentMessage, previousStage))
     {
         return(false);
     }
     if (!AudienceBasedConversationAggregator.SupportsSideConversation(parentMessage))
     {
         return(false);
     }
     if (!this.IsSupportedItem(message) || !this.IsSupportedItem(parentMessage))
     {
         return(false);
     }
     if (previousStage <= ConversationIndex.FixupStage.H13)
     {
         if (previousStage != ConversationIndex.FixupStage.Unknown && previousStage != ConversationIndex.FixupStage.H13)
         {
             return(true);
         }
     }
     else if (previousStage != ConversationIndex.FixupStage.Error && previousStage != ConversationIndex.FixupStage.S1 && previousStage != ConversationIndex.FixupStage.S2)
     {
         return(true);
     }
     return(false);
 }
コード例 #13
0
        private static void AddGroupToList(IStorePropertyBag row, Dictionary <Guid, CalendarGroupInfo> guidToGroupMapping, CalendarGroupInfoList calendarGroups)
        {
            CalendarGroupInfo calendarGroupInfoFromRow = CalendarGroup.GetCalendarGroupInfoFromRow(row);

            if (calendarGroupInfoFromRow == null)
            {
                return;
            }
            CalendarGroupInfo calendarGroupInfo;

            if (guidToGroupMapping.TryGetValue(calendarGroupInfoFromRow.GroupClassId, out calendarGroupInfo))
            {
                if (calendarGroupInfo.LastModifiedTime.CompareTo(calendarGroupInfoFromRow.LastModifiedTime) > 0)
                {
                    calendarGroups.DuplicateNodes.Add(calendarGroupInfoFromRow);
                    return;
                }
                guidToGroupMapping[calendarGroupInfoFromRow.GroupClassId] = calendarGroupInfoFromRow;
                calendarGroups.DuplicateNodes.Add(calendarGroupInfo);
                calendarGroups.Remove(calendarGroupInfo);
                if (calendarGroups.DefaultGroups.ContainsKey(calendarGroupInfoFromRow.GroupType))
                {
                    calendarGroups.DefaultGroups[calendarGroupInfoFromRow.GroupType] = calendarGroupInfoFromRow;
                }
            }
            else
            {
                guidToGroupMapping.Add(calendarGroupInfoFromRow.GroupClassId, calendarGroupInfoFromRow);
                if (calendarGroupInfoFromRow.GroupType != CalendarGroupType.Normal)
                {
                    calendarGroups.DefaultGroups.Add(calendarGroupInfoFromRow.GroupType, calendarGroupInfoFromRow);
                }
            }
            calendarGroups.Add(calendarGroupInfoFromRow);
        }
コード例 #14
0
        private static MemoryPropertyBag SaveLocationContainer(IStorePropertyBag storeObject, StorePropertyDefinition[] properties)
        {
            MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag();

            memoryPropertyBag.PreLoadStoreProperty <StorePropertyDefinition>(properties, storeObject.GetProperties(properties));
            return(memoryPropertyBag);
        }
コード例 #15
0
        private IStorePropertyBag ClearStaleItems(IStoreSession session, IEnumerable <IStorePropertyBag> propertyBagsFound)
        {
            IStorePropertyBag storePropertyBag = null;
            ExDateTime        exDateTime       = ExDateTime.MinValue;

            foreach (IStorePropertyBag storePropertyBag2 in propertyBagsFound)
            {
                ExDateTime valueOrDefault = storePropertyBag2.GetValueOrDefault <ExDateTime>(StoreObjectSchema.LastModifiedTime, ExDateTime.MinValue);
                this.Tracer.TraceDebug <ExDateTime, ExDateTime>((long)this.GetHashCode(), "SingleInstanceItemHandler<T>:ClearStaleItems - Most recent modified time = {0}. Current item modified time = {1}", exDateTime, valueOrDefault);
                if (valueOrDefault >= exDateTime)
                {
                    if (storePropertyBag != null)
                    {
                        this.RemoveStaleItem(session, storePropertyBag);
                    }
                    exDateTime       = valueOrDefault;
                    storePropertyBag = storePropertyBag2;
                }
                else
                {
                    this.RemoveStaleItem(session, storePropertyBag2);
                }
            }
            return(storePropertyBag);
        }
コード例 #16
0
        internal static TaskGroupEntryInfo GetTaskGroupEntryInfoFromRow(IStorePropertyBag row)
        {
            VersionedId versionedId = (VersionedId)row.TryGetProperty(ItemSchema.Id);

            byte[] valueOrDefault  = row.GetValueOrDefault <byte[]>(TaskGroupEntrySchema.NodeEntryId, null);
            byte[] valueOrDefault2 = row.GetValueOrDefault <byte[]>(FolderTreeDataSchema.ParentGroupClassId, null);
            string valueOrDefault3 = row.GetValueOrDefault <string>(ItemSchema.Subject, string.Empty);

            byte[] valueOrDefault4 = row.GetValueOrDefault <byte[]>(FolderTreeDataSchema.Ordinal, null);
            row.GetValueOrDefault <byte[]>(TaskGroupEntrySchema.StoreEntryId, null);
            ExDateTime valueOrDefault5 = row.GetValueOrDefault <ExDateTime>(StoreObjectSchema.LastModifiedTime, ExDateTime.MinValue);

            row.GetValueOrDefault <FolderTreeDataType>(FolderTreeDataSchema.Type, FolderTreeDataType.NormalFolder);
            FolderTreeDataFlags valueOrDefault6 = row.GetValueOrDefault <FolderTreeDataFlags>(FolderTreeDataSchema.FolderTreeDataFlags, FolderTreeDataFlags.None);
            Guid safeGuidFromByteArray          = FolderTreeData.GetSafeGuidFromByteArray(valueOrDefault2);

            if (safeGuidFromByteArray.Equals(Guid.Empty))
            {
                ExTraceGlobals.StorageTracer.TraceDebug <int>(0L, "Found TaskGroupEntry with invalid parent group class id. ArrayLength: {0}", (valueOrDefault2 == null) ? -1 : valueOrDefault2.Length);
                return(null);
            }
            if (IdConverter.IsFolderId(valueOrDefault))
            {
                StoreObjectId storeObjectId = StoreObjectId.FromProviderSpecificId(valueOrDefault);
                if ((valueOrDefault6 & FolderTreeDataFlags.IsDefaultStore) == FolderTreeDataFlags.IsDefaultStore)
                {
                    return(new TaskGroupEntryInfo(valueOrDefault3, versionedId, storeObjectId, safeGuidFromByteArray, valueOrDefault4, valueOrDefault5));
                }
                ExTraceGlobals.StorageTracer.TraceDebug <StoreObjectType, string, VersionedId>(0L, "Found TaskGroupEntry of type {0} referencing a non-task folder. ObjectType: {0}. TaskFfolderName: {1}. Id: {2}.", storeObjectId.ObjectType, valueOrDefault3, versionedId);
            }
            return(null);
        }
コード例 #17
0
        private bool SetBodySummary(IConversationTree conversationTree, ref IStorePropertyBag propertyBag, object summary, StoreObjectId storeId)
        {
            bool result = false;
            QueryResultPropertyBag queryResultPropertyBag = new QueryResultPropertyBag(propertyBag, ConversationDataExtractor.BodyPropertiesCanBeExtracted, new object[]
            {
                summary,
                summary
            });

            propertyBag = queryResultPropertyBag.AsIStorePropertyBag();
            IConversationTreeNode conversationTreeNode = null;

            conversationTree.TryGetConversationTreeNode(storeId, out conversationTreeNode);
            foreach (StoreObjectId storeObjectId in conversationTreeNode.ToListStoreObjectId())
            {
                if (storeObjectId.Equals(storeId))
                {
                    LoadedItemPart loadedItemPart;
                    if (this.loadedItemParts.TryGetValue(storeObjectId, out loadedItemPart))
                    {
                        loadedItemPart.AddBodySummary(summary);
                        result = true;
                    }
                    conversationTreeNode.UpdatePropertyBag(storeObjectId, propertyBag);
                }
            }
            return(result);
        }
コード例 #18
0
        private static Event GetBasicSeriesEventDataWithClinetId(IStorePropertyBag propertyBag, IStorageEntitySetScope <IStoreSession> scope)
        {
            Event basicSeriesEventData = EventExtensions.GetBasicSeriesEventData(propertyBag, scope);

            basicSeriesEventData.ClientId = propertyBag.GetValueOrDefault <string>(CalendarItemBaseSchema.EventClientId, null);
            return(basicSeriesEventData);
        }
コード例 #19
0
        private string GenerateParticipantsHash(IStorePropertyBag propertyBag, out ParticipantSet participants)
        {
            participants = this.replyAllExtractor.RetrieveReplyAllParticipants(propertyBag);
            List <string> list = new List <string>(participants.Count);

            foreach (IParticipant participant in participants)
            {
                list.Add(participant.DisplayName.ToLower());
            }
            StringBuilder stringBuilder = new StringBuilder(list.Count * 255);

            list.Sort(StringComparer.InvariantCultureIgnoreCase);
            foreach (string value in list)
            {
                stringBuilder.Append(value);
                stringBuilder.Append(";");
            }
            string result;

            using (SHA256CryptoServiceProvider sha256CryptoServiceProvider = new SHA256CryptoServiceProvider())
            {
                result = Convert.ToBase64String(sha256CryptoServiceProvider.ComputeHash(Encoding.UTF8.GetBytes(stringBuilder.ToString())));
            }
            return(result);
        }
コード例 #20
0
        internal QueryResultPropertyBag(IStorePropertyBag storePropertyBag, ICollection <PropertyDefinition> propertyDefinitions, IList <object> propertyValues)
        {
            QueryResultPropertyBag queryResultPropertyBag = (QueryResultPropertyBag)((PropertyBag.StorePropertyBagAdaptor)storePropertyBag).PropertyBag;

            this.Context.Session = queryResultPropertyBag.Context.Session;
            this.timeZone        = queryResultPropertyBag.timeZone;
            List <object> list = new List <object>(queryResultPropertyBag.currentRowValues);

            this.propertyPositions = new Dictionary <StorePropertyDefinition, int>(queryResultPropertyBag.propertyPositions);
            int num = 0;

            foreach (PropertyDefinition propertyDefinition in propertyDefinitions)
            {
                StorePropertyDefinition key = propertyDefinition as StorePropertyDefinition;
                int index;
                if (!this.propertyPositions.TryGetValue(key, out index))
                {
                    this.propertyPositions.Add(key, list.Count);
                    list.Add(propertyValues[num]);
                }
                else
                {
                    list[index] = propertyValues[num];
                }
                num++;
            }
            this.currentRowValues = list.ToArray();
        }
コード例 #21
0
        internal IEnumerable <IStorePropertyBag> ConvertAdObjectsToIStorePropertyBags(IEnumerable <Result <ADRawEntry> > objectsToConvert)
        {
            ArgumentValidator.ThrowIfNull("adObjectsToConvert", objectsToConvert);
            List <IStorePropertyBag> list = new List <IStorePropertyBag>();

            foreach (Result <ADRawEntry> result in objectsToConvert)
            {
                if (result.Data == null)
                {
                    this.tracer.TraceDebug((long)this.GetHashCode(), "ADObjectToIStorePropertyConverter.ConvertAdObjectsToIStorePropertyBags: adRawEntry.Data is null, ignore and continue.");
                }
                else
                {
                    IStorePropertyBag storePropertyBag = this.ConvertADObjectToIStorePropertyBag(result.Data);
                    if (storePropertyBag != null)
                    {
                        list.Add(storePropertyBag);
                    }
                    else
                    {
                        this.tracer.TraceError <ADRawEntry>((long)this.GetHashCode(), "ADObjectToIStorePropertyConverter.ConvertAdObjectsToIStorePropertyBags: Conversion of AD Raw Entry object {0} resulted in null IStorePropertyBag", result.Data);
                    }
                }
            }
            return(list);
        }
コード例 #22
0
        public SyncStateMetadata GetMetadataFromPropertyBag(IStorePropertyBag propertyBag, string displayName, ISyncLogger syncLogger = null)
        {
            byte[] byteArray = null;
            if (!DeviceSyncStateMetadata.TryGetPropertyFromBag <byte[]>(propertyBag, InternalSchema.SyncFolderSourceKey, out byteArray, syncLogger))
            {
                syncLogger.TraceDebug <string>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "[DeviceSyncStateMetadata.GetMetadataFromPropertyBag] Creating custom sync state metadata for folder '{0}'", displayName);
                return(new SyncStateMetadata(this, displayName, null, null));
            }
            StoreObjectId storeObjectId = StoreObjectId.Deserialize(byteArray);

            syncLogger.TraceDebug <string, StoreObjectId>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "[DeviceSyncStateMetadata.GetMetadataFromPropertyBag] Found SyncFolderSourceKey for {0}, so it is a FolderSyncState: {1}", displayName, storeObjectId);
            long localCommitTimeMax  = 0L;
            int  deletedCountTotal   = 0;
            int  syncKey             = 0;
            int  airSyncFilter       = 0;
            bool conversationMode    = false;
            int  airSyncSettingsHash = 0;
            int  airSyncMaxItems     = 0;
            VariantConfigurationSnapshot snapshot = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null);
            bool flag = snapshot != null && snapshot.DataStorage.IgnoreInessentialMetaDataLoadErrors != null && snapshot.DataStorage.IgnoreInessentialMetaDataLoadErrors.Enabled;

            syncLogger.TraceDebug <bool>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "[DeviceSyncStateMetadata.GetMetadataFromPropertyBag] ignoreInessentialMetaDataLoadErrors: {0}", flag);
            long airSyncLastSyncTime;
            bool flag2 = DeviceSyncStateMetadata.TryGetPropertyFromBag <long>(propertyBag, AirSyncStateSchema.MetadataLastSyncTime, out airSyncLastSyncTime, syncLogger) && DeviceSyncStateMetadata.TryGetPropertyFromBag <long>(propertyBag, AirSyncStateSchema.MetadataLocalCommitTimeMax, out localCommitTimeMax, syncLogger) && DeviceSyncStateMetadata.TryGetPropertyFromBag <int>(propertyBag, AirSyncStateSchema.MetadataDeletedCountTotal, out deletedCountTotal, syncLogger) && DeviceSyncStateMetadata.TryGetPropertyFromBag <int>(propertyBag, AirSyncStateSchema.MetadataSyncKey, out syncKey, syncLogger) && DeviceSyncStateMetadata.TryGetPropertyFromBag <int>(propertyBag, AirSyncStateSchema.MetadataFilter, out airSyncFilter, syncLogger) && DeviceSyncStateMetadata.TryGetPropertyFromBag <bool>(propertyBag, AirSyncStateSchema.MetadataConversationMode, out conversationMode, syncLogger) && DeviceSyncStateMetadata.TryGetPropertyFromBag <int>(propertyBag, AirSyncStateSchema.MetadataSettingsHash, out airSyncSettingsHash, syncLogger);
            bool flag3 = flag2 && DeviceSyncStateMetadata.TryGetPropertyFromBag <int>(propertyBag, AirSyncStateSchema.MetadataMaxItems, out airSyncMaxItems, syncLogger);

            flag2 = (flag ? flag2 : flag3);
            if (flag2)
            {
                syncLogger.TraceDebug <string>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "[DeviceSyncStateMetadata.GetMetadataFromPropertyBag] Creating FolderSync metadata for folder '{0}'", displayName);
                return(new FolderSyncStateMetadata(this, displayName, null, null, localCommitTimeMax, deletedCountTotal, syncKey, conversationMode, airSyncFilter, airSyncLastSyncTime, airSyncSettingsHash, airSyncMaxItems, storeObjectId));
            }
            syncLogger.TraceDebug <string>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "[DeviceSyncStateMetadata.GetMetadataFromPropertyBag] Failed to get nullSync properties for sync folder '{0}'.", displayName);
            return(new FolderSyncStateMetadata(this, displayName, null, null, 0L, 0, 0, false, 0, 0L, 0, 0, storeObjectId));
        }
コード例 #23
0
 private SyncStateMetadata GetSyncStateItemMetadata(MailboxSession mailboxSession, Folder parentFolder, string displayName, ISyncLogger syncLogger = null)
 {
     if (syncLogger == null)
     {
         syncLogger = TracingLogger.Singleton;
     }
     using (QueryResult queryResult = parentFolder.ItemQuery(ItemQueryType.None, null, new SortBy[]
     {
         new SortBy(ItemSchema.Subject, SortOrder.Ascending)
     }, DeviceSyncStateMetadata.NullSyncPropertiesItems))
     {
         if (queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.Subject, displayName)))
         {
             IStorePropertyBag storePropertyBag = queryResult.GetPropertyBags(1)[0];
             StoreObjectId     objectId         = ((VersionedId)storePropertyBag.TryGetProperty(ItemSchema.Id)).ObjectId;
             syncLogger.TraceDebug <string, SmtpAddress, string>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "[DeviceSyncStateMetadata.GetSyncStateItemMetadata] Sync state '{0}' for mailbox '{1}' is stored on item id '{2}'", displayName, mailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress, objectId.ToBase64String());
             SyncStateMetadata metadataFromPropertyBag = this.GetMetadataFromPropertyBag(storePropertyBag, displayName, syncLogger);
             metadataFromPropertyBag.FolderSyncStateId = parentFolder.Id.ObjectId;
             metadataFromPropertyBag.ItemSyncStateId   = objectId;
             return(metadataFromPropertyBag);
         }
     }
     syncLogger.TraceDebug <string>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "[DeviceSyncStateMetadata.GetSyncStateItemMetadata] Did not find child item with name {0}", displayName);
     return(null);
 }
コード例 #24
0
 private void LoadChildNodesCollection(IStorePropertyBag[] rows, int startIndex)
 {
     for (int i = startIndex; i < rows.Length; i++)
     {
         IStorePropertyBag storePropertyBag = rows[i];
         if (TaskGroup.IsTaskSection(storePropertyBag) && TaskGroup.IsFolderTreeData(storePropertyBag) && TaskGroup.IsTaskGroupEntry(storePropertyBag))
         {
             byte[] valueOrDefault = storePropertyBag.GetValueOrDefault <byte[]>(FolderTreeDataSchema.ParentGroupClassId, null);
             if (valueOrDefault == null || valueOrDefault.Length != 16)
             {
                 ExTraceGlobals.StorageTracer.TraceDebug <int>(0L, "Found TaskGroupEntry with invalid parent group id. ArrayLength: {0}", (valueOrDefault == null) ? -1 : valueOrDefault.Length);
             }
             else
             {
                 Guid g = new Guid(valueOrDefault);
                 if (this.groupClassId.Equals(g))
                 {
                     TaskGroupEntryInfo taskGroupEntryInfoFromRow = TaskGroupEntry.GetTaskGroupEntryInfoFromRow(storePropertyBag);
                     if (taskGroupEntryInfoFromRow != null)
                     {
                         this.children.Add(taskGroupEntryInfoFromRow);
                     }
                 }
             }
         }
     }
     this.hasLoadedTaskFoldersCollection = true;
 }
コード例 #25
0
        public void AddToAggregation(IStorePropertyBag propertyBag)
        {
            object obj = propertyBag.TryGetProperty(this.propertyDefinition);

            if (obj is T)
            {
                T other = (T)((object)obj);
                if (!this.aggregatorInitialized)
                {
                    this.result = other;
                    this.aggregatorInitialized = true;
                    return;
                }
                int num = this.result.CompareTo(other);
                if (num > 0 && this.isMinCompare)
                {
                    this.result = other;
                    this.aggregatorInitialized = true;
                    return;
                }
                if (num < 0 && !this.isMinCompare)
                {
                    this.result = other;
                    this.aggregatorInitialized = true;
                }
            }
        }
コード例 #26
0
        private static void AddTaskFolderToList(IStorePropertyBag row, Dictionary <Guid, TaskGroupInfo> guidToGroupMapping, Dictionary <StoreObjectId, TaskGroupEntryInfo> taskFolderIdToGroupEntryMapping, TaskGroupInfoList taskGroups)
        {
            TaskGroupEntryInfo taskGroupEntryInfoFromRow = TaskGroupEntry.GetTaskGroupEntryInfoFromRow(row);

            if (taskGroupEntryInfoFromRow == null)
            {
                return;
            }
            TaskGroupInfo taskGroupInfo;

            if (!guidToGroupMapping.TryGetValue(taskGroupEntryInfoFromRow.ParentGroupClassId, out taskGroupInfo))
            {
                ExTraceGlobals.StorageTracer.TraceDebug <string, Guid, VersionedId>(0L, "Found a task group entry with an invalid parent id. TaskFolderName: {0}, ParentId: {1}, ItemId: {2}", taskGroupEntryInfoFromRow.FolderName, taskGroupEntryInfoFromRow.ParentGroupClassId, taskGroupEntryInfoFromRow.Id);
                return;
            }
            TaskGroupEntryInfo taskGroupEntryInfo;

            if (taskFolderIdToGroupEntryMapping.TryGetValue(taskGroupEntryInfoFromRow.TaskFolderId, out taskGroupEntryInfo))
            {
                if (taskGroupEntryInfo.LastModifiedTime.CompareTo(taskGroupEntryInfoFromRow.LastModifiedTime) > 0)
                {
                    taskGroups.DuplicateNodes.Add(taskGroupEntryInfoFromRow);
                    return;
                }
                taskGroups.DuplicateNodes.Add(taskGroupEntryInfo);
                guidToGroupMapping[taskGroupEntryInfo.ParentGroupClassId].TaskFolders.Remove(taskGroupEntryInfo);
                taskFolderIdToGroupEntryMapping[taskGroupEntryInfoFromRow.TaskFolderId] = taskGroupEntryInfoFromRow;
            }
            else
            {
                taskFolderIdToGroupEntryMapping.Add(taskGroupEntryInfoFromRow.TaskFolderId, taskGroupEntryInfoFromRow);
            }
            taskGroupInfo.TaskFolders.Add(taskGroupEntryInfoFromRow);
        }
コード例 #27
0
        private static void AddGroupToList(IStorePropertyBag row, Dictionary <Guid, TaskGroupInfo> guidToGroupMapping, TaskGroupInfoList taskGroups)
        {
            TaskGroupInfo taskGroupInfoFromRow = TaskGroup.GetTaskGroupInfoFromRow(row);

            if (taskGroupInfoFromRow == null)
            {
                return;
            }
            TaskGroupInfo taskGroupInfo;

            if (guidToGroupMapping.TryGetValue(taskGroupInfoFromRow.GroupClassId, out taskGroupInfo))
            {
                if (taskGroupInfo.LastModifiedTime.CompareTo(taskGroupInfoFromRow.LastModifiedTime) > 0)
                {
                    taskGroups.DuplicateNodes.Add(taskGroupInfoFromRow);
                    return;
                }
                guidToGroupMapping[taskGroupInfoFromRow.GroupClassId] = taskGroupInfoFromRow;
                taskGroups.DuplicateNodes.Add(taskGroupInfo);
                taskGroups.Remove(taskGroupInfo);
                if (taskGroups.DefaultGroups.ContainsKey(taskGroupInfoFromRow.GroupType))
                {
                    taskGroups.DefaultGroups[taskGroupInfoFromRow.GroupType] = taskGroupInfoFromRow;
                }
            }
            else
            {
                guidToGroupMapping.Add(taskGroupInfoFromRow.GroupClassId, taskGroupInfoFromRow);
                if (taskGroupInfoFromRow.GroupType != TaskGroupType.Normal)
                {
                    taskGroups.DefaultGroups.Add(taskGroupInfoFromRow.GroupType, taskGroupInfoFromRow);
                }
            }
            taskGroups.Add(taskGroupInfoFromRow);
        }
コード例 #28
0
        private StoreId GetMessageStoreId(string internetId, IMailboxSession session)
        {
            if (string.IsNullOrEmpty(internetId))
            {
                return(null);
            }
            IStorePropertyBag[] array = AllItemsFolderHelper.FindItemsFromInternetId((MailboxSession)session, internetId, new StorePropertyDefinition[]
            {
                CoreItemSchema.Id
            });
            if (array == null || array.Length == 0)
            {
                return(null);
            }
            IStorePropertyBag storePropertyBag = array[0];

            if (storePropertyBag == null)
            {
                return(null);
            }
            VersionedId valueOrDefault = storePropertyBag.GetValueOrDefault <VersionedId>(CoreItemSchema.Id, null);

            if (valueOrDefault == null)
            {
                return(null);
            }
            return(valueOrDefault.ObjectId);
        }
コード例 #29
0
 public void LogParentMessageData(IStorePropertyBag parentMessage)
 {
     if (parentMessage == null)
     {
         return;
     }
     this.LogEvent(new SchemaBasedLogEvent <ConversationAggregationLogSchema.ParentMessageData>
     {
         {
             ConversationAggregationLogSchema.ParentMessageData.ConversationFamilyId,
             parentMessage.TryGetProperty(ItemSchema.ConversationFamilyId)
         },
         {
             ConversationAggregationLogSchema.ParentMessageData.ConversationId,
             parentMessage.TryGetProperty(ItemSchema.ConversationId)
         },
         {
             ConversationAggregationLogSchema.ParentMessageData.InternetMessageId,
             parentMessage.TryGetProperty(ItemSchema.InternetMessageId)
         },
         {
             ConversationAggregationLogSchema.ParentMessageData.ItemClass,
             parentMessage.TryGetProperty(StoreObjectSchema.ItemClass)
         },
         {
             ConversationAggregationLogSchema.ParentMessageData.SupportsSideConversation,
             parentMessage.TryGetProperty(ItemSchema.SupportsSideConversation)
         }
     });
 }
コード例 #30
0
        public ItemPart GetItemPart(IConversationTree conversationTree, StoreObjectId itemId)
        {
            IStorePropertyBag     propertyBag          = null;
            ItemPart              itemPart             = null;
            IConversationTreeNode conversationTreeNode = null;

            if (!conversationTree.TryGetConversationTreeNode(itemId, out conversationTreeNode) || !conversationTreeNode.TryGetPropertyBag(itemId, out propertyBag))
            {
                throw new ArgumentException("No ConversationTreeNode/PropertyBag can be found for the passed StoreObjectId");
            }
            if (!this.itemParts.TryGetValue(itemId, out itemPart))
            {
                this.LoadItemPart(conversationTree, propertyBag);
                itemPart = this.loadedItemParts[itemId];
            }
            if (itemPart is LoadedItemPart && !itemPart.DidLoadSucceed)
            {
                return(itemPart);
            }
            if (itemPart.UniqueFragmentInfo == null)
            {
                LoadedItemPart loadedItemPart = (LoadedItemPart)itemPart;
                ExtractionData extractionData;
                if (!this.CanSkipDiffing(conversationTree, loadedItemPart, out extractionData))
                {
                    BodyFragmentInfo parentBodyFragment = null;
                    if (conversationTreeNode.ParentNode.HasData)
                    {
                        StoreObjectId mainStoreObjectId = conversationTreeNode.ParentNode.MainStoreObjectId;
                        if (this.treeNodeBodyFragment.ContainsKey(mainStoreObjectId))
                        {
                            parentBodyFragment = this.treeNodeBodyFragment[mainStoreObjectId].Key;
                        }
                        else
                        {
                            LoadedItemPart loadedItemPart2 = null;
                            if (!this.loadedItemParts.TryGetValue(mainStoreObjectId, out loadedItemPart2))
                            {
                                IStorePropertyBag propertyBag2;
                                if (!conversationTreeNode.ParentNode.TryGetPropertyBag(mainStoreObjectId, out propertyBag2))
                                {
                                    throw new ArgumentException("No Property bag can be found for the passed StoreObjectId on the ParentNode");
                                }
                                this.LoadItemPart(conversationTree, propertyBag2);
                                loadedItemPart2 = this.loadedItemParts[mainStoreObjectId];
                            }
                            parentBodyFragment = loadedItemPart2.BodyFragmentInfo;
                        }
                    }
                    ConversationDataExtractor.DiffItemParts(parentBodyFragment, loadedItemPart);
                }
                else
                {
                    itemPart.UniqueFragmentInfo     = extractionData.ChildUniqueBody;
                    itemPart.DisclaimerFragmentInfo = extractionData.ChildDisclaimer;
                }
            }
            return(itemPart);
        }