diff options
author | Unknown <t-espave@A3479886.redmond.corp.microsoft.com> | 2011-07-21 09:36:47 -0700 |
---|---|---|
committer | Unknown <t-espave@A3479886.redmond.corp.microsoft.com> | 2011-07-21 09:36:47 -0700 |
commit | 929363876526640062ed87096662baf3533b8726 (patch) | |
tree | aa73ea3c55977fcc71254d38a68e90fc34c79584 /BCT/BytecodeTranslator/Phone | |
parent | f728aa881caee16eaf6b5d25262578d64059f7f2 (diff) |
unified URI format across translations
Diffstat (limited to 'BCT/BytecodeTranslator/Phone')
-rw-r--r-- | BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs | 8 | ||||
-rw-r--r-- | BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs b/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs index 235cdc79..ff6f3298 100644 --- a/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs +++ b/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs @@ -194,7 +194,13 @@ namespace BytecodeTranslator.Phone { public static string getURIBase(string uri) {
// I need to build an absolute URI just to call getComponents() ...
Uri mockBaseUri = new Uri("mock://mock/", UriKind.RelativeOrAbsolute);
- Uri realUri = new Uri(mockBaseUri, uri);
+ Uri realUri;
+ try {
+ realUri = new Uri(uri, UriKind.Absolute);
+ } catch (UriFormatException) {
+ // uri string is relative
+ realUri = new Uri(mockBaseUri, uri);
+ }
string str= realUri.GetComponents(UriComponents.Path|UriComponents.StrongAuthority|UriComponents.Scheme, UriFormat.UriEscaped);
Uri mockStrippedUri = new Uri(str);
diff --git a/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs b/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs index ebbf9222..b0387221 100644 --- a/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs +++ b/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs @@ -40,7 +40,7 @@ namespace BytecodeTranslator.Phone { Assignment uriInitAssign = new Assignment() {
Source = new CompileTimeConstant() {
Type = host.PlatformType.SystemString,
- Value = mainPageUri,
+ Value = PhoneCodeHelper.getURIBase(mainPageUri),
},
Type = host.PlatformType.SystemString,
Target = new TargetExpression() {
|