예제 #1
0
        MailboxChangesManifest ISourceMailbox.EnumerateHierarchyChanges(EnumerateHierarchyChangesFlags flags, int maxChanges)
        {
            bool catchup = flags.HasFlag(EnumerateHierarchyChangesFlags.Catchup);

            return(this.EnumerateHierarchyChanges(catchup, delegate(SyncHierarchyManifestState hierarchyData)
            {
                bool flag = false;
                MailboxChangesManifest result;
                try
                {
                    IL_02:
                    result = this.DoManifestSync(flags, maxChanges, hierarchyData, this.MapiStore);
                }
                catch (MapiExceptionCallFailed mapiExceptionCallFailed)
                {
                    if (mapiExceptionCallFailed.LowLevelError == 1228 && !flag)
                    {
                        this.ReadRulesFromAllFolders();
                        flag = true;
                        goto IL_02;
                    }
                    throw;
                }
                return result;
            }));
        }
예제 #2
0
        MailboxChangesManifest ISourceMailbox.EnumerateHierarchyChanges(EnumerateHierarchyChangesFlags flags, int maxChanges)
        {
            MrsTracer.Provider.Function("EasSourceMailbox.EnumerateHierarchyChanges(flags:{0}, maxChanges:{1})", new object[]
            {
                flags,
                maxChanges
            });
            bool catchup = flags.HasFlag(EnumerateHierarchyChangesFlags.Catchup);

            if (catchup)
            {
                if (string.IsNullOrEmpty(this.SyncState.HierarchyData.ProviderSyncState) || this.SyncState.HierarchyData.ManualSyncData != null)
                {
                    base.RefreshFolderCache();
                }
                return(null);
            }
            return(this.EnumerateHierarchyChanges(catchup, delegate(SyncHierarchyManifestState hierState)
            {
                MailboxChangesManifest result;
                try
                {
                    result = this.DoManifestSync(flags, maxChanges, hierState, null);
                }
                catch (EasRequiresSyncKeyResetException ex)
                {
                    MrsTracer.Provider.Error("Encountered RequiresSyncKeyReset error: {0}", new object[]
                    {
                        ex
                    });
                    result = this.RunManualHierarchySync(catchup, hierState);
                }
                return result;
            }));
        }
예제 #3
0
 internal static void ValidateEnumeration(EnumerateHierarchyChangesFlags flags, IHierarchyChangesFetcher hierarchyChangesFetcher, bool hasMoreHierarchyChangesPrevPage, bool isPagedEnumeration)
 {
     flags.HasFlag(EnumerateHierarchyChangesFlags.FirstPage);
     flags.HasFlag(EnumerateHierarchyChangesFlags.Catchup);
     if (!isPagedEnumeration || flags.HasFlag(EnumerateHierarchyChangesFlags.FirstPage) || flags.HasFlag(EnumerateHierarchyChangesFlags.Catchup))
     {
         return;
     }
 }
        MailboxChangesManifest ISourceMailbox.EnumerateHierarchyChanges(EnumerateHierarchyChangesFlags flags, int maxChanges)
        {
            MailboxChangesManifest result = null;

            base.CreateContext("ISourceMailbox.EnumerateHierarchyChanges", new DataContext[]
            {
                new SimpleValueDataContext("flags", flags),
                new SimpleValueDataContext("maxChanges", maxChanges)
            }).Execute(delegate
            {
                result = ((ISourceMailbox)this.WrappedObject).EnumerateHierarchyChanges(flags, maxChanges);
            }, true);
            return(result);
        }
예제 #5
0
        protected override MailboxChangesManifest DoManifestSync(EnumerateHierarchyChangesFlags flags, int maxChanges, SyncHierarchyManifestState hierState, MapiStore mapiStore)
        {
            MrsTracer.Provider.Function("EasSourceMailbox.DoManifestSync", new object[0]);
            base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
            flags.HasFlag(EnumerateHierarchyChangesFlags.Catchup);
            EasHierarchySyncState easHierarchySyncState = EasHierarchySyncState.Deserialize(hierState.ProviderSyncState);
            string syncKey = easHierarchySyncState.SyncKey;
            string syncKey2;
            IReadOnlyCollection <Add> readOnlyCollection;
            MailboxChangesManifest    folderChangesOnServer = this.GetFolderChangesOnServer(syncKey, out syncKey2, out readOnlyCollection);
            bool flag = false;

            easHierarchySyncState.SyncKey = syncKey2;
            if (folderChangesOnServer.DeletedFolders != null)
            {
                List <Add> list = new List <Add>(folderChangesOnServer.DeletedFolders.Count);
                foreach (Add add in easHierarchySyncState.Folders)
                {
                    foreach (byte[] entryId in folderChangesOnServer.DeletedFolders)
                    {
                        if (StringComparer.Ordinal.Equals(add.ServerId, EasMailbox.GetStringId(entryId)))
                        {
                            list.Add(add);
                            break;
                        }
                    }
                }
                foreach (Add item in list)
                {
                    easHierarchySyncState.Folders.Remove(item);
                    flag = true;
                }
            }
            if (readOnlyCollection != null)
            {
                foreach (Add item2 in readOnlyCollection)
                {
                    easHierarchySyncState.Folders.Add(item2);
                    flag = true;
                }
            }
            hierState.ProviderSyncState = easHierarchySyncState.Serialize(false);
            if (flag)
            {
                base.RefreshFolderCache(easHierarchySyncState);
            }
            return(folderChangesOnServer);
        }
예제 #6
0
 MailboxChangesManifest ISourceMailbox.EnumerateHierarchyChanges(EnumerateHierarchyChangesFlags flags, int maxChanges)
 {
     MrsTracer.ProxyClient.Function("RemoteSourceMailbox.EnumerateHierarchyChanges({0}, {1})", new object[]
     {
         flags,
         maxChanges
     });
     base.VerifyMailboxConnection();
     if (((IMailbox)this).IsMailboxCapabilitySupported(MailboxCapabilities.PagedEnumerateHierarchyChanges))
     {
         return(base.MrsProxy.ISourceMailbox_EnumerateHierarchyChanges2(base.Handle, (int)flags, maxChanges));
     }
     if (maxChanges != 0)
     {
         throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "ISourceMailbox_EnumerateHierarchyChanges2");
     }
     return(base.MrsProxy.ISourceMailbox_EnumerateHierarchyChanges(base.Handle, flags.HasFlag(EnumerateHierarchyChangesFlags.Catchup)));
 }
예제 #7
0
        MailboxChangesManifest ISourceMailbox.EnumerateHierarchyChanges(EnumerateHierarchyChangesFlags flags, int maxChanges)
        {
            bool catchup = flags.HasFlag(EnumerateHierarchyChangesFlags.Catchup);

            return(this.EnumerateHierarchyChanges(catchup, (SyncHierarchyManifestState hierarchyData) => this.RunManualHierarchySync(catchup, hierarchyData)));
        }
        private void ConfigureMapiManifest(SyncHierarchyManifestState syncState, MailboxChangesManifest changes, EnumerateHierarchyChangesFlags flags, int maxChanges)
        {
            if (this.isPagedEnumeration && !flags.HasFlag(EnumerateHierarchyChangesFlags.FirstPage))
            {
                this.callback.InitializeNextPage(changes, maxChanges);
                return;
            }
            this.callback = new ManifestHierarchyCallback(this.isPagedEnumeration);
            this.callback.InitializeNextPage(changes, maxChanges);
            SyncConfigFlags syncConfigFlags = SyncConfigFlags.ManifestHierReturnDeletedEntryIds;

            if (((this.mailbox.ServerVersion >= Server.E14MinVersion && this.mailbox.ServerVersion < Server.E15MinVersion) || (long)this.mailbox.ServerVersion >= ManifestHierarchyChangesFetcher.E15MinVersionSupportsOnlySpecifiedPropsForHierarchy) && !this.mailbox.IsPureMAPI)
            {
                syncConfigFlags |= SyncConfigFlags.OnlySpecifiedProps;
            }
            using (this.mailbox.RHTracker.Start())
            {
                this.mapiManifest = this.mapiFolder.CreateExportHierarchyManifestEx(syncConfigFlags, syncState.IdsetGiven, syncState.CnsetSeen, this.callback, new PropTag[]
                {
                    PropTag.EntryId
                }, null);
            }
        }
        private MailboxChangesManifest EnumerateChanges(SyncHierarchyManifestState hierState, EnumerateHierarchyChangesFlags flags, int maxChanges)
        {
            MailboxChangesManifest mailboxChangesManifest = new MailboxChangesManifest();

            this.ConfigureMapiManifest(hierState, mailboxChangesManifest, flags, maxChanges);
            ManifestStatus manifestStatus;

            do
            {
                manifestStatus = this.mapiManifest.Synchronize();
            }while (manifestStatus != ManifestStatus.Done && manifestStatus != ManifestStatus.Yielded);
            byte[] idsetGiven;
            byte[] cnsetSeen;
            this.mapiManifest.GetState(out idsetGiven, out cnsetSeen);
            hierState.IdsetGiven = idsetGiven;
            hierState.CnsetSeen  = cnsetSeen;
            return(mailboxChangesManifest);
        }
        MailboxChangesManifest IHierarchyChangesFetcher.EnumerateHierarchyChanges(SyncHierarchyManifestState hierState, EnumerateHierarchyChangesFlags flags, int maxChanges)
        {
            MailboxChangesManifest mailboxChangesManifest = this.EnumerateChanges(hierState, flags, maxChanges);

            MrsTracer.Provider.Debug("Discovered {0} changed, {1} deleted", new object[]
            {
                mailboxChangesManifest.ChangedFolders.Count,
                mailboxChangesManifest.DeletedFolders.Count
            });
            return(mailboxChangesManifest);
        }
예제 #11
0
        MailboxChangesManifest ISourceMailbox.EnumerateHierarchyChanges(EnumerateHierarchyChangesFlags flags, int maxChanges)
        {
            bool catchup = flags.HasFlag(EnumerateHierarchyChangesFlags.Catchup);

            return(this.EnumerateHierarchyChanges(catchup, (SyncHierarchyManifestState hierarchyData) => this.DoManifestSync(flags, maxChanges, hierarchyData, this.StoreSession.Mailbox.MapiStore)));
        }
예제 #12
0
 MailboxChangesManifest ISourceMailbox.EnumerateHierarchyChanges(EnumerateHierarchyChangesFlags flags, int maxChanges)
 {
     throw new NotImplementedException();
 }