コード例 #1
0
        void ISourceFolder.CopyTo(IFxProxy destFolderProxy, CopyPropertiesFlags flags, PropTag[] excludeTags)
        {
            MrsTracer.Provider.Function("StorageSourceFolder.CopyTo({0})", new object[]
            {
                base.DisplayNameForTracing
            });
            if ((base.Mailbox.Flags & LocalMailboxFlags.StripLargeRulesForDownlevelTargets) != LocalMailboxFlags.None)
            {
                flags |= CopyPropertiesFlags.StripLargeRulesForDownlevelTargets;
            }
            bool exportCompleted = false;

            CommonUtils.ProcessKnownExceptions(delegate
            {
                using (this.Mailbox.RHTracker.Start())
                {
                    using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(destFolderProxy, false, new Func <IDisposable>(this.Mailbox.RHTracker.StartExclusive), new Action <uint>(this.Mailbox.RHTracker.Charge)))
                    {
                        this.MapiFolder.ExportObject(fxProxyBudgetWrapper, flags, excludeTags);
                    }
                }
                exportCompleted = true;
                destFolderProxy.Flush();
            }, delegate(Exception ex)
            {
                if (!exportCompleted)
                {
                    MrsTracer.Provider.Debug("Flushing target proxy after receiving an exception.", new object[0]);
                    CommonUtils.CatchKnownExceptions(new Action(destFolderProxy.Flush), null);
                }
                return(false);
            });
        }
コード例 #2
0
        void ISourceFolder.ExportMessages(IFxProxy destFolderProxy, CopyMessagesFlags flags, byte[][] entryIds)
        {
            MrsTracer.Provider.Function("StorageSourceFolder.ExportMessages({0})", new object[]
            {
                base.DisplayNameForTracing
            });
            bool exportCompleted = false;

            CommonUtils.ProcessKnownExceptions(delegate
            {
                using (this.Mailbox.RHTracker.Start())
                {
                    using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(destFolderProxy, false, new Func <IDisposable>(this.Mailbox.RHTracker.StartExclusive), new Action <uint>(this.Mailbox.RHTracker.Charge)))
                    {
                        this.MapiFolder.ExportMessages(fxProxyBudgetWrapper, flags, entryIds);
                    }
                }
                exportCompleted = true;
                destFolderProxy.Flush();
            }, delegate(Exception ex)
            {
                if (!exportCompleted)
                {
                    MrsTracer.Provider.Debug("Flushing target proxy after receiving an exception.", new object[0]);
                    CommonUtils.CatchKnownExceptions(new Action(destFolderProxy.Flush), null);
                }
                return(false);
            });
        }
コード例 #3
0
        void ISourceMailbox.CopyTo(IFxProxy fxProxy, PropTag[] excludeTags)
        {
            MrsTracer.Provider.Function("MapiSourceMailbox.CopyTo", new object[0]);
            base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
            bool flag = false;

            try
            {
                CopyPropertiesFlags copyPropertiesFlags = CopyPropertiesFlags.None;
                if ((base.Flags & LocalMailboxFlags.StripLargeRulesForDownlevelTargets) != LocalMailboxFlags.None)
                {
                    copyPropertiesFlags |= CopyPropertiesFlags.StripLargeRulesForDownlevelTargets;
                }
                using (base.RHTracker.Start())
                {
                    using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(fxProxy, false, new Func <IDisposable>(base.RHTracker.StartExclusive), new Action <uint>(base.RHTracker.Charge)))
                    {
                        base.MapiStore.ExportObject(fxProxyBudgetWrapper, copyPropertiesFlags, excludeTags);
                    }
                }
                flag = true;
                fxProxy.Flush();
            }
            finally
            {
                if (!flag)
                {
                    MrsTracer.Provider.Debug("Flushing target proxy after receiving an exception.", new object[0]);
                    CommonUtils.CatchKnownExceptions(new Action(fxProxy.Flush), null);
                }
            }
        }
コード例 #4
0
        void ISourceFolder.ExportMessages(IFxProxy destFolderProxy, CopyMessagesFlags flags, byte[][] entryIds)
        {
            MrsTracer.Provider.Function("MapiSourceFolder.CopyTo", new object[0]);
            bool flag = false;

            try
            {
                using (base.Mailbox.RHTracker.Start())
                {
                    using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(destFolderProxy, false, new Func <IDisposable>(base.Mailbox.RHTracker.StartExclusive), new Action <uint>(base.Mailbox.RHTracker.Charge)))
                    {
                        base.Folder.ExportMessages(fxProxyBudgetWrapper, flags, entryIds);
                    }
                }
                flag = true;
                destFolderProxy.Flush();
            }
            catch (LocalizedException)
            {
                if (!flag)
                {
                    MrsTracer.Provider.Debug("Flushing target proxy after receiving an exception.", new object[0]);
                    CommonUtils.CatchKnownExceptions(new Action(destFolderProxy.Flush), null);
                }
                throw;
            }
        }
コード例 #5
0
        void ISourceFolder.CopyTo(IFxProxy destFolderProxy, CopyPropertiesFlags flags, PropTag[] excludeTags)
        {
            MrsTracer.Provider.Function("MapiSourceFolder.CopyTo", new object[0]);
            if ((base.Mailbox.Flags & LocalMailboxFlags.StripLargeRulesForDownlevelTargets) != LocalMailboxFlags.None)
            {
                flags |= CopyPropertiesFlags.StripLargeRulesForDownlevelTargets;
            }
            bool flag = false;

            try
            {
                using (base.Mailbox.RHTracker.Start())
                {
                    using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(destFolderProxy, false, new Func <IDisposable>(base.Mailbox.RHTracker.StartExclusive), new Action <uint>(base.Mailbox.RHTracker.Charge)))
                    {
                        base.Folder.ExportObject(fxProxyBudgetWrapper, flags, excludeTags);
                    }
                }
                flag = true;
                destFolderProxy.Flush();
            }
            catch (LocalizedException)
            {
                if (!flag)
                {
                    MrsTracer.Provider.Debug("Flushing target proxy after receiving an exception.", new object[0]);
                    CommonUtils.CatchKnownExceptions(new Action(destFolderProxy.Flush), null);
                }
                throw;
            }
        }
コード例 #6
0
 protected override void CopySingleMessage(MessageRec curMsg, IFolderProxy folderProxy, PropTag[] propsToCopyExplicitly, PropTag[] excludeProps)
 {
     ExecutionContext.Create(new DataContext[]
     {
         new OperationDataContext("MapiSourceMailbox.CopySingleMessage", OperationType.None),
         new EntryIDsDataContext(curMsg.EntryId)
     }).Execute(delegate
     {
         using (this.RHTracker.Start())
         {
             using (MapiMessage mapiMessage = (MapiMessage)this.OpenMapiEntry(curMsg.FolderId, curMsg.EntryId, OpenEntryFlags.DontThrowIfEntryIsMissing))
             {
                 if (mapiMessage == null)
                 {
                     MrsTracer.Provider.Debug("Message {0} is missing in source, ignoring", new object[]
                     {
                         TraceUtils.DumpEntryId(curMsg.EntryId)
                     });
                 }
                 else
                 {
                     using (IMessageProxy messageProxy = folderProxy.OpenMessage(curMsg.EntryId))
                     {
                         using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(messageProxy, false, new Func <IDisposable>(this.RHTracker.StartExclusive), new Action <uint>(this.RHTracker.Charge)))
                         {
                             mapiMessage.ExportObject(fxProxyBudgetWrapper, CopyPropertiesFlags.None, excludeProps);
                         }
                         if (propsToCopyExplicitly != null && propsToCopyExplicitly.Length > 0)
                         {
                             PropValue[] props = mapiMessage.GetProps(propsToCopyExplicitly);
                             using (this.RHTracker.StartExclusive())
                             {
                                 List <PropValueData> list = new List <PropValueData>();
                                 foreach (PropValue propValue in props)
                                 {
                                     if (!propValue.IsNull() && !propValue.IsError())
                                     {
                                         list.Add(new PropValueData(propValue.PropTag, propValue.Value));
                                     }
                                 }
                                 if (list.Count > 0)
                                 {
                                     messageProxy.SetProps(list.ToArray());
                                 }
                             }
                         }
                         using (this.RHTracker.StartExclusive())
                         {
                             messageProxy.SaveChanges();
                         }
                     }
                 }
             }
         }
     });
 }
コード例 #7
0
        IFxProxy IDestinationMailbox.GetFxProxy()
        {
            MrsTracer.Provider.Function("MapiDestinationMailbox.GetFxProxy", new object[0]);
            base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
            IFxProxy result;

            using (base.RHTracker.Start())
            {
                FxProxyBudgetWrapper proxy          = new FxProxyBudgetWrapper(base.MapiStore.GetFxProxyCollector(), true, new Func <IDisposable>(base.RHTracker.Start), new Action <uint>(base.RHTracker.Charge));
                FxProxyWrapper       fxProxyWrapper = new FxProxyWrapper(proxy, null);
                result = fxProxyWrapper;
            }
            return(result);
        }
コード例 #8
0
        IFxProxy IDestinationFolder.GetFxProxy(FastTransferFlags flags)
        {
            MrsTracer.Provider.Function("MapiDestinationFolder.GetFxProxy", new object[0]);
            IFxProxy result;

            using (base.Mailbox.RHTracker.Start())
            {
                IMapiFxProxy fxProxyCollector = base.Folder.GetFxProxyCollector();
                IFxProxy     proxy            = new FxProxyBudgetWrapper(fxProxyCollector, true, new Func <IDisposable>(base.Mailbox.RHTracker.Start), new Action <uint>(base.Mailbox.RHTracker.Charge));
                IFxProxy     fxProxy          = new FxProxyWrapper(proxy, null);
                result = fxProxy;
            }
            return(result);
        }
コード例 #9
0
        IFxProxy IDestinationFolder.GetFxProxy(FastTransferFlags flags)
        {
            MrsTracer.Provider.Function("StorageDestinationFolder.GetFxProxy: {0}", new object[]
            {
                base.DisplayNameForTracing
            });
            IFxProxy result;

            using (base.Mailbox.RHTracker.Start())
            {
                IMapiFxProxy destProxy = flags.HasFlag(FastTransferFlags.PassThrough) ? base.CoreFolder.GetFxProxyCollector() : new StorageFolderProxy(this, base.Mailbox.Flags.HasFlag(LocalMailboxFlags.Move));
                IFxProxy     proxy     = new FxProxyBudgetWrapper(destProxy, true, new Func <IDisposable>(base.Mailbox.RHTracker.Start), new Action <uint>(base.Mailbox.RHTracker.Charge));
                IFxProxy     fxProxy   = new FxProxyWrapper(proxy, null);
                result = fxProxy;
            }
            return(result);
        }
コード例 #10
0
 private void ExportSingleFolder(IFxProxyPool proxyPool, byte[] folderEntryId, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludePropertiesFromCopy, AclFlags extendedAclFlags)
 {
     ExecutionContext.Create(new DataContext[]
     {
         new OperationDataContext("StorageSourceMailbox.ExportSingleFolder", OperationType.None),
         new EntryIDsDataContext(folderEntryId),
         new SimpleValueDataContext("exportFoldersDataToCopyFlags", exportFoldersDataToCopyFlags),
         new SimpleValueDataContext("folderRecFlags", folderRecFlags),
         new PropTagsDataContext(additionalFolderRecProps),
         new SimpleValueDataContext("copyPropertiesFlags", copyPropertiesFlags),
         new PropTagsDataContext(excludePropertiesFromCopy),
         new SimpleValueDataContext("extendedAclFlags", extendedAclFlags)
     }).Execute(delegate
     {
         using (this.RHTracker.Start())
         {
             using (ISourceFolder folder = this.GetFolder <StorageSourceFolder>(folderEntryId))
             {
                 if (folder == null)
                 {
                     MrsTracer.Provider.Debug("Folder {0} is missing in source. Skipping.", new object[]
                     {
                         TraceUtils.DumpEntryId(folderEntryId)
                     });
                 }
                 else
                 {
                     using (IFolderProxy folderProxyForExportFolder = StorageSourceMailbox.GetFolderProxyForExportFolder(proxyPool, folder, exportFoldersDataToCopyFlags, folderRecFlags, additionalFolderRecProps))
                     {
                         if (extendedAclFlags != AclFlags.None)
                         {
                             this.ExportExtendedAcls(extendedAclFlags, folder, folderProxyForExportFolder);
                         }
                         using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(folderProxyForExportFolder, false, new Func <IDisposable>(this.RHTracker.StartExclusive), new Action <uint>(this.RHTracker.Charge)))
                         {
                             if (exportFoldersDataToCopyFlags.HasFlag(ExportFoldersDataToCopyFlags.IncludeCopyToStream))
                             {
                                 folder.CopyTo(fxProxyBudgetWrapper, copyPropertiesFlags, excludePropertiesFromCopy);
                             }
                         }
                     }
                 }
             }
         }
     });
 }