public override string ToString()
 {
     return(string.Concat(new object[]
     {
         "SharingMessageType = ",
         this.SharingMessageType,
         ",InitiatorName = ",
         this.InitiatorName,
         ",InitiatorSmtpAddress = ",
         this.InitiatorSmtpAddress,
         ",InitiatorEntryId = ",
         (this.InitiatorEntryId == null) ? string.Empty : HexConverter.ByteArrayToHexString(this.InitiatorEntryId),
         ",FolderClass = ",
         this.FolderClass,
         ",FolderName = ",
         this.FolderName,
         ",FolderEwsId = ",
         this.FolderEwsId,
         ",FolderId = ",
         (this.FolderId == null) ? string.Empty : this.FolderId.ToHexEntryId(),
         ",MailboxId = ",
         (this.MailboxId == null) ? string.Empty : HexConverter.ByteArrayToHexString(this.MailboxId),
         ",SharingCapabilities = ",
         this.SharingCapabilities,
         ",SharingFlavor = ",
         this.SharingFlavor,
         ",SharingPermissions = ",
         this.SharingPermissions,
         ",SharingDetail = ",
         this.SharingDetail,
         ",EncryptedSharedFolderDataCollection = ",
         this.EncryptedSharedFolderDataCollection
     }));
 }
Beispiel #2
0
 private static object GetTraceValue(object value)
 {
     if (value == null)
     {
         return(null);
     }
     if (value.GetType() == typeof(string))
     {
         string text = (string)value;
         if (text.Length > 256)
         {
             StringBuilder stringBuilder = new StringBuilder(text, 0, 256, 259);
             stringBuilder.Append("...");
             return(stringBuilder.ToString());
         }
     }
     else if (value.GetType() == typeof(byte[]))
     {
         byte[]        array          = (byte[])value;
         int           num            = Math.Min(array.Length, 256);
         StringBuilder stringBuilder2 = new StringBuilder(num * 2 + 2);
         stringBuilder2.Append('[');
         stringBuilder2.Append(HexConverter.ByteArrayToHexString(array, 0, num));
         stringBuilder2.Append(']');
         return(stringBuilder2.ToString());
     }
     return(value);
 }
 internal override void ParseSharingMessageProvider(SharingContext context, SharingMessageProvider sharingMessageProvider)
 {
     if (!AddressBookEntryId.IsAddressBookEntryId(context.InitiatorEntryId))
     {
         ExTraceGlobals.SharingTracer.TraceError <string>((long)this.GetHashCode(), "{0}: InitiatorEntryId is invalid.", context.UserLegacyDN);
         throw new InvalidSharingDataException("InitiatorEntryId", HexConverter.ByteArrayToHexString(context.InitiatorEntryId));
     }
     if (!string.IsNullOrEmpty(sharingMessageProvider.FolderId))
     {
         try
         {
             context.FolderId = StoreObjectId.FromHexEntryId(sharingMessageProvider.FolderId, ObjectClass.GetObjectType(context.FolderClass));
         }
         catch (CorruptDataException)
         {
             ExTraceGlobals.SharingTracer.TraceError <string, string>((long)this.GetHashCode(), "{0}: FolderId is invalid: {1}", context.UserLegacyDN, sharingMessageProvider.FolderId);
             throw new InvalidSharingDataException("FolderId", sharingMessageProvider.FolderId);
         }
     }
     if (!string.IsNullOrEmpty(sharingMessageProvider.MailboxId))
     {
         byte[] array = HexConverter.HexStringToByteArray(sharingMessageProvider.MailboxId);
         if (StoreEntryId.TryParseStoreEntryIdMailboxDN(array) == null)
         {
             ExTraceGlobals.SharingTracer.TraceError <string, string>((long)this.GetHashCode(), "{0}: MailboxId is invalid: {1}", context.UserLegacyDN, sharingMessageProvider.MailboxId);
             throw new InvalidSharingDataException("MailboxId", sharingMessageProvider.MailboxId);
         }
         context.MailboxId = array;
     }
 }
Beispiel #4
0
 public void LogFolderCreated(byte[] entryId)
 {
     if (this.folderOperationCount.Added < 10)
     {
         base.LogEvent(LogEventType.Verbose, HexConverter.ByteArrayToHexString(entryId) + " is added");
     }
     this.folderOperationCount.Added++;
 }
Beispiel #5
0
 private SharingMessageInitiator CreateInitiator()
 {
     return(new SharingMessageInitiator
     {
         Name = this.context.InitiatorName,
         SmtpAddress = this.context.InitiatorSmtpAddress,
         EntryId = HexConverter.ByteArrayToHexString(this.context.InitiatorEntryId)
     });
 }
 public override string ToString()
 {
     return(string.Concat(new object[]
     {
         base.ToString(),
         ", RemoteFolderId=",
         this.RemoteFolderId,
         ", RemoteMailboxId=",
         HexConverter.ByteArrayToHexString(this.RemoteMailboxId)
     }));
 }
Beispiel #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);
 }
Beispiel #8
0
 private void CheckFolderRestorePossible(Guid sourceMailboxGuid)
 {
     base.EnumerateFolderHierarchy(EnumHierarchyFlags.AllFolders, delegate(FolderRecWrapper fRec, FolderMap.EnumFolderContext ctx)
     {
         FolderMapping folderMapping = (FolderMapping)fRec;
         if ((folderMapping.Flags & FolderMappingFlags.Include) != FolderMappingFlags.None || (folderMapping.Flags & FolderMappingFlags.InheritedInclude) != FolderMappingFlags.None)
         {
             byte[] array = (byte[])folderMapping.FolderRec[PropTag.ReplicaList];
             if (array != null)
             {
                 string[] stringArrayFromBytes = ReplicaListProperty.GetStringArrayFromBytes(array);
                 Guid empty = Guid.Empty;
                 if (stringArrayFromBytes.Length > 0 && GuidHelper.TryParseGuid(stringArrayFromBytes[0], out empty) && empty == sourceMailboxGuid)
                 {
                     throw new FolderIsLivePermanentException(HexConverter.ByteArrayToHexString(folderMapping.EntryId));
                 }
             }
         }
     });
 }
Beispiel #9
0
 internal static string CreateContentId(ICoreItem containerItem, AttachmentId id, string domain)
 {
     byte[] array;
     if (containerItem != null && containerItem.Session != null && containerItem.Id != null && id != null)
     {
         array = Util.MergeArrays <byte>(new ICollection <byte>[]
         {
             containerItem.Id.GetBytes(),
             id.ToByteArray()
         });
         array = CryptoUtil.GetSha1Hash(array);
     }
     else
     {
         array = Guid.NewGuid().ToByteArray();
     }
     if (!string.IsNullOrEmpty(domain))
     {
         return(string.Format("{0}@{1}", HexConverter.ByteArrayToHexString(array), domain));
     }
     return(string.Format("{0}@1", HexConverter.ByteArrayToHexString(array)));
 }
Beispiel #10
0
        internal void SaveIntoMessageXProperties(MessageItem messageItem, bool isClear)
        {
            SharingProvider sharingProviderPublish = SharingProvider.SharingProviderPublish;

            messageItem.SetOrDeleteProperty(InternalSchema.XSharingProviderGuid, isClear ? null : HexConverter.ByteArrayToHexString(sharingProviderPublish.Guid.ToByteArray()));
            messageItem.SetOrDeleteProperty(InternalSchema.XSharingProviderName, isClear ? null : sharingProviderPublish.Name);
            messageItem.SetOrDeleteProperty(InternalSchema.XSharingProviderUrl, isClear ? null : sharingProviderPublish.Url);
            messageItem.SetOrDeleteProperty(InternalSchema.XSharingCapabilities, isClear ? null : string.Format("{0:X}", 521));
            messageItem.SetOrDeleteProperty(InternalSchema.XSharingFlavor, isClear ? null : string.Format("{0:X}", 784));
            messageItem.SetOrDeleteProperty(InternalSchema.XSharingRemoteType, isClear ? null : this.context.DataType.PublishName);
            messageItem.SetOrDeleteProperty(InternalSchema.XSharingLocalType, isClear ? null : this.context.FolderClass);
            messageItem.SetOrDeleteProperty(InternalSchema.XSharingRemoteName, isClear ? null : this.context.FolderName);
            messageItem.SetOrDeleteProperty(InternalSchema.XSharingBrowseUrl, isClear ? null : this.context.BrowseUrl.ToString());
            messageItem.SetOrDeleteProperty(InternalSchema.XSharingRemotePath, isClear ? null : this.context.ICalUrl.ToString());
            messageItem.SetOrDeleteProperty(InternalSchema.XSharingInstanceGuid, isClear ? null : HexConverter.ByteArrayToHexString(Guid.NewGuid().ToByteArray()));
        }
Beispiel #11
0
        internal void SaveIntoMessageProperties(MessageItem messageItem, bool isClear)
        {
            SharingProvider primarySharingProvider = this.context.PrimarySharingProvider;

            messageItem.SetOrDeleteProperty(InternalSchema.ProviderGuidBinary, isClear ? null : primarySharingProvider.Guid.ToByteArray());
            messageItem.SetOrDeleteProperty(InternalSchema.SharingProviderName, isClear ? null : primarySharingProvider.Name);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingProviderUrl, isClear ? null : primarySharingProvider.Url);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingCapabilities, isClear ? null : this.context.SharingCapabilities);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingFlavor, isClear ? null : this.context.SharingFlavor);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingRemoteType, isClear ? null : this.context.FolderClass);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingLocalType, isClear ? null : this.context.FolderClass);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingRemoteName, isClear ? null : this.context.FolderName);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingLocalName, isClear ? null : this.context.FolderName);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingRemoteUid, isClear ? null : this.context.FolderId.ToHexEntryId());
            messageItem.SetOrDeleteProperty(InternalSchema.SharingLocalUid, isClear ? null : this.context.FolderId.ToHexEntryId());
            messageItem.SetOrDeleteProperty(InternalSchema.SharingRemoteStoreUid, isClear ? null : HexConverter.ByteArrayToHexString(this.context.MailboxId));
            messageItem.SetOrDeleteProperty(InternalSchema.SharingLocalStoreUid, isClear ? null : HexConverter.ByteArrayToHexString(this.context.MailboxId));
            messageItem.SetOrDeleteProperty(InternalSchema.SharingInitiatorName, isClear ? null : this.context.InitiatorName);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingInitiatorSmtp, isClear ? null : this.context.InitiatorSmtpAddress);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingInitiatorEntryId, isClear ? null : this.context.InitiatorEntryId);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingPermissions, isClear ? null : this.context.SharingPermissions);
            messageItem.SetOrDeleteProperty(InternalSchema.SharingDetail, isClear ? null : this.context.SharingDetail);
        }
Beispiel #12
0
 public static string StringFromWkGuid(Guid wkGuid, string containerDN)
 {
     return(string.Format("<WKGUID={0},{1}>", HexConverter.ByteArrayToHexString(wkGuid.ToByteArray()), containerDN));
 }
Beispiel #13
0
 public static string FormatLegacyDnFromGuid(Guid namingContext, Guid guid)
 {
     return("/o=NT5/ou=" + HexConverter.ByteArrayToHexString(namingContext.ToByteArray()) + "/cn=" + HexConverter.ByteArrayToHexString(guid.ToByteArray()));
 }
        protected override void CatchupFolderHierarchy()
        {
            if (!this.PrimaryHierarchyMbxWrapper.Mailbox.IsConnected())
            {
                this.PrimaryHierarchyMbxWrapper.Mailbox.Connect(MailboxConnectFlags.None);
            }
            bool flag  = false;
            bool flag2 = false;
            Guid hierarchyMailboxGuid = this.publicFolderConfiguration.GetHierarchyMailboxInformation().HierarchyMailboxGuid;

            if (hierarchyMailboxGuid == base.CachedRequestJob.SourceExchangeGuid)
            {
                flag = true;
            }
            else if (hierarchyMailboxGuid == base.CachedRequestJob.TargetExchangeGuid)
            {
                flag2 = true;
            }
            foreach (byte[] array in this.foldersToMove)
            {
                if (flag)
                {
                    using (IFolder folder = ((ISourceMailbox)this.PrimaryHierarchyMbxWrapper.Mailbox).GetFolder(array))
                    {
                        using (IDestinationFolder folder2 = this.publicFolderMover.DestMailbox.GetFolder(this.publicFolderMover.DestMailbox.GetSessionSpecificEntryId(array)))
                        {
                            if (folder2 == null)
                            {
                                if (folder != null)
                                {
                                    MrsTracer.Service.Error("Inconsistency of hierarchy seen at target mailbox...May be a delay in hierarchy synchronization", new object[0]);
                                    throw new DestinationFolderHierarchyInconsistentTransientException();
                                }
                                MrsTracer.Service.Debug("Folder {0} unavailable at both source and destination mailbox during catchup", new object[]
                                {
                                    HexConverter.ByteArrayToHexString(array)
                                });
                            }
                        }
                        continue;
                    }
                }
                if (flag2)
                {
                    using (IFolder folder3 = ((IDestinationMailbox)this.PrimaryHierarchyMbxWrapper.Mailbox).GetFolder(array))
                    {
                        using (ISourceFolder folder4 = this.publicFolderMover.SourceMailbox.GetFolder(this.publicFolderMover.SourceMailbox.GetSessionSpecificEntryId(array)))
                        {
                            if (folder4 == null)
                            {
                                if (folder3 != null)
                                {
                                    MrsTracer.Service.Error("Inconsistency of hierarchy seen at source mailbox...May be a delay in hierarchy synchronization", new object[0]);
                                    throw new SourceFolderHierarchyInconsistentTransientException();
                                }
                                MrsTracer.Service.Debug("Folder {0} unavailable at both source and destination mailbox during catchup", new object[]
                                {
                                    HexConverter.ByteArrayToHexString(array)
                                });
                            }
                        }
                        continue;
                    }
                }
                using (IFolder folder5 = ((IDestinationMailbox)this.PrimaryHierarchyMbxWrapper.Mailbox).GetFolder(array))
                {
                    if (folder5 == null)
                    {
                        MrsTracer.Service.Debug("Folder {0} unavailable at hierarchy mailbox during catchup", new object[]
                        {
                            HexConverter.ByteArrayToHexString(array)
                        });
                    }
                    else
                    {
                        using (ISourceFolder folder6 = this.publicFolderMover.SourceMailbox.GetFolder(this.publicFolderMover.SourceMailbox.GetSessionSpecificEntryId(array)))
                        {
                            if (folder6 == null)
                            {
                                MrsTracer.Service.Error("Inconsistency of hierarchy seen at source mailbox...May be a delay in hierarchy synchronization", new object[0]);
                                throw new SourceFolderHierarchyInconsistentTransientException();
                            }
                        }
                        using (IDestinationFolder folder7 = this.publicFolderMover.DestMailbox.GetFolder(this.publicFolderMover.DestMailbox.GetSessionSpecificEntryId(array)))
                        {
                            if (folder7 == null)
                            {
                                MrsTracer.Service.Error("Inconsistency of hierarchy seen at target mailbox...May be a delay in hierarchy synchronization", new object[0]);
                                throw new DestinationFolderHierarchyInconsistentTransientException();
                            }
                        }
                    }
                }
            }
            base.SyncStage                = SyncStage.CreatingInitialSyncCheckpoint;
            base.OverallProgress          = 15;
            base.TimeTracker.CurrentState = RequestState.CreatingInitialSyncCheckpoint;
            base.SaveState(SaveStateFlags.Regular, delegate(TransactionalRequestJob moveRequest)
            {
                moveRequest.RestartFromScratch = false;
            });
            base.ScheduleWorkItem(new Action(base.CatchupFolders), WorkloadType.Unknown);
        }
 // Token: 0x060050C6 RID: 20678 RVA: 0x0012B948 File Offset: 0x00129B48
 internal static object MarshalAttribute(ADPropertyDefinition property, object value)
 {
     if (property == null)
     {
         throw new ArgumentNullException("property");
     }
     if (value == null)
     {
         return(null);
     }
     object[] array;
     if (!property.IsMultivalued)
     {
         array    = new object[2];
         array[0] = property.LdapDisplayName;
         if (property.IsBinary)
         {
             byte[] array2 = ADValueConvertor.ConvertValueToBinary(value, property.FormatProvider);
             array[1] = HexConverter.ByteArrayToHexString(array2);
         }
         else
         {
             ADObjectId adobjectId = value as ADObjectId;
             if (adobjectId != null)
             {
                 array[1] = adobjectId.ToDNString();
             }
             else
             {
                 array[1] = ADValueConvertor.ConvertValueToString(value, property.FormatProvider);
             }
         }
     }
     else
     {
         int         num        = 0;
         ArrayList   arrayList  = new ArrayList();
         IEnumerable enumerable = (IEnumerable)value;
         foreach (object obj in enumerable)
         {
             if (property.IsBinary)
             {
                 byte[] array3 = ADValueConvertor.ConvertValueToBinary(obj, property.FormatProvider);
                 arrayList.Add(HexConverter.ByteArrayToHexString(array3));
             }
             else
             {
                 ADObjectId adobjectId2 = obj as ADObjectId;
                 string     value2;
                 if (adobjectId2 != null)
                 {
                     value2 = adobjectId2.ToDNString();
                 }
                 else
                 {
                     value2 = ADValueConvertor.ConvertValueToString(obj, property.FormatProvider);
                 }
                 arrayList.Add(value2);
             }
             num++;
         }
         if (num == 0)
         {
             return(null);
         }
         array    = new object[num + 1];
         array[0] = property.LdapDisplayName;
         arrayList.CopyTo(array, 1);
     }
     return(array);
 }
Beispiel #16
0
 public static string FormatAddressListDN(Guid guid)
 {
     return("/guid=" + HexConverter.ByteArrayToHexString(guid.ToByteArray()));
 }
Beispiel #17
0
        private Guid LinkMailPublicFolder(LinkMailPublicFolderFlags flags, byte[] objectId, Guid contentMailboxGuid, byte[] sourceFolderEntryId)
        {
            Guid result = Guid.Empty;

            try
            {
                ADObjectId contentMailbox = null;
                if (!this.mailboxToADObjectIdMap.TryGetValue(contentMailboxGuid, out contentMailbox))
                {
                    ADUser aduser = this.orgRecipientSession.FindByExchangeGuid(contentMailboxGuid) as ADUser;
                    if (aduser == null)
                    {
                        throw new RecipientNotFoundPermanentException(contentMailboxGuid);
                    }
                    this.mailboxToADObjectIdMap[contentMailboxGuid] = aduser.Id;
                    contentMailbox = aduser.Id;
                }
                ADPublicFolder adpublicFolder = null;
                switch (flags)
                {
                case LinkMailPublicFolderFlags.ObjectGuid:
                    adpublicFolder = (this.orgRecipientSession.Read(new ADObjectId(objectId)) as ADPublicFolder);
                    if (adpublicFolder == null)
                    {
                        base.Report.Append(new ReportEntry(MrsStrings.MoveRequestMessageWarning(MrsStrings.MailPublicFolderWithObjectIdNotFound(new Guid(objectId)))));
                    }
                    break;

                case LinkMailPublicFolderFlags.EntryId:
                {
                    string        text  = PublicFolderSession.ConvertToLegacyDN("e71f13d1-0178-42a7-8c47-24206de84a77", HexConverter.ByteArrayToHexString(objectId));
                    ADRecipient[] array = this.orgRecipientSession.Find(null, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.LegacyExchangeDN, text), null, 2);
                    if (array.Length == 1)
                    {
                        adpublicFolder = (array[0] as ADPublicFolder);
                    }
                    else if (array.Length > 1)
                    {
                        base.Report.Append(new ReportEntry(MrsStrings.MoveRequestMessageWarning(MrsStrings.MailPublicFolderWithMultipleEntriesFound(text))));
                    }
                    else
                    {
                        base.Report.Append(new ReportEntry(MrsStrings.MoveRequestMessageWarning(MrsStrings.MailPublicFolderWithLegacyExchangeDnNotFound(text))));
                    }
                    break;
                }

                default:
                    throw new UnexpectedErrorPermanentException(-2147024809);
                }
                if (adpublicFolder != null)
                {
                    adpublicFolder.ContentMailbox = contentMailbox;
                    adpublicFolder.EntryId        = HexConverter.ByteArrayToHexString(base.DestMailbox.GetSessionSpecificEntryId(sourceFolderEntryId));
                    this.orgRecipientSession.Save(adpublicFolder);
                    result = adpublicFolder.Guid;
                }
            }
            catch (LocalizedException ex)
            {
                base.Report.Append(new ReportEntry(new LocalizedString(ex.Message)));
                throw;
            }
            return(result);
        }
Beispiel #18
0
        public override string ToString()
        {
            string arg = HexConverter.ByteArrayToHexString(this.binary);

            return(string.Format("B:{0}:{1}:{2}", this.binary.Length * 2, arg, this.dn));
        }
Beispiel #19
0
 internal override void FillSharingMessageProvider(SharingContext context, SharingMessageProvider sharingMessageProvider)
 {
     sharingMessageProvider.FolderId  = context.FolderEwsId;
     sharingMessageProvider.MailboxId = HexConverter.ByteArrayToHexString(context.MailboxId);
 }
        protected override void CatchupFolderHierarchy()
        {
            if (!this.PrimaryHierarchyMbxWrapper.Mailbox.IsConnected())
            {
                this.PrimaryHierarchyMbxWrapper.Mailbox.Connect(MailboxConnectFlags.None);
            }
            FolderRecDataFlags folderRecDataFlags = FolderRecDataFlags.SearchCriteria;

            if (!base.CachedRequestJob.SkipFolderPromotedProperties)
            {
                folderRecDataFlags |= FolderRecDataFlags.PromotedProperties;
            }
            if (!base.CachedRequestJob.SkipFolderViews)
            {
                folderRecDataFlags |= FolderRecDataFlags.Views;
            }
            if (!base.CachedRequestJob.SkipFolderRestrictions)
            {
                folderRecDataFlags |= FolderRecDataFlags.Restrictions;
            }
            List <WellKnownFolder> list = this.folderMover.SourceMailbox.DiscoverWellKnownFolders(0);
            List <WellKnownFolder> destinationWellKnownFolders = this.folderMover.DestMailbox.DiscoverWellKnownFolders(0);

            foreach (byte[] array in this.foldersToMove)
            {
                using (IFolder folder = ((ISourceMailbox)this.PrimaryHierarchyMbxWrapper.Mailbox).GetFolder(array))
                {
                    using (IDestinationFolder folder2 = this.folderMover.DestMailbox.GetFolder(this.folderMover.DestMailbox.GetSessionSpecificEntryId(array)))
                    {
                        if (folder2 == null)
                        {
                            if (folder == null)
                            {
                                MrsTracer.Service.Debug("Folder {0} unavailable at both source and destination mailbox during catchup", new object[]
                                {
                                    HexConverter.ByteArrayToHexString(array)
                                });
                            }
                            else
                            {
                                List <FolderRecWrapper> list2 = new List <FolderRecWrapper>();
                                byte[] entryId = array;
                                for (;;)
                                {
                                    using (ISourceFolder folder3 = this.folderMover.SourceMailbox.GetFolder(entryId))
                                    {
                                        if (folder3 != null)
                                        {
                                            FolderRecWrapper folderRecWrapper = new FolderRecWrapper(folder3.GetFolderRec(null, GetFolderRecFlags.None));
                                            if (folderRecWrapper.ParentId != null)
                                            {
                                                list2.Insert(0, folderRecWrapper);
                                                bool flag = false;
                                                foreach (WellKnownFolder wellKnownFolder in list)
                                                {
                                                    if (CommonUtils.IsSameEntryId(wellKnownFolder.EntryId, folderRecWrapper.ParentId))
                                                    {
                                                        flag = true;
                                                        break;
                                                    }
                                                }
                                                if (!flag)
                                                {
                                                    entryId = folderRecWrapper.ParentId;
                                                    continue;
                                                }
                                            }
                                        }
                                    }
                                    break;
                                }
                                foreach (FolderRecWrapper folderRecWrapper2 in list2)
                                {
                                    byte[] entryId2 = folderRecWrapper2.FolderRec.EntryId;
                                    byte[] parentId = folderRecWrapper2.FolderRec.ParentId;
                                    byte[] sessionSpecificEntryId = this.folderMover.DestMailbox.GetSessionSpecificEntryId(entryId2);
                                    bool   flag2 = false;
                                    byte[] destinationFolderIdFromSourceFolderId = AuxFolderMoveJob.GetDestinationFolderIdFromSourceFolderId(list, destinationWellKnownFolders, this.folderMover.DestMailbox, parentId, out flag2);
                                    using (IDestinationFolder folder4 = this.folderMover.DestMailbox.GetFolder(sessionSpecificEntryId))
                                    {
                                        if (folder4 == null)
                                        {
                                            using (ISourceFolder folder5 = this.folderMover.SourceMailbox.GetFolder(entryId2))
                                            {
                                                if (folder5 == null)
                                                {
                                                    MrsTracer.Service.Warning("Source folder '{0}' {1} disappeared, skipping", new object[]
                                                    {
                                                        folderRecWrapper2.FolderName,
                                                        folderRecWrapper2.EntryId
                                                    });
                                                    break;
                                                }
                                                folderRecWrapper2.EnsureDataLoaded(folder5, folderRecDataFlags, this.folderMover);
                                                this.folderMover.TranslateFolderData(folderRecWrapper2);
                                                CreateFolderFlags createFolderFlags = CreateFolderFlags.None;
                                                folderRecWrapper2.FolderRec.EntryId  = sessionSpecificEntryId;
                                                folderRecWrapper2.FolderRec.ParentId = destinationFolderIdFromSourceFolderId;
                                                byte[] array2;
                                                this.folderMover.CreateFolder(null, folderRecWrapper2, createFolderFlags, out array2);
                                                folderRecWrapper2.FolderRec.EntryId  = entryId2;
                                                folderRecWrapper2.FolderRec.ParentId = parentId;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            base.SyncStage                = SyncStage.CreatingInitialSyncCheckpoint;
            base.OverallProgress          = 15;
            base.TimeTracker.CurrentState = RequestState.CreatingInitialSyncCheckpoint;
            base.SaveState(SaveStateFlags.Regular, delegate(TransactionalRequestJob moveRequest)
            {
                moveRequest.RestartFromScratch = false;
            });
            base.ScheduleWorkItem(new Action(base.CatchupFolders), WorkloadType.Unknown);
        }
Beispiel #21
0
 public string ToHexEntryId()
 {
     return(HexConverter.ByteArrayToHexString(this.EntryId));
 }