Пример #1
0
        public bool CompareRootFolders()
        {
            ISourceFolder folder = base.SourceMailbox.GetFolder(null);

            if (folder == null)
            {
                throw new RootFolderNotFoundPermananentException();
            }
            FolderRec folderRec;

            using (folder)
            {
                folderRec = folder.GetFolderRec(null, GetFolderRecFlags.None);
            }
            IDestinationFolder folder2 = base.DestMailbox.GetFolder(null);

            if (folder2 == null)
            {
                throw new RootFolderNotFoundPermananentException();
            }
            FolderRec folderRec2;

            using (folder2)
            {
                folderRec2 = folder2.GetFolderRec(null, GetFolderRecFlags.None);
            }
            if (!CommonUtils.IsSameEntryId(folderRec.EntryId, folderRec2.EntryId))
            {
                MrsTracer.Service.Warning("Root folder IDs don't match on source and destination mailboxes. Restarting the move.", new object[0]);
                return(false);
            }
            return(true);
        }
Пример #2
0
 public void WriteRules(IDestinationFolder targetFolder, Action <List <BadMessageRec> > reportBadItemsDelegate)
 {
     if (this.FolderType == FolderType.Search)
     {
         return;
     }
     CommonUtils.ProcessKnownExceptions(delegate
     {
         targetFolder.SetRules(this.Rules);
     }, delegate(Exception ex)
     {
         if (reportBadItemsDelegate != null && CommonUtils.ExceptionIsAny(ex, new WellKnownException[]
         {
             WellKnownException.DataProviderPermanent,
             WellKnownException.MapiNotEnoughMemory
         }))
         {
             List <BadMessageRec> list = new List <BadMessageRec>(1);
             list.Add(BadMessageRec.Folder(this.FolderRec, BadItemKind.CorruptFolderRule, ex));
             reportBadItemsDelegate(list);
             return(true);
         }
         return(false);
     });
 }
Пример #3
0
        public void CopyFolderData(FolderMapping fm, ISourceFolder srcFolder, IDestinationFolder destFolder)
        {
            MrsTracer.Service.Debug("Loading mappable folder properties", new object[0]);
            FolderRecDataFlags dataToCopy = FolderRecDataFlags.SearchCriteria;

            if (!base.MRSJob.CachedRequestJob.IsPublicFolderMailboxRestore)
            {
                bool flag;
                this.CopyFolderProperties(fm, srcFolder, destFolder, dataToCopy, out flag);
            }
            if (fm.FolderType != FolderType.Search)
            {
                this.MergeFolderContents(fm, srcFolder, destFolder);
            }
        }
        IDestinationFolder IDestinationMailbox.GetFolder(byte[] entryId)
        {
            IDestinationFolder result = null;

            base.CreateContext("IDestinationMailbox.GetFolder", new DataContext[]
            {
                new EntryIDsDataContext(entryId)
            }).Execute(delegate
            {
                result = ((IDestinationMailbox)this.WrappedObject).GetFolder(entryId);
            }, true);
            if (result == null)
            {
                return(null);
            }
            return(new DestinationFolderWrapper(result, base.CreateContext));
        }
Пример #5
0
 public override FolderMap GetDestinationFolderMap(GetFolderMapFlags flags)
 {
     base.DestMailboxWrapper.LoadFolderMap(flags, delegate
     {
         List <FolderRecWrapper> list = new List <FolderRecWrapper>(this.hierarchyFolderEntryIds.Count);
         foreach (byte[] entryId in this.hierarchyFolderEntryIds)
         {
             byte[] sessionSpecificEntryId = base.DestMailbox.GetSessionSpecificEntryId(entryId);
             using (IDestinationFolder folder = base.DestMailbox.GetFolder(sessionSpecificEntryId))
             {
                 list.Add(new FolderRecWrapper(folder.GetFolderRec(null, GetFolderRecFlags.None)));
             }
         }
         return(new PublicFolderMap(list));
     });
     return(base.DestMailboxWrapper.FolderMap);
 }
Пример #6
0
 private void CopyFolderPropertiesAndContents(FolderMapping folder, FolderContentsCrawler sourceFolderCrawler, bool shouldCopyProperties, TimeSpan maxOperationDuration)
 {
     PagedMergeJob.< > c__DisplayClass1 CS$ < > 8__locals1 = new PagedMergeJob.< > c__DisplayClass1();
     CS$ < > 8__locals1.folder = folder;
     CS$ < > 8__locals1.sourceFolderCrawler  = sourceFolderCrawler;
     CS$ < > 8__locals1.shouldCopyProperties = shouldCopyProperties;
     CS$ < > 8__locals1.maxOperationDuration = maxOperationDuration;
     CS$ < > 8__locals1.< > 4__this          = this;
     using (IDestinationFolder destFolder = base.MailboxMerger.DestMailbox.GetFolder(CS$ < > 8__locals1.folder.TargetFolder.EntryId))
     {
         if (destFolder == null)
         {
             base.Report.Append(MrsStrings.ReportTargetFolderDeleted(CS$ < > 8__locals1.folder.TargetFolder.FullFolderName, TraceUtils.DumpEntryId(CS$ < > 8__locals1.folder.TargetFolder.EntryId), CS$ < > 8__locals1.folder.FullFolderName));
             return;
         }
         ExecutionContext.Create(new DataContext[]
         {
             new FolderRecWrapperDataContext(CS$ < > 8__locals1.folder)
         }).Execute(delegate
Пример #7
0
 protected void CopyFolder(FolderMapping fm)
 {
     base.RefreshRequestIfNeeded();
     base.TimeTracker.CurrentState = RequestState.CopyingMessages;
     base.TestIntegration.Barrier("PostponeWriteMessages", new Action(base.RefreshRequestIfNeeded));
     base.CheckServersHealth();
     ExecutionContext.Create(new DataContext[]
     {
         new FolderRecWrapperDataContext(fm)
     }).Execute(delegate
     {
         if (this.CachedRequestJob.IsPublicFolderMailboxRestore && fm.TargetFolder == null)
         {
             this.Warnings.Add(MrsStrings.FolderIsMissing(HexConverter.ByteArrayToHexString(fm.EntryId)));
             return;
         }
         using (ISourceFolder folder = this.MailboxMerger.SourceMailbox.GetFolder(fm.EntryId))
         {
             if (folder == null)
             {
                 this.Report.Append(MrsStrings.ReportSourceFolderDeleted(fm.FullFolderName, TraceUtils.DumpEntryId(fm.EntryId)));
             }
             else
             {
                 using (IDestinationFolder folder2 = this.MailboxMerger.DestMailbox.GetFolder(fm.TargetFolder.EntryId))
                 {
                     if (folder2 == null)
                     {
                         this.Report.Append(MrsStrings.ReportTargetFolderDeleted(fm.TargetFolder.FullFolderName, TraceUtils.DumpEntryId(fm.TargetFolder.EntryId), fm.FullFolderName));
                     }
                     else
                     {
                         this.Report.Append(MrsStrings.ReportMergingFolder(fm.FullFolderName, fm.TargetFolder.FullFolderName));
                         this.CopyFolderData(fm, folder, folder2);
                         folder2.Flush();
                     }
                 }
             }
         }
     });
     base.SaveState(SaveStateFlags.Lazy, null);
 }
Пример #8
0
 private void UpdateSourceId(byte[] destinationFolderId, byte[] destinationMessageId, byte[] sourceId)
 {
     using (IDestinationFolder folder = base.DestMailbox.GetFolder(destinationFolderId))
     {
         if (folder == null)
         {
             MrsTracer.Service.Warning("Destination folder {0} disappeared", new object[]
             {
                 TraceUtils.DumpEntryId(destinationFolderId)
             });
         }
         else
         {
             folder.SetMessageProps(destinationMessageId, new PropValueData[]
             {
                 new PropValueData(this.DestHierarchy.SourceEntryIDPtag, sourceId)
             });
         }
     }
 }
Пример #9
0
 private void DeleteItem(byte[] destinationFolderId, byte[] destinationMessageId)
 {
     using (IDestinationFolder folder = base.DestMailbox.GetFolder(destinationFolderId))
     {
         if (folder == null)
         {
             MrsTracer.Service.Warning("Destination folder {0} disappeared", new object[]
             {
                 TraceUtils.DumpEntryId(destinationFolderId)
             });
         }
         else
         {
             folder.DeleteMessages(new byte[][]
             {
                 destinationMessageId
             });
         }
     }
 }