private FixedDocument _LoadDocument() { FixedDocument fixedDocument = null; Uri uri = this._ResolveUri(); if (uri != null) { ContentType contentType = null; Stream stream = WpfWebRequestHelper.CreateRequestAndGetResponseStream(uri, out contentType); if (stream == null) { throw new ApplicationException(SR.Get("DocumentReferenceNotFound")); } ParserContext parserContext = new ParserContext(); parserContext.BaseUri = uri; if (BindUriHelper.IsXamlMimeType(contentType)) { XpsValidatingLoader xpsValidatingLoader = new XpsValidatingLoader(); fixedDocument = (xpsValidatingLoader.Load(stream, ((IUriContext)this).BaseUri, parserContext, contentType) as FixedDocument); } else { if (!MimeTypeMapper.BamlMime.AreTypeAndSubTypeEqual(contentType)) { throw new ApplicationException(SR.Get("DocumentReferenceUnsupportedMimeType")); } fixedDocument = (XamlReader.LoadBaml(stream, parserContext, null, true) as FixedDocument); } fixedDocument.DocumentReference = this; } return(fixedDocument); }
private FixedDocument _LoadDocument() { FixedDocument idp = null; Uri uriToLoad = _ResolveUri(); if (uriToLoad != null) { ContentType mimeType = null; Stream docStream = null; docStream = WpfWebRequestHelper.CreateRequestAndGetResponseStream(uriToLoad, out mimeType); if (docStream == null) { throw new ApplicationException(SR.Get(SRID.DocumentReferenceNotFound)); } ParserContext pc = new ParserContext(); pc.BaseUri = uriToLoad; if (BindUriHelper.IsXamlMimeType(mimeType)) { XpsValidatingLoader loader = new XpsValidatingLoader(); idp = loader.Load(docStream, ((IUriContext)this).BaseUri, pc, mimeType) as FixedDocument; } else if (MS.Internal.MimeTypeMapper.BamlMime.AreTypeAndSubTypeEqual(mimeType)) { idp = XamlReader.LoadBaml(docStream, pc, null, true) as FixedDocument; } else { throw new ApplicationException(SR.Get(SRID.DocumentReferenceUnsupportedMimeType)); } idp.DocumentReference = this; } return(idp); }
internal static void _LoadPageImpl(Uri baseUri, Uri uriToLoad, out FixedPage fixedPage, out Stream pageStream) { ContentType mimeType; pageStream = WpfWebRequestHelper.CreateRequestAndGetResponseStream(uriToLoad, out mimeType); object o = null; if (pageStream == null) { throw new ApplicationException(SR.Get(SRID.PageContentNotFound)); } ParserContext pc = new ParserContext(); pc.BaseUri = uriToLoad; if (BindUriHelper.IsXamlMimeType(mimeType)) { XpsValidatingLoader loader = new XpsValidatingLoader(); o = loader.Load(pageStream, baseUri, pc, mimeType); } else if (MS.Internal.MimeTypeMapper.BamlMime.AreTypeAndSubTypeEqual(mimeType)) { o = XamlReader.LoadBaml(pageStream, pc, null, true); } else { throw new ApplicationException(SR.Get(SRID.PageContentUnsupportedMimeType)); } if (o != null && !(o is FixedPage)) { throw new ApplicationException(SR.Get(SRID.PageContentUnsupportedPageType, o.GetType())); } fixedPage = (FixedPage)o; }
// Token: 0x06003252 RID: 12882 RVA: 0x000DC99C File Offset: 0x000DAB9C internal static void _LoadPageImpl(Uri baseUri, Uri uriToLoad, out FixedPage fixedPage, out Stream pageStream) { ContentType contentType; pageStream = WpfWebRequestHelper.CreateRequestAndGetResponseStream(uriToLoad, out contentType); if (pageStream == null) { throw new ApplicationException(SR.Get("PageContentNotFound")); } ParserContext parserContext = new ParserContext(); parserContext.BaseUri = uriToLoad; object obj; if (BindUriHelper.IsXamlMimeType(contentType)) { XpsValidatingLoader xpsValidatingLoader = new XpsValidatingLoader(); obj = xpsValidatingLoader.Load(pageStream, baseUri, parserContext, contentType); } else { if (!MimeTypeMapper.BamlMime.AreTypeAndSubTypeEqual(contentType)) { throw new ApplicationException(SR.Get("PageContentUnsupportedMimeType")); } obj = XamlReader.LoadBaml(pageStream, parserContext, null, true); } if (obj != null && !(obj is FixedPage)) { throw new ApplicationException(SR.Get("PageContentUnsupportedPageType", new object[] { obj.GetType() })); } fixedPage = (FixedPage)obj; }