Beispiel #1
0
        protected void ComputeFolderMapping(bool createMissingFolderRecs)
        {
            MrsTracer.Service.Debug("Loading source hierarchy", new object[0]);
            List <PropTag> list = new List <PropTag>
            {
                PropTag.ContentCount,
                PropTag.MessageSizeExtended,
                PropTag.AssocContentCount,
                PropTag.AssocMessageSizeExtended
            };

            list.AddRange(this.MailboxMerger.GetAdditionalFolderPtags());
            string text = base.CachedRequestJob.SourceRootFolder;

            if (string.IsNullOrEmpty(text) && base.CachedRequestJob.RequestType == MRSRequestType.MailboxImport)
            {
                text = FolderFilterParser.GetAlias(WellKnownFolderType.IpmSubtree);
            }
            this.MailboxMerger.SourceHierarchy.LoadHierarchy(EnumerateFolderHierarchyFlags.None, text, false, list.ToArray());
            base.RefreshRequestIfNeeded();
            base.CheckServersHealth();
            this.MailboxMerger.SourceHierarchy.SetFolderFilter(base.CachedRequestJob.IncludeFolders, !base.CachedRequestJob.ExcludeDumpster, base.CachedRequestJob.ExcludeFolders, base.CachedRequestJob.SourceRootFolder, base.CachedRequestJob.IsLivePublicFolderMailboxRestore, base.CachedRequestJob.SourceExchangeGuid);
            MrsTracer.Service.Debug("Loading target hierarchy", new object[0]);
            string text2 = base.CachedRequestJob.TargetRootFolder;

            if (string.IsNullOrEmpty(text2) && base.CachedRequestJob.RequestType == MRSRequestType.MailboxExport)
            {
                text2 = FolderFilterParser.GetAlias(WellKnownFolderType.IpmSubtree);
            }
            this.MailboxMerger.DestHierarchy.LoadHierarchy(EnumerateFolderHierarchyFlags.None, text2, true, base.CachedRequestJob.IsPublicFolderMailboxRestore ? MergeJob.PublicFolderPropTags : null);
            MrsTracer.Service.Debug("Retrieving destination mailbox culture", new object[0]);
            CultureInfo mailboxCulture = this.MailboxMerger.DestMailboxWrapper.MailboxCulture;

            this.MailboxMerger.SourceHierarchy.TargetMailboxCulture = mailboxCulture;
            MrsTracer.Service.Debug("Computing folder hierarchy mapping", new object[0]);
            if (base.CachedRequestJob.IsPublicFolderMailboxRestore)
            {
                createMissingFolderRecs = false;
            }
            this.MailboxMerger.SourceHierarchy.ComputeFolderMapping(this.MailboxMerger.DestHierarchy, createMissingFolderRecs);
            foreach (LocalizedString msg in this.MailboxMerger.SourceHierarchy.Warnings)
            {
                base.Report.Append(msg);
            }
        }
Beispiel #2
0
        public static void Parse(string folderPath, out WellKnownFolderType root, out List <string> folderNames, out FolderMappingFlags inheritanceFlags)
        {
            folderNames      = new List <string>();
            root             = WellKnownFolderType.IpmSubtree;
            inheritanceFlags = FolderMappingFlags.None;
            if (folderPath.EndsWith("/"))
            {
                folderPath = folderPath.Substring(0, folderPath.Length - "/".Length);
            }
            else if (folderPath.EndsWith("/*"))
            {
                folderPath       = folderPath.Substring(0, folderPath.Length - "/*".Length);
                inheritanceFlags = FolderMappingFlags.Inherit;
            }
            bool flag = true;
            int  i    = 0;

            while (i < folderPath.Length)
            {
                string nextSubfolderName = FolderFilterParser.GetNextSubfolderName(folderPath, ref i);
                if (flag)
                {
                    WellKnownFolderType wellKnownFolderType = WellKnownFolderType.None;
                    if (folderPath[0] != '\\')
                    {
                        wellKnownFolderType = FolderFilterParser.CheckAlias(nextSubfolderName);
                    }
                    if (wellKnownFolderType != WellKnownFolderType.None)
                    {
                        root = wellKnownFolderType;
                    }
                    else
                    {
                        folderNames.Add(nextSubfolderName);
                    }
                    flag = false;
                }
                else
                {
                    folderNames.Add(nextSubfolderName);
                }
            }
        }
Beispiel #3
0
        private FolderMapping FindFolderByPath(string folderRoot, string folderPath, bool createIfNeeded, out FolderMappingFlags parsedInheritanceFlags)
        {
            WellKnownFolderType wkfType;
            List <string>       list;

            FolderFilterParser.Parse(folderPath, out wkfType, out list, out parsedInheritanceFlags);
            FolderMapping folderMapping = null;

            if (base.IsPublicFolderMailbox && this.rootFolder != null && (string.Compare(folderPath, "/*") == 0 || !string.IsNullOrEmpty(folderRoot)))
            {
                folderMapping = this.rootFolder;
            }
            else
            {
                folderMapping = this.GetWellKnownFolder(wkfType);
            }
            if (folderMapping != null)
            {
                foreach (string text in list)
                {
                    FolderMapping folderMapping2 = (FolderMapping)folderMapping.FindChildByName(text, base.TargetMailboxCulture);
                    if (folderMapping2 == null)
                    {
                        if (!createIfNeeded)
                        {
                            return(null);
                        }
                        folderMapping2        = new FolderMapping(text, FolderType.Generic, null);
                        folderMapping2.Parent = folderMapping;
                    }
                    folderMapping = folderMapping2;
                }
                return(folderMapping);
            }
            return(folderMapping);
        }
 public override bool IsMatch(BadMessageRec message, TestIntegration testIntegration)
 {
     return(message != null && FolderFilterParser.IsDumpster(message.WellKnownFolderType));
 }
Beispiel #5
0
 public override bool AreRulesSupported()
 {
     return(base.AreRulesSupported() && !FolderFilterParser.IsDumpster(this.WKFType));
 }