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); }
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; }
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); }