get image uri from urn

This commit is contained in:
2015-03-26 23:49:39 +01:00
parent 8cbb882627
commit 72be117ac0
4 changed files with 32 additions and 2 deletions
+1
View File
@@ -29,6 +29,7 @@ namespace OnePeek.Api
{
AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip
});
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2327.5 Safari/537.36 OPR/30.0.1812.0 (Edition developer)");
}
+18 -2
View File
@@ -8,15 +8,31 @@ namespace OnePeek.Api
{
internal static class EndpointUris
{
private const string WINDOWSPHONE_METADATA_URI = "http://marketplaceedgeservice.windowsphone.com/v9/catalog/apps/{0}?os=8.10.14219.0&cc={1}&lang={2}";
public const string WINDOWSPHONE_IMAGE_URI = "http://cdn.marketplaceimages.windowsphone.com/v8/images/{0}?imageType=ws_icon_large";
public const string WINDOWSPHONE_METADATA_URI = "http://marketplaceedgeservice.windowsphone.com/v9/catalog/apps/{0}?os=8.10.14219.0&cc={1}&lang={2}";
internal static Uri GetWindowsPhoneMetadataUri(string appId, string culture)
{
culture = culture.Replace('_', '-');
string country = culture.Split('-')[1];
string uriString = String.Format(WINDOWSPHONE_METADATA_URI, appId, country, culture);
return Uri(WINDOWSPHONE_METADATA_URI, appId, country, culture);
}
internal static Uri GetWindowsPhoneImageUri(string urn)
{
return Uri(WINDOWSPHONE_IMAGE_URI, urn.Replace("urn:uuid:", ""));
}
private static Uri Uri(string template, params string[] replacements)
{
string uriString = String.Format(template, replacements).ToLower();
return new Uri(uriString, UriKind.Absolute);
}
}
+7
View File
@@ -44,6 +44,7 @@
<Compile Include="ApiBase.cs" />
<Compile Include="ApiHttpClient.cs" />
<Compile Include="AppMetadataEndpoint.cs" />
<Compile Include="EndpointUris.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@@ -53,6 +54,12 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="Bender">
<HintPath>..\packages\Bender.3.0.4.0\lib\Bender.dll</HintPath>
</Reference>
<Reference Include="Flexo">
<HintPath>..\packages\flexo.1.0.0.18\lib\Flexo.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wpa81\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
+6
View File
@@ -6,6 +6,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnePeek.Api", "OnePeek.Api\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnePeek.Entities", "OnePeek.Entities\OnePeek.Entities.csproj", "{D45D6378-3ED0-4445-94FE-21F62C1DF4E6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnePeek.Console", "OnePeek.Console\OnePeek.Console.csproj", "{A68611D8-A796-4A7A-A69D-D61B929CF8D8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -20,6 +22,10 @@ Global
{D45D6378-3ED0-4445-94FE-21F62C1DF4E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D45D6378-3ED0-4445-94FE-21F62C1DF4E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D45D6378-3ED0-4445-94FE-21F62C1DF4E6}.Release|Any CPU.Build.0 = Release|Any CPU
{A68611D8-A796-4A7A-A69D-D61B929CF8D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A68611D8-A796-4A7A-A69D-D61B929CF8D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A68611D8-A796-4A7A-A69D-D61B929CF8D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A68611D8-A796-4A7A-A69D-D61B929CF8D8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE