public static ResolvePartUri ( Uri sourcePartUri, Uri targetUri ) : Uri | ||
sourcePartUri | Uri | |
targetUri | Uri | |
return | Uri |
public static Uri ResolvePartUri(Uri sourcePartUri, Uri targetUri)
{
Check.SourcePartUri(sourcePartUri);
Check.TargetUri(targetUri);
Check.PartUriIsValid(sourcePartUri);
// commented out because on Android they are absolute file:///
// if (targetUri.IsAbsoluteUri)
// throw new ArgumentException("targetUri", "Absolute URIs are not supported");
Uri uri = new Uri("http://fake.com");
uri = new Uri(uri, sourcePartUri);
uri = new Uri(uri, targetUri);
// Trim out 'http://fake.com'
return new Uri(uri.OriginalString.Substring(15), UriKind.Relative);
}
ParsePages() { Stream stream = _metroPart.GetStream(FileMode.Open); // // If the stream is empty there are no pages to parse // if (stream.Length > 0) { XmlTextReader reader = new XmlTextReader(stream); while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == XpsS0Markup.PageContent) { string attribute = reader.GetAttribute(XmlTags.Source); if (attribute != null) { Uri relativeUri = new Uri(attribute, UriKind.Relative); AddPageToCache(PackUriHelper.ResolvePartUri(Uri, relativeUri)); } } } } }