// Token: 0x06001001 RID: 4097 RVA: 0x0005B01C File Offset: 0x0005921C protected override void InternalCopyFrom(IProperty srcProperty) { IMIMEDataProperty imimedataProperty = srcProperty as IMIMEDataProperty; if (imimedataProperty == null) { throw new UnexpectedTypeException("IMIMEDataProperty", srcProperty); } if (!BodyUtility.IsAskingForMIMEData(imimedataProperty, base.Options)) { return; } int num = -1; bool flag = false; imimedataProperty.MIMESize = imimedataProperty.MIMEData.Length; if (base.Options.Contains("MIMETruncation")) { num = (int)base.Options["MIMETruncation"]; } if (num >= 0 && (long)num < imimedataProperty.MIMEData.Length) { flag = true; imimedataProperty.MIMESize = (long)num; } base.CreateAirSyncNode("MIMETruncated", flag ? "1" : "0"); if (flag) { imimedataProperty.MIMESize = (long)num; base.CreateAirSyncNode("MIMESize", imimedataProperty.MIMEData.Length.ToString(CultureInfo.InvariantCulture)); } base.CreateAirSyncNode("MIMEData", imimedataProperty.MIMEData, imimedataProperty.MIMESize, XmlNodeType.Text); }
// Token: 0x06000FB9 RID: 4025 RVA: 0x000597D0 File Offset: 0x000579D0 private static List <BodyType> GetPrioritizedBodyTypes(BodyType nativeType) { List <BodyType> list = new List <BodyType>(5); list.Add(nativeType); BodyType item = nativeType; while (BodyUtility.GetLowerBodyType(ref item)) { list.Add(item); } item = nativeType; while (BodyUtility.GetHigherBodyType(ref item)) { list.Add(item); } return(list); }
// Token: 0x060013E0 RID: 5088 RVA: 0x00072734 File Offset: 0x00070934 public IEnumerator <Attachment12Data> GetEnumerator() { Item message = base.XsoItem as Item; Attachment12Data attachmentData = null; if (message == null) { throw new UnexpectedTypeException("Item", base.XsoItem); } MeetingRequest meetingRequest = base.XsoItem as MeetingRequest; if (meetingRequest == null || !meetingRequest.IsDelegated()) { string idbase = null; if (this.idmapping != null) { idbase = this.idmapping[MailboxSyncItemId.CreateForNewItem(message.Id.ObjectId)]; } if (idbase == null) { idbase = message.Id.ObjectId.ToBase64String(); } if (message is MessageItem && ((MessageItem)message).IsRestricted && !BodyConversionUtilities.IsMessageRestrictedAndDecoded(message) && !BodyConversionUtilities.IsIRMFailedToDecode(message)) { object prop = message.TryGetProperty(MessageItemSchema.DRMLicense); if (prop is byte[][]) { byte[][] license = (byte[][])prop; if (license.Length > 0) { attachmentData = new Attachment14Data(); attachmentData.DisplayName = "message.rpmsg.license"; attachmentData.Method = 1; attachmentData.EstimatedDataSize = (long)license[0].Length; attachmentData.IsInline = false; attachmentData.FileReference = HttpUtility.UrlEncode(idbase + ":DRMLicense"); AirSyncDiagnostics.TraceDebug(ExTraceGlobals.XsoTracer, this, "Add DRM license as attachment, message is MessageItem {0}, message.IsRestricted {1}, IsDecoded {2}, FailedToDecode {3}", new object[] { message is MessageItem, ((MessageItem)message).IsRestricted, BodyConversionUtilities.IsMessageRestrictedAndDecoded(message), BodyConversionUtilities.IsIRMFailedToDecode(message) }); yield return(attachmentData); } else { AirSyncDiagnostics.TraceDebug <int>(ExTraceGlobals.XsoTracer, this, "The license property on the DRM message is incorrect. Length = {0}", license.Length); } } else { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.XsoTracer, this, "The license property on the DRM message is incorrect. prop = {0}", new object[] { prop }); } } AttachmentCollection attachmentCollection = null; if (BodyConversionUtilities.IsMessageRestrictedAndDecoded(message)) { attachmentCollection = ((RightsManagedMessageItem)message).ProtectedAttachmentCollection; } else { if (BodyConversionUtilities.IsIRMFailedToDecode(message)) { goto IL_3FC; } attachmentCollection = message.AttachmentCollection; } int index = -1; foreach (AttachmentHandle handle in attachmentCollection) { using (Attachment attachment = attachmentCollection.Open(handle)) { if (BodyUtility.IsClearSigned(message) && (string.Equals(attachment.FileName, "smime.p7m", StringComparison.OrdinalIgnoreCase) || string.Equals(attachment.ContentType, "multipart/signed", StringComparison.OrdinalIgnoreCase))) { continue; } attachmentData = this.GetAttachmentData(message, attachment, idbase, ref index); } if (attachmentData != null) { yield return(attachmentData); } } } IL_3FC: yield break; }
// Token: 0x060013EF RID: 5103 RVA: 0x00073204 File Offset: 0x00071404 public IEnumerator <AttachmentData> GetEnumerator() { Item message = base.XsoItem as Item; if (message == null) { throw new UnexpectedTypeException("Item", base.XsoItem); } string baseId = null; if (this.idmapping != null) { baseId = this.idmapping[MailboxSyncItemId.CreateForNewItem(message.Id.ObjectId)]; } if (baseId == null) { baseId = message.Id.ObjectId.ToBase64String(); } if (base.XsoItem is MessageItem && ((MessageItem)message).IsRestricted) { object prop = message.TryGetProperty(MessageItemSchema.DRMLicense); if (prop is byte[][]) { byte[][] license = (byte[][])prop; if (license.Length > 0) { yield return(new AttachmentData { AttMethod = 1, AttSize = (long)license[0].Length, DisplayName = "message.rpmsg.license", AttName = HttpUtility.UrlEncode(baseId + ":DRMLicense") }); } else { AirSyncDiagnostics.TraceDebug <int>(ExTraceGlobals.XsoTracer, this, "The license property on the DRM message is incorrect. Length = {0}", license.Length); } } else { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.XsoTracer, this, "Failed to fetch the license property on the DRM message. Prop = {0}", new object[] { prop }); } } int index = -1; foreach (AttachmentHandle handle in message.AttachmentCollection) { index++; AttachmentData attachmentData = default(AttachmentData); Attachment attachment = null; try { attachment = message.AttachmentCollection.Open(handle); if (BodyUtility.IsClearSigned(message) && (string.Compare(attachment.FileName, "smime.p7m", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(attachment.ContentType, "multipart/signed", StringComparison.OrdinalIgnoreCase) == 0)) { continue; } attachmentData.AttName = HttpUtility.UrlEncode(baseId + ":" + index); if (string.IsNullOrEmpty(attachmentData.DisplayName)) { if (!string.IsNullOrEmpty(attachment.FileName)) { attachmentData.DisplayName = attachment.FileName; } else if (attachment.AttachmentType == AttachmentType.EmbeddedMessage) { using (Item itemAsReadOnly = ((ItemAttachment)attachment).GetItemAsReadOnly(null)) { attachmentData.DisplayName = (itemAsReadOnly.TryGetProperty(ItemSchema.Subject) as string); } } } if (string.IsNullOrEmpty(attachmentData.DisplayName)) { attachmentData.DisplayName = "????"; } attachmentData.AttMethod = (int)attachment.TryGetProperty(AttachmentSchema.AttachMethod); attachmentData.AttSize = attachment.Size; } finally { if (attachment != null) { attachment.Dispose(); attachment = null; } } yield return(attachmentData); } yield break; }
// Token: 0x06000FB5 RID: 4021 RVA: 0x00059390 File Offset: 0x00057590 protected override void InternalCopyFrom(IProperty sourceProperty) { IContentProperty contentProperty = sourceProperty as IContentProperty; if (contentProperty == null) { throw new UnexpectedTypeException("IContentProperty", sourceProperty); } contentProperty.PreProcessProperty(); try { long num = 0L; bool flag; long num3; if (BodyUtility.IsAskingForMIMEData(contentProperty, base.Options) && this.IsAcceptable(BodyType.Mime, out num, out flag)) { int num2 = -1; this.bodyType = BodyType.Mime; this.MIMEData = contentProperty.MIMEData; if (base.Options.Contains("MIMETruncation")) { num2 = (int)base.Options["MIMETruncation"]; } if (num2 >= 0 && (long)num2 < this.MIMEData.Length) { this.Truncated = true; this.MIMESize = (long)num2; } else { this.Truncated = false; this.MIMESize = this.MIMEData.Length; } num3 = contentProperty.MIMEData.Length; } else { this.bodyType = contentProperty.GetNativeType(); if (this.bodyType == BodyType.None) { return; } num3 = contentProperty.Size; foreach (BodyType bodyType in AirSyncContentProperty.GetPrioritizedBodyTypes(this.bodyType)) { try { long num4; if (this.ClientAccepts(contentProperty, bodyType, out num4, out num)) { this.bodyType = bodyType; num3 = num4; break; } } catch (ObjectNotFoundException arg) { AirSyncDiagnostics.TraceInfo <BodyType, ObjectNotFoundException>(ExTraceGlobals.AirSyncTracer, this, "ClientAccepts({0}) has thrown {1}", bodyType, arg); num3 = 0L; this.bodyType = BodyType.None; } } } if (contentProperty.IsIrmErrorMessage) { this.Truncated = true; } base.XmlNode = base.XmlParentNode.OwnerDocument.CreateElement(base.AirSyncTagNames[0], base.Namespace); base.XmlParentNode.AppendChild(base.XmlNode); XmlNode xmlNode = base.XmlNode; string elementName = "Type"; int num5 = (int)this.bodyType; base.AppendChildNode(xmlNode, elementName, num5.ToString(CultureInfo.InvariantCulture)); base.AppendChildNode(base.XmlNode, "EstimatedDataSize", num3.ToString(CultureInfo.InvariantCulture)); if (this.Truncated) { base.AppendChildNode(base.XmlNode, "Truncated", "1"); } this.CopyData(); } finally { contentProperty.PostProcessProperty(); } }
protected override void InternalCopyFrom(IProperty srcProperty) { IBodyProperty bodyProperty = srcProperty as IBodyProperty; if (bodyProperty == null) { throw new UnexpectedTypeException("IBodyProperty", bodyProperty); } if (BodyUtility.IsAskingForMIMEData(bodyProperty, base.Options)) { return; } bool flag = false; bool flag2 = false; int num = 0; bool flag3 = false; this.cachedRtfNode = null; if (base.Options != null) { if (base.Options.Contains("ClientSupportsRtf")) { flag = (bool)base.Options["ClientSupportsRtf"]; } if (base.Options.Contains("MaxTextBodySize")) { flag2 = true; num = (int)base.Options["MaxTextBodySize"]; } if (base.Options.Contains("MaxRtfBodySize") && bodyProperty.RtfPresent) { int num2 = (int)base.Options["MaxRtfBodySize"]; flag3 = (bodyProperty.RtfSize > (num2 / 3 + 1) * 4); } } if (flag && this.rtfBodyTag != null && bodyProperty.RtfPresent && !flag3) { AirSyncStream airSyncStream = bodyProperty.RtfData as AirSyncStream; if (airSyncStream == null || airSyncStream.Length == 0L) { return; } airSyncStream.DoBase64Conversion = true; if (flag2) { base.CreateAirSyncNode(this.bodyTruncatedTag, "0"); } XmlNode xmlNode = base.AppendChildNode(base.XmlParentNode, this.rtfBodyTag, airSyncStream, -1L, XmlNodeType.Text); if (this.cacheRtf) { this.cachedRtfNode = xmlNode; return; } } else { if (!bodyProperty.TextPresent) { return; } if (!flag2 || bodyProperty.TextSize <= num) { Stream textData = bodyProperty.TextData; if (bodyProperty.TextSize == 0) { return; } if (!this.writeBodyTruncatedLast && this.forceBodyTruncatedTag) { base.CreateAirSyncNode(this.bodyTruncatedTag, "0"); } base.AppendChildNode(base.XmlParentNode, this.textBodyTag, textData, -1L, XmlNodeType.Text); if (this.writeBodyTruncatedLast && this.forceBodyTruncatedTag) { base.CreateAirSyncNode(this.bodyTruncatedTag, "0"); return; } } else { Stream textData2 = bodyProperty.GetTextData(num); if (bodyProperty.TextSize == 0) { return; } if (!this.writeBodyTruncatedLast) { base.CreateAirSyncNode(this.bodyTruncatedTag, "1"); } if (this.bodySizeTag != null) { base.CreateAirSyncNode(this.bodySizeTag, bodyProperty.TextSize.ToString(CultureInfo.InvariantCulture)); } base.AppendChildNode(base.XmlParentNode, this.textBodyTag, textData2, -1L, XmlNodeType.Text); if (this.writeBodyTruncatedLast) { base.CreateAirSyncNode(this.bodyTruncatedTag, "1"); } } } }