/// <summary> /// Returns a string that contains the URI for display in a JournalEntry. /// It removes pack://application:,,,/ and any component, and replaces /// pack://siteoforigin:,,,/ with the actual site of origin URI. /// </summary> /// <param name="uri">The URI to display</param> /// <param name="siteOfOrigin">The site of origin URI</param> /// <returns>display name</returns> internal static string GetDisplayName(Uri uri, Uri siteOfOrigin) { // In case this is a fragment navigation in a tree that was not navigated to by URI... if (!uri.IsAbsoluteUri) { return(uri.ToString()); } bool isPack = String.Compare(uri.Scheme, PackUriHelper.UriSchemePack, StringComparison.OrdinalIgnoreCase) == 0; string displayName; if (isPack) { Uri relative = BaseUriHelper.MakeRelativeToSiteOfOriginIfPossible(uri); if (!relative.IsAbsoluteUri) { displayName = (new Uri(siteOfOrigin, relative)).ToString(); } else { string relativeUri = uri.AbsolutePath + uri.Query + uri.Fragment; string part, assy, assyVers, assyKey; BaseUriHelper.GetAssemblyNameAndPart(new Uri(relativeUri, UriKind.Relative), out part, out assy, out assyVers, out assyKey); if (!string.IsNullOrEmpty(assy)) { displayName = part; } else { displayName = relativeUri; } } } else { displayName = uri.ToString(); } if (!string.IsNullOrEmpty(displayName) && displayName[0] == '/') { displayName = displayName.Substring(1); } return(displayName); }
// Token: 0x06002905 RID: 10501 RVA: 0x000BDD2C File Offset: 0x000BBF2C internal static string GetDisplayName(Uri uri, Uri siteOfOrigin) { if (!uri.IsAbsoluteUri) { return(uri.ToString()); } bool flag = string.Compare(uri.Scheme, PackUriHelper.UriSchemePack, StringComparison.OrdinalIgnoreCase) == 0; string text; if (flag) { Uri uri2 = BaseUriHelper.MakeRelativeToSiteOfOriginIfPossible(uri); if (!uri2.IsAbsoluteUri) { text = new Uri(siteOfOrigin, uri2).ToString(); } else { string text2 = uri.AbsolutePath + uri.Query + uri.Fragment; string text3; string value; string text4; string text5; BaseUriHelper.GetAssemblyNameAndPart(new Uri(text2, UriKind.Relative), out text3, out value, out text4, out text5); if (!string.IsNullOrEmpty(value)) { text = text3; } else { text = text2; } } } else { text = uri.ToString(); } if (!string.IsNullOrEmpty(text) && text[0] == '/') { text = text.Substring(1); } return(text); }