Exemplo n.º 1
0
        internal static AlternateViewWrapper GetSerializeableAlternateView(AlternateView av)
        {
            if (av == null)
            {
                return(null);
            }

            AlternateViewWrapper sav = new AlternateViewWrapper();

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

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

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

            foreach (LinkedResource lr in av.LinkedResources)
            {
                sav._linkedResources.Add(LinkedResourceWrapper.GetLinkedResourceWrapper(lr));
            }

            sav._transferEncoding = av.TransferEncoding;
            return(sav);
        }
Exemplo n.º 2
0
        internal static ContentTypeWrapper GetSerializeableContentType(ContentType ct)
        {
            if (ct == null)
                return null;

            ContentTypeWrapper sct = new ContentTypeWrapper();

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

            return sct;
        }
Exemplo n.º 3
0
        internal static ContentTypeWrapper GetSerializeableContentType(ContentType ct)
        {
            if (ct == null)
            {
                return(null);
            }

            ContentTypeWrapper sct = new ContentTypeWrapper();

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

            return(sct);
        }
Exemplo n.º 4
0
        internal static LinkedResourceWrapper GetLinkedResourceWrapper(LinkedResource lr)
        {
            if (lr == null)
            {
                return(null);
            }

            LinkedResourceWrapper slr = new LinkedResourceWrapper();

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

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

            slr._contentType      = ContentTypeWrapper.GetSerializeableContentType(lr.ContentType);
            slr._transferEncoding = lr.TransferEncoding;
            return(slr);
        }