示例#1
0
        void ISourceFolder.CopyTo(IFxProxy fxFolderProxy, CopyPropertiesFlags flags, PropTag[] propTagsToExclude)
        {
            MrsTracer.Provider.Function("PstSourceFolder.ISourceFolder.CopyTo", new object[0]);
            bool exportCompleted = false;

            CommonUtils.ProcessKnownExceptions(delegate
            {
                FxCollectorSerializer fxCollectorSerializer = new FxCollectorSerializer(fxFolderProxy);
                fxCollectorSerializer.Config(0, 1);
                using (FastTransferDownloadContext fastTransferDownloadContext = FastTransferDownloadContext.CreateForDownload(FastTransferSendOption.Unicode | FastTransferSendOption.UseCpId | FastTransferSendOption.ForceUnicode, 1U, Encoding.ASCII, NullResourceTracker.Instance, this.GetPropertyFilterFactory(PstMailbox.MoMTPtaFromPta(propTagsToExclude)), false))
                {
                    IFastTransferProcessor <FastTransferDownloadContext> fastTransferObject = FastTransferFolderCopyTo.CreateDownloadStateMachine(this.Folder, FastTransferFolderContentBase.IncludeSubObject.None);
                    fastTransferDownloadContext.PushInitial(fastTransferObject);
                    FxUtils.TransferFxBuffers(fastTransferDownloadContext, fxCollectorSerializer);
                }
                exportCompleted = true;
                fxFolderProxy.Flush();
            }, delegate(Exception ex)
            {
                if (!exportCompleted)
                {
                    MrsTracer.Provider.Debug("Flushing target proxy after receiving an exception.", new object[0]);
                    CommonUtils.CatchKnownExceptions(new Action(fxFolderProxy.Flush), null);
                }
                return(false);
            });
        }
示例#2
0
 public static void CopyItem(MessageRec messageRec, IMessage message, IFolderProxy folderProxy, PropTag[] propsToExclude)
 {
     using (IMessageProxy messageProxy = folderProxy.OpenMessage(messageRec.EntryId))
     {
         FxCollectorSerializer fxCollectorSerializer = new FxCollectorSerializer(messageProxy);
         fxCollectorSerializer.Config(0, 1);
         using (FastTransferDownloadContext fastTransferDownloadContext = FastTransferDownloadContext.CreateForDownload(FastTransferSendOption.Unicode | FastTransferSendOption.UseCpId | FastTransferSendOption.ForceUnicode, 1U, Encoding.Default, NullResourceTracker.Instance, new PropertyFilterFactory(false, false, (from ptag in propsToExclude
                                                                                                                                                                                                                                                                                                                            select new PropertyTag((uint)ptag)).ToArray <PropertyTag>()), false))
         {
             FastTransferMessageCopyTo fastTransferObject = new FastTransferMessageCopyTo(false, message, true);
             fastTransferDownloadContext.PushInitial(fastTransferObject);
             FxUtils.TransferFxBuffers(fastTransferDownloadContext, fxCollectorSerializer);
             messageProxy.SaveChanges();
         }
     }
 }
 protected override void CopySingleMessage(MessageRec message, IFolderProxy targetFolderProxy, PropTag[] propsToCopyExplicitly, PropTag[] propTagsToExclude)
 {
     ExecutionContext.Create(new DataContext[]
     {
         new OperationDataContext("PstSourceMailbox.CopySingleMessage", OperationType.None),
         new EntryIDsDataContext(message.EntryId)
     }).Execute(delegate
     {
         try
         {
             uint nodeIdFromEntryId = PstMailbox.GetNodeIdFromEntryId(this.IPst.MessageStore.Guid, message.EntryId);
             IMessage message2      = this.IPst.ReadMessage(nodeIdFromEntryId);
             if (message2 == null)
             {
                 throw new UnableToReadPSTMessagePermanentException(this.IPst.FileName, nodeIdFromEntryId);
             }
             PSTMessage pstmessage = new PSTMessage(this, message2);
             using (IMessageProxy messageProxy = targetFolderProxy.OpenMessage(message.EntryId))
             {
                 FxCollectorSerializer fxCollectorSerializer = new FxCollectorSerializer(messageProxy);
                 fxCollectorSerializer.Config(0, 1);
                 using (FastTransferDownloadContext fastTransferDownloadContext = FastTransferDownloadContext.CreateForDownload(FastTransferSendOption.Unicode | FastTransferSendOption.UseCpId | FastTransferSendOption.ForceUnicode, 1U, pstmessage.RawPropertyBag.CachedEncoding, NullResourceTracker.Instance, this.GetPropertyFilterFactory(PstMailbox.MoMTPtaFromPta(propTagsToExclude)), false))
                 {
                     FastTransferMessageCopyTo fastTransferObject = new FastTransferMessageCopyTo(false, pstmessage, true);
                     fastTransferDownloadContext.PushInitial(fastTransferObject);
                     FxUtils.TransferFxBuffers(fastTransferDownloadContext, fxCollectorSerializer);
                     messageProxy.SaveChanges();
                 }
             }
         }
         catch (PSTExceptionBase innerException)
         {
             throw new UnableToReadPSTMessagePermanentException(this.IPst.FileName, PstMailbox.GetNodeIdFromEntryId(this.IPst.MessageStore.Guid, message.EntryId), innerException);
         }
     });
 }