コード例 #1
0
        internal static SerializeableAttachment GetSerializeableAttachment(Attachment att)
        {
            if (att == null)
            {
                return(null);
            }

            var saa = new SerializeableAttachment();

            saa._contentId          = att.ContentId;
            saa._contentDisposition =
                SerializeableContentDisposition.GetSerializeableContentDisposition(att.ContentDisposition);

            if (att.ContentStream != null)
            {
                var bytes = new byte[att.ContentStream.Length];
                att.ContentStream.Read(bytes, 0, bytes.Length);

                saa._contentStream = new MemoryStream(bytes);
            }

            saa._contentType      = SerializeableContentType.GetSerializeableContentType(att.ContentType);
            saa._name             = att.Name;
            saa._transferEncoding = att.TransferEncoding;
            saa._nameEncoding     = att.NameEncoding;
            return(saa);
        }
コード例 #2
0
        internal static SerializeableAlternateView GetSerializeableAlternateView(AlternateView av)
        {
            if (av == null)
            {
                return(null);
            }

            var sav = new SerializeableAlternateView();

            sav._baseUri   = av.BaseUri;
            sav._contentId = av.ContentId;

            if (av.ContentStream != null)
            {
                var bytes = new byte[av.ContentStream.Length];
                av.ContentStream.Read(bytes, 0, bytes.Length);
                sav._contentStream = new MemoryStream(bytes);
            }

            sav._contentType = SerializeableContentType.GetSerializeableContentType(av.ContentType);

            foreach (LinkedResource lr in av.LinkedResources)
            {
                sav._linkedResources.Add(SerializeableLinkedResource.GetSerializeableLinkedResource(lr));
            }

            sav._transferEncoding = av.TransferEncoding;
            return(sav);
        }
コード例 #3
0
        internal static SerializeableContentType GetSerializeableContentType(ContentType ct)
        {
            if (ct == null)
            {
                return(null);
            }

            var sct = new SerializeableContentType();

            sct._boundary   = ct.Boundary;
            sct._charSet    = ct.CharSet;
            sct._mediaType  = ct.MediaType;
            sct._name       = ct.Name;
            sct._parameters = SerializeableCollection.GetSerializeableCollection(ct.Parameters);

            return(sct);
        }
コード例 #4
0
        internal static SerializeableLinkedResource GetSerializeableLinkedResource(LinkedResource lr)
        {
            if (lr == null)
            {
                return(null);
            }

            var slr = new SerializeableLinkedResource();

            slr._contentId   = lr.ContentId;
            slr._contentLink = lr.ContentLink;

            if (lr.ContentStream != null)
            {
                var bytes = new byte[lr.ContentStream.Length];
                lr.ContentStream.Read(bytes, 0, bytes.Length);
                slr._contentStream = new MemoryStream(bytes);
            }

            slr._contentType      = SerializeableContentType.GetSerializeableContentType(lr.ContentType);
            slr._transferEncoding = lr.TransferEncoding;

            return(slr);
        }