Reorganized classes.

This commit is contained in:
mmuffins 2018-05-24 19:07:24 +02:00
parent 62586014bd
commit 8adfcf9b99
5 changed files with 16 additions and 15 deletions

View File

@ -11,7 +11,7 @@ namespace SteamStorefrontAPI.Classes
{
public enum ControllerSupport { Full, Partial };
public class FeaturedApp
public class AppInfo
{
[JsonProperty("id")]
public int Id { get; set; }

View File

@ -9,19 +9,19 @@ using Newtonsoft.Json.Converters;
namespace SteamStorefrontAPI.Classes
{
public class SteamFeatured
public class FeaturedApps
{
[JsonProperty("large_capsules")]
public List<FeaturedApp> LargeCapsules { get; set; }
public List<AppInfo> LargeCapsules { get; set; }
[JsonProperty("featured_win")]
public List<FeaturedApp> FeaturedWin { get; set; }
public List<AppInfo> FeaturedWin { get; set; }
[JsonProperty("featured_mac")]
public List<FeaturedApp> FeaturedMac { get; set; }
public List<AppInfo> FeaturedMac { get; set; }
[JsonProperty("featured_linux")]
public List<FeaturedApp> FeaturedLinux { get; set; }
public List<AppInfo> FeaturedLinux { get; set; }
[JsonProperty("layout")]
public string Layout { get; set; }
@ -29,7 +29,7 @@ namespace SteamStorefrontAPI.Classes
//[JsonProperty("status")]
//public int Status { get; set; }
public static SteamFeatured FromJson(string json)
public static FeaturedApps FromJson(string json)
{
var serializerSettings = new JsonSerializerSettings
@ -42,7 +42,7 @@ namespace SteamStorefrontAPI.Classes
},
};
return JsonConvert.DeserializeObject<SteamFeatured>(json, serializerSettings);
return JsonConvert.DeserializeObject<FeaturedApps>(json, serializerSettings);
}
}
}

View File

@ -15,17 +15,17 @@ namespace SteamStorefrontAPI
private const string steamBaseUri = "https://store.steampowered.com/api/featured";
public static async Task<SteamFeatured> GetAsync()
public static async Task<FeaturedApps> GetAsync()
{
return await GetAsync(null, null);
}
public static async Task<SteamFeatured> GetAsync(string CountryCode)
public static async Task<FeaturedApps> GetAsync(string CountryCode)
{
return await GetAsync(CountryCode, null);
}
public static async Task<SteamFeatured> GetAsync(string CountryCode, string Language)
public static async Task<FeaturedApps> GetAsync(string CountryCode, string Language)
{
string steamUri = steamBaseUri;
steamUri = CountryCode is null ? steamUri : $"{steamUri}&cc={CountryCode}";
@ -39,7 +39,7 @@ namespace SteamStorefrontAPI
var jsonData = JToken.Parse(result);
if (jsonData["status"].ToString() != "1") { return null; }
return SteamFeatured.FromJson(result);
return FeaturedApps.FromJson(result);
}
}
}

View File

@ -59,8 +59,8 @@
<Compile Include="Classes\appdetails\Category.cs" />
<Compile Include="Classes\appdetails\Highlighted.cs" />
<Compile Include="Classes\appdetails\Achievements.cs" />
<Compile Include="Classes\featured\FeaturedApp.cs" />
<Compile Include="Classes\featured\SteamFeatured.cs" />
<Compile Include="Classes\common\AppInfo.cs" />
<Compile Include="Classes\featured\FeaturedApps.cs" />
<Compile Include="Classes\appdetails\Sub.cs" />
<Compile Include="Classes\appdetails\SupportInfo.cs" />
<Compile Include="Classes\appdetails\Screenshot.cs" />
@ -70,5 +70,6 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -23,7 +23,7 @@ namespace SteamStorefrontConsole
//var steamApp = await AppDetails.GetAsync(443790);
//var steamApp = await AppDetails.GetAsync(460810, "JP");
//var featured = await Featured.GetAsync();
var featured = await Featured.GetAsync();
//Console.WriteLine(featured);
}