internal KeyValuePair <List <StoreObjectId>, List <StoreObjectId> > CalculateChanges(byte[] otherSerializedState) { Util.ThrowOnNullOrEmptyArgument(otherSerializedState, "otherSerializedState"); MiniStateTreeNode right = MiniStateTreeNode.DeSerialize(otherSerializedState); KeyValuePair <List <long>, List <long> > affectedIds = this.treeNode.GetAffectedIds(right); KeyValuePair <List <StoreObjectId>, List <StoreObjectId> > result = new KeyValuePair <List <StoreObjectId>, List <StoreObjectId> >(new List <StoreObjectId>(affectedIds.Key.Count), new List <StoreObjectId>(affectedIds.Value.Count)); for (int i = 0; i < affectedIds.Key.Count; i++) { result.Key.Add(this.hashToIdMap[affectedIds.Key[i]]); } for (int j = 0; j < affectedIds.Value.Count; j++) { result.Value.Add(this.hashToIdMap[affectedIds.Value[j]]); } foreach (IConversationTreeNode conversationTreeNode in this.conversationTree) { ConversationTreeNode conversationTreeNode2 = (ConversationTreeNode)conversationTreeNode; foreach (StoreObjectId storeObjectId in conversationTreeNode2.ToListStoreObjectId()) { bool valueOrDefault = conversationTreeNode2.GetValueOrDefault <bool>(storeObjectId, MessageItemSchema.IsDraft, false); if (valueOrDefault && !result.Key.Contains(storeObjectId) && !result.Value.Contains(storeObjectId)) { result.Value.Add(storeObjectId); } } } return(result); }
public static void FixupConversationMessagesCreatorSid(MailboxSession mailboxSession, ConversationIndex conversationIndex, byte[] conversationCreatorSid) { ConversationCreatorHelper.ConversationCreatorDefinitionData conversationCreatorDefinitionData = new ConversationCreatorHelper.ConversationCreatorDefinitionData(mailboxSession, conversationIndex); foreach (IConversationTreeNode conversationTreeNode in conversationCreatorDefinitionData.Conversation.ConversationTree) { ConversationTreeNode conversationTreeNode2 = (ConversationTreeNode)conversationTreeNode; foreach (StoreObjectId storeId in conversationTreeNode2.ToListStoreObjectId()) { using (Item item = Item.Bind(mailboxSession, storeId, null)) { item.OpenAsReadWrite(); item.SetOrDeleteProperty(ItemSchema.ConversationCreatorSID, conversationCreatorSid); item.Save(SaveMode.ResolveConflicts); } } } }