Exemplo n.º 1
0
        FolderChangesManifest ISourceFolder.EnumerateChanges(EnumerateContentChangesFlags flags, int maxChanges)
        {
            FolderChangesManifest folderChangesManifest = new FolderChangesManifest(base.FolderId);

            folderChangesManifest.ChangedMessages = new List <MessageRec>();
            folderChangesManifest.ReadMessages    = new List <byte[]>();
            folderChangesManifest.UnreadMessages  = new List <byte[]>();
            SyncContentsManifestState syncContentsManifestState = base.Mailbox.SyncState[base.FolderId];
            PopFolderState            lastSyncedState;

            if (syncContentsManifestState.Data != null)
            {
                lastSyncedState = PopFolderState.Deserialize(syncContentsManifestState.Data);
            }
            else
            {
                lastSyncedState = PopFolderState.CreateNew();
            }
            List <MessageRec> messages       = base.EnumerateMessagesOnPopConnection(maxChanges);
            PopFolderState    popFolderState = PopFolderState.Create(messages);

            this.EnumerateIncrementalChanges(popFolderState, lastSyncedState, folderChangesManifest, messages);
            syncContentsManifestState.Data = popFolderState.Serialize();
            return(folderChangesManifest);
        }
Exemplo n.º 2
0
        List <MessageRec> ISourceFolder.EnumerateMessagesPaged(int maxPageSize)
        {
            SyncContentsManifestState syncContentsManifestState = base.Mailbox.SyncState[base.FolderId];
            PopFolderState            popFolderState            = (syncContentsManifestState.Data != null) ? PopFolderState.Deserialize(syncContentsManifestState.Data) : PopFolderState.CreateNew();

            foreach (string item in this.crawlerCopiedMessages.Values)
            {
                popFolderState.MessageList.Add(item);
                this.crawlerCopiedMessages.Remove(item);
            }
            syncContentsManifestState.Data = popFolderState.Serialize();
            List <MessageRec> list  = base.EnumerateMessagesOnPopConnection(0);
            List <MessageRec> list2 = new List <MessageRec>();

            foreach (MessageRec messageRec in list)
            {
                string item2 = PopEntryId.ParseUid(messageRec.EntryId);
                if (!popFolderState.MessageList.Contains(item2))
                {
                    list2.Add(messageRec);
                    if (list2.Count == maxPageSize)
                    {
                        break;
                    }
                }
            }
            if (list2.Count == 0)
            {
                return(null);
            }
            foreach (MessageRec messageRec2 in list2)
            {
                string item3 = PopEntryId.ParseUid(messageRec2.EntryId);
                this.crawlerCopiedMessages.Add(item3);
            }
            return(list2);
        }