rename storeimagetype and make it optional

This commit is contained in:
2015-03-27 00:36:13 +01:00
parent 8494b9c9ff
commit 3fe05ad8e3
6 changed files with 13 additions and 27 deletions
+8 -10
View File
@@ -1,14 +1,10 @@
using Bender;
using OnePeek.Entities;
using OnePeek.Api.Extensions;
using OnePeek.Entities;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Bender.Configuration;
using System.IO;
using System.Threading.Tasks;
namespace OnePeek.Api
{
@@ -40,16 +36,18 @@ namespace OnePeek.Api
}
public Uri GetImageUri(string urn, StoreScreenshotType screenshotType)
public Uri GetImageUri(string urn, StoreImageType imageType = StoreImageType.None)
{
string type = screenshotType.GetEnumDisplayName();
string type = imageType.GetEnumDisplayName();
return EndpointUris.GetWindowsPhoneImageUri(urn, type);
}
public async Task<Stream> GetImageAsStream(string urn, StoreScreenshotType screenshotType)
public async Task<Stream> GetImageAsStream(string urn, StoreImageType imageType = StoreImageType.None)
{
string type = screenshotType.GetEnumDisplayName();
string type = imageType.GetEnumDisplayName();
Uri uri = EndpointUris.GetWindowsPhoneImageUri(urn, type);
return await ApiHttpClient.Instance.GetStream(uri);
}
+2 -6
View File
@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnePeek.Api
{
internal static class EndpointUris
{
public const string WINDOWSPHONE_IMAGE_URI = "http://cdn.marketplaceimages.windowsphone.com/v8/images/{0}?imageType={1}";
public const string WINDOWSPHONE_IMAGE_URI = "http://cdn.marketplaceimages.windowsphone.com/v8/images/{0}";
public const string WINDOWSPHONE_METADATA_URI = "http://marketplaceedgeservice.windowsphone.com/v9/catalog/apps/{0}?os=8.10.14219.0&cc={1}&lang={2}";
@@ -25,7 +21,7 @@ namespace OnePeek.Api
internal static Uri GetWindowsPhoneImageUri(string urn, string type)
{
return Uri(WINDOWSPHONE_IMAGE_URI, urn.Replace("urn:uuid:", ""), type);
return Uri(WINDOWSPHONE_IMAGE_URI, urn.Replace("urn:uuid:", "") + (!String.IsNullOrWhiteSpace(type) ? "?imageType=" + type : ""));
}
@@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;
using System.Text;
using System.Threading.Tasks;
namespace OnePeek.Api.Extensions
{
-4
View File
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace OnePeek.Entities
+1 -1
View File
@@ -43,7 +43,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StoreCulture.cs" />
<Compile Include="StoreCultureType.cs" />
<Compile Include="StoreScreenshotType.cs" />
<Compile Include="StoreImageType.cs" />
<Compile Include="StoreType.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
@@ -2,8 +2,9 @@
namespace OnePeek.Entities
{
public enum StoreScreenshotType
public enum StoreImageType
{
None,
[Display(Name = "ws_icon_large")]
Logo,
[Display(Name = "ws_screenshot_small")]