// Token: 0x06002CDC RID: 11484 RVA: 0x000CA334 File Offset: 0x000C8534 private static object ValidateAndLoadPartFromAbsoluteUri(Uri AbsoluteUriDoc, bool validateOnly, string rootElement, out ContentType mimeType) { mimeType = null; object result = null; try { Stream stream = WpfWebRequestHelper.CreateRequestAndGetResponseStream(AbsoluteUriDoc, out mimeType); ParserContext parserContext = new ParserContext(); parserContext.BaseUri = AbsoluteUriDoc; XpsValidatingLoader xpsValidatingLoader = new XpsValidatingLoader(); if (validateOnly) { xpsValidatingLoader.Validate(stream, null, parserContext, mimeType, rootElement); } else { result = xpsValidatingLoader.Load(stream, null, parserContext, mimeType); } } catch (Exception ex) { if (!(ex is WebException) && !(ex is InvalidOperationException)) { throw; } } return(result); }
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; }
private static object ValidateAndLoadPartFromAbsoluteUri(Uri AbsoluteUriDoc, bool validateOnly, string rootElement, out ContentType mimeType) { mimeType = null; Stream pageStream = null; object o = null; try { pageStream = WpfWebRequestHelper.CreateRequestAndGetResponseStream(AbsoluteUriDoc, out mimeType); ParserContext pc = new ParserContext(); pc.BaseUri = AbsoluteUriDoc; XpsValidatingLoader loader = new XpsValidatingLoader(); if (validateOnly) { loader.Validate(pageStream, null, pc, mimeType, rootElement); } else { o = loader.Load(pageStream, null, pc, mimeType); } } catch (Exception e) { //System.Net.WebException will be thrown when the document structure does not exist in a non-container //and System.InvalidOperation will be thrown when calling Package.GetPart() in a container. //We ignore these but all others need to be rethrown if (!(e is System.Net.WebException || e is System.InvalidOperationException)) { throw; } } return o; }
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; }
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; }