Exemple #1
0
        public SerializeableLinkedResource(LinkedResource linkedResource)
        {
            ContentId        = linkedResource.ContentId;
            ContentLink      = linkedResource.ContentLink;
            ContentType      = new SerializeableContentType(linkedResource.ContentType);
            TransferEncoding = linkedResource.TransferEncoding;

            if (linkedResource.ContentStream != null)
            {
                var bytes = new byte[linkedResource.ContentStream.Length];
                linkedResource.ContentStream.Read(bytes, 0, bytes.Length);
                ContentStream = new MemoryStream(bytes);
            }
        }
Exemple #2
0
        public SerializeableAttachment(Attachment attachment)
        {
            ContentId          = attachment.ContentId;
            ContentDisposition = new SerializeableContentDisposition(attachment.ContentDisposition);
            ContentType        = new SerializeableContentType(attachment.ContentType);
            Name             = attachment.Name;
            TransferEncoding = attachment.TransferEncoding;
            NameEncoding     = attachment.NameEncoding;

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

                ContentStream = new MemoryStream(bytes);
            }
        }
Exemple #3
0
        public SerializeableAlternateView(AlternateView alternativeView)
        {
            BaseUri          = alternativeView.BaseUri;
            ContentId        = alternativeView.ContentId;
            ContentType      = new SerializeableContentType(alternativeView.ContentType);
            TransferEncoding = alternativeView.TransferEncoding;

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

            foreach (var lr in alternativeView.LinkedResources)
            {
                LinkedResources.Add(new SerializeableLinkedResource(lr));
            }
        }