Exemple #1
0
        public override object ReadObject(XmlReader reader)
        {
            MtomData MtomDataField = null;

            if (IsParentStartElement(reader, false, true))
            {
                MtomDataField = new MtomData();
                reader.Read();
                if (IsChildStartElement(reader, "Data", true, false))
                {
                    reader.Read();
                    if (IsAttribute(reader, "href"))
                    {
                        string contentID;
                        contentID = reader.Value;
                        reader.MoveToElement();
                        reader.ReadStartElement("Include", "http://www.w3.org/2004/08/xop/include");
                        reader.ReadEndElement();
                        MtomDataField.Data = GetBodyPartContent(contentID, BodyParts);
                    }
                    else
                    {
                        MtomDataField.Data = ConvertBase64.FromBase64String(reader.ReadString());
                        reader.ReadEndElement();
                    }
                }
                reader.ReadEndElement();
            }
            return(MtomDataField);
        }
Exemple #2
0
        public override void WriteObject(XmlWriter writer, object graph)
        {
            MtomData MtomDataField = ((MtomData)(graph));

            if (WriteParentElement(writer, true, true, graph))
            {
                if (WriteChildElement(writer, "Data", true, false, MtomDataField.Data))
                {
                    BodyParts.Add(CreateNewBodyPart(MtomDataField.Data, "<1@body>"));
                    writer.WriteStartElement("xop", "Include", "http://www.w3.org/2004/08/xop/include");
                    writer.WriteAttributeString(null, "href", null, "cid:1@body");
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
            }
            return;
        }
Exemple #3
0
 public override object ReadObject(XmlReader reader)
 {
     MtomData MtomDataField = null;
     if (IsParentStartElement(reader, false, true))
     {
         MtomDataField = new MtomData();
         reader.Read();
         if (IsChildStartElement(reader, "Data", true, false))
         {
             reader.Read();
             if (IsAttribute(reader, "href"))
             {
                 string contentID;
                 contentID = reader.Value;
                 reader.MoveToElement();
                 reader.ReadStartElement("Include", "http://www.w3.org/2004/08/xop/include");
                 reader.ReadEndElement();
                 MtomDataField.Data = GetBodyPartContent(contentID, BodyParts);
             }
             else
             {
                 MtomDataField.Data = Convert.FromBase64String(reader.ReadString());
                 reader.ReadEndElement();
             }
         }
         reader.ReadEndElement();
     }
     return MtomDataField;
 }