// Token: 0x06000465 RID: 1125 RVA: 0x0001FB30 File Offset: 0x0001DD30
        internal static FolderTuple LinkChildren(Dictionary <StoreObjectId, FolderTuple> folders, string emailAddress)
        {
            FolderTuple folderTuple  = null;
            FolderTuple folderTuple2 = null;

            FolderHelper.Tracer.TraceDebug <string>(0L, "{0}: LinkChildren: About to start linking children to parents.", emailAddress);
            foreach (FolderTuple folderTuple3 in folders.Values)
            {
                FolderHelper.Tracer.TraceDebug <string, string, string>(0L, "{0}: LinkChildren: About to link folder '{1}'. FolderId: '{2}'. Looking for parent..", emailAddress, folderTuple3.DisplayName, folderTuple3.FolderId.ToHexEntryId());
                if (folderTuple3.IsRootFolder || ArrayComparer <byte> .Comparer.Equals(folderTuple3.FolderId.ProviderLevelItemId, folderTuple3.ParentId.ProviderLevelItemId))
                {
                    if (folderTuple != null)
                    {
                        FolderHelper.Tracer.TraceError(0L, "{0}: LinkChildren: FolderId and ParentId of folder '{1}' are the same. FolderId: '{2}'. ParentId: '{3}'.", new object[]
                        {
                            emailAddress,
                            folderTuple3.DisplayName,
                            folderTuple3.FolderId.ToHexEntryId(),
                            folderTuple3.ParentId.ToHexEntryId()
                        });
                    }
                    else
                    {
                        FolderHelper.Tracer.TraceDebug(0L, "{0}: LinkChildren: Found root folder '{1}'. FolderId: '{2}'. ParentId: '{3}'.", new object[]
                        {
                            emailAddress,
                            folderTuple3.DisplayName,
                            folderTuple3.FolderId.ToHexEntryId(),
                            folderTuple3.ParentId.ToHexEntryId()
                        });
                        folderTuple = folderTuple3;
                    }
                }
                else if (folders.TryGetValue(folderTuple3.ParentId, out folderTuple2))
                {
                    folderTuple2.AddChild(folderTuple3.DisplayName, folderTuple3);
                    FolderHelper.Tracer.TraceDebug <string, string, string>(0L, "{0}: LinkChildren: Adding child folder {1} to parent folder {2}.", emailAddress, folderTuple3.DisplayName, folderTuple2.DisplayName);
                }
                else
                {
                    FolderHelper.Tracer.TraceDebug(0L, "{0}: LinkChildren: Could not find parent for folder {1} in table. FolderId: '{2}'. ParentId: '{3}'.", new object[]
                    {
                        emailAddress,
                        folderTuple3.DisplayName,
                        folderTuple3.FolderId.ToHexEntryId(),
                        folderTuple3.ParentId.ToHexEntryId()
                    });
                }
            }
            return(folderTuple);
        }
        // Token: 0x0600045C RID: 1116 RVA: 0x0001F1B8 File Offset: 0x0001D3B8
        internal FolderTuple GetArchiveFolderTuple(StoreObjectId sourceFolderId)
        {
            FolderTuple folderTuple  = null;
            FolderTuple folderTuple2 = null;

            FolderTuple[]     targetFolderPathFromSourceFolder = this.GetTargetFolderPathFromSourceFolder(sourceFolderId);
            DefaultFolderType defaultFolderType;

            if (this.ElcUserInformation.ProcessEhaMigratedMessages && (targetFolderPathFromSourceFolder == null || targetFolderPathFromSourceFolder.Length == 0) && this.IsMigrationFolder(sourceFolderId, out defaultFolderType))
            {
                StoreObjectId defaultFolderId = this.MailboxSession.GetDefaultFolderId(defaultFolderType);
                targetFolderPathFromSourceFolder = this.GetTargetFolderPathFromSourceFolder(defaultFolderId);
            }
            this.QueryHierarchies();
            if (this.archiveParent != null && this.archiveHierarchy != null && targetFolderPathFromSourceFolder != null && targetFolderPathFromSourceFolder.Length > 0)
            {
                folderTuple = this.archiveParent;
                FolderTuple folderTuple3 = null;
                foreach (FolderTuple folderTuple4 in targetFolderPathFromSourceFolder)
                {
                    FolderArchiver.Tracer.TraceDebug <IExchangePrincipal, string>((long)this.GetHashCode(), "{0}: GetArchiveFolder: The current pathPart in sourceFolderPath is {1}", this.mailboxSession.MailboxOwner, folderTuple4.DisplayName);
                    if (folderTuple.TryGetChild(folderTuple4.DisplayName, out folderTuple3))
                    {
                        FolderArchiver.Tracer.TraceDebug <IExchangePrincipal, string, string>((long)this.GetHashCode(), "{0}: GetArchiveFolder: The current source folder {1} was found in archive. Current folder in archive is {2}.", this.mailboxSession.MailboxOwner, folderTuple4.DisplayName, folderTuple.DisplayName);
                        folderTuple = folderTuple3;
                    }
                    else
                    {
                        FolderArchiver.Tracer.TraceDebug <IExchangePrincipal, string, string>((long)this.GetHashCode(), "{0}: GetArchiveFolder: The current source folder {1} was not found in archive. Current folder in archive is {2}.", this.mailboxSession.MailboxOwner, folderTuple4.DisplayName, folderTuple.DisplayName);
                        folderTuple2 = this.archiveProcessor.CreateAndUpdateFolderInArchive(folderTuple, folderTuple4);
                        if (!this.archiveHierarchy.ContainsKey(folderTuple2.FolderId))
                        {
                            FolderArchiver.Tracer.TraceDebug <IExchangePrincipal, string, string>((long)this.GetHashCode(), "{0}: GetArchiveFolder: The current source folder {1} was not found in archiveHierarchy table. Adding it to table. Id of corresp folder in archive: {2}", this.mailboxSession.MailboxOwner, folderTuple4.DisplayName, folderTuple2.FolderId.ToHexEntryId());
                            this.archiveHierarchy.Add(folderTuple2.FolderId, folderTuple2);
                        }
                        else
                        {
                            FolderArchiver.Tracer.TraceDebug <IExchangePrincipal, string, string>((long)this.GetHashCode(), "{0}: GetArchiveFolder: The current source folder {1} was already present in archiveHierarchy table. Id of corresp folder in archive: {2}", this.mailboxSession.MailboxOwner, folderTuple4.DisplayName, folderTuple2.FolderId.ToHexEntryId());
                            folderTuple2 = this.archiveHierarchy[folderTuple2.FolderId];
                        }
                        folderTuple.AddChild(folderTuple4.DisplayName, folderTuple2);
                        folderTuple = folderTuple2;
                    }
                }
            }
            if (folderTuple2 == null && folderTuple != null)
            {
                return(folderTuple);
            }
            return(folderTuple2);
        }