// Token: 0x0600155B RID: 5467 RVA: 0x0007CE68 File Offset: 0x0007B068
        protected void CopyMessageContents(MessageItem source, MessageItem destination, bool copyOriginalRecipients, Item attachmentItem)
        {
            source.Load();
            string inReplyTo  = destination.InReplyTo;
            string references = destination.References;

            destination.Subject           = ((source.TryGetProperty(ItemSchema.SubjectPrefix) as string) ?? string.Empty) + ((source.TryGetProperty(ItemSchema.NormalizedSubject) as string) ?? string.Empty);
            destination.InReplyTo         = inReplyTo;
            destination.Importance        = source.Importance;
            destination.InternetMessageId = source.InternetMessageId;
            destination.Categories.Clear();
            destination.Categories.AddRange(source.Categories);
            destination.IconIndex = source.IconIndex;
            destination.IsRead    = source.IsRead;
            destination.IsReadReceiptRequested = source.IsReadReceiptRequested;
            destination.References             = references;
            if (copyOriginalRecipients)
            {
                this.originalRecipients = new HashSet <RecipientId>();
                foreach (Recipient recipient in destination.Recipients)
                {
                    this.originalRecipients.Add(recipient.Id);
                }
            }
            destination.Recipients.Clear();
            foreach (Recipient recipient2 in source.Recipients)
            {
                destination.Recipients.Add(recipient2.Participant, recipient2.RecipientItemType);
            }
            if (source.ReplyTo != null)
            {
                foreach (Participant item in source.ReplyTo)
                {
                    destination.ReplyTo.Add(item);
                }
            }
            RightsManagedMessageItem rightsManagedMessageItem = destination as RightsManagedMessageItem;
            AttachmentCollection     attachmentCollection     = (rightsManagedMessageItem != null) ? rightsManagedMessageItem.ProtectedAttachmentCollection : destination.AttachmentCollection;

            if (rightsManagedMessageItem == null && attachmentItem != null)
            {
                throw new InvalidOperationException("attachmentItem must be null for non-IRM messages");
            }
            if (this.ReplaceMime || attachmentItem != null)
            {
                if (rightsManagedMessageItem == null)
                {
                    Body.CopyBody(source, destination, GlobalSettings.DisableCharsetDetectionInCopyMessageContents);
                }
                else
                {
                    using (Stream stream = source.Body.OpenReadStream(new BodyReadConfiguration(source.Body.Format, source.Body.Charset)))
                    {
                        using (Stream stream2 = rightsManagedMessageItem.ProtectedBody.OpenWriteStream(new BodyWriteConfiguration(source.Body.Format, source.Body.Charset)))
                        {
                            Util.StreamHandler.CopyStreamData(stream, stream2);
                        }
                    }
                }
            }
            foreach (AttachmentHandle handle in source.AttachmentCollection)
            {
                using (Attachment attachment = source.AttachmentCollection.Open(handle))
                {
                    int num = 0;
                    if (attachment is StreamAttachment)
                    {
                        num = 1;
                    }
                    else if (attachment is OleAttachment)
                    {
                        num = 2;
                    }
                    if (num > 0)
                    {
                        Microsoft.Exchange.Data.Storage.AttachmentType type = (num == 1) ? Microsoft.Exchange.Data.Storage.AttachmentType.Stream : Microsoft.Exchange.Data.Storage.AttachmentType.Ole;
                        StreamAttachmentBase streamAttachmentBase           = (StreamAttachmentBase)attachment;
                        using (StreamAttachmentBase streamAttachmentBase2 = (StreamAttachmentBase)attachmentCollection.Create(type))
                        {
                            using (Stream contentStream = streamAttachmentBase2.GetContentStream())
                            {
                                using (Stream contentStream2 = streamAttachmentBase.GetContentStream())
                                {
                                    int    num2   = 4096;
                                    byte[] buffer = new byte[num2];
                                    int    count;
                                    while ((count = contentStream2.Read(buffer, 0, num2)) > 0)
                                    {
                                        contentStream.Write(buffer, 0, count);
                                    }
                                    streamAttachmentBase2.ContentType = streamAttachmentBase.ContentType;
                                    streamAttachmentBase2[AttachmentSchema.DisplayName] = streamAttachmentBase.DisplayName;
                                    streamAttachmentBase2.FileName = streamAttachmentBase.FileName;
                                    streamAttachmentBase2[AttachmentSchema.AttachContentId] = streamAttachmentBase[AttachmentSchema.AttachContentId];
                                    streamAttachmentBase2.IsInline = streamAttachmentBase.IsInline;
                                }
                            }
                            streamAttachmentBase2.Save();
                            continue;
                        }
                    }
                    ItemAttachment itemAttachment = (ItemAttachment)attachment;
                    using (Item item2 = itemAttachment.GetItem())
                    {
                        using (ItemAttachment itemAttachment2 = attachmentCollection.AddExistingItem(item2))
                        {
                            itemAttachment2.Save();
                        }
                    }
                }
            }
            if (attachmentItem != null)
            {
                using (ItemAttachment itemAttachment3 = attachmentCollection.AddExistingItem(attachmentItem))
                {
                    itemAttachment3.Save();
                }
            }
        }