Initial implementation for appdetails method.
This commit is contained in:
parent
0c51c1048c
commit
d2af8b1864
@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.27428.2043
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamStorefrontAPI", "SteamStorefrontAPI\SteamStorefrontAPI.csproj", "{76131ABE-46BD-4A82-B5E6-F29A47F2F64D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamStorefrontConsole", "SteamStorefrontConsole\SteamStorefrontConsole.csproj", "{44AAB32B-8986-48E0-8A08-42CE967D01F4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -15,6 +17,10 @@ Global
|
||||
{76131ABE-46BD-4A82-B5E6-F29A47F2F64D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{76131ABE-46BD-4A82-B5E6-F29A47F2F64D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{76131ABE-46BD-4A82-B5E6-F29A47F2F64D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{44AAB32B-8986-48E0-8A08-42CE967D01F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{44AAB32B-8986-48E0-8A08-42CE967D01F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{44AAB32B-8986-48E0-8A08-42CE967D01F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{44AAB32B-8986-48E0-8A08-42CE967D01F4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>76131abe-46bd-4a82-b5e6-f29a47f2f64d</ProjectGuid>
|
||||
<ProjectGuid>{76131ABE-46BD-4A82-B5E6-F29A47F2F64D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SteamStorefrontAPI</RootNamespace>
|
||||
@ -30,24 +30,39 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System"/>
|
||||
|
||||
<Reference Include="System.Core"/>
|
||||
<Reference Include="System.Xml.Linq"/>
|
||||
<Reference Include="System.Data.DataSetExtensions"/>
|
||||
|
||||
|
||||
<Reference Include="Microsoft.CSharp"/>
|
||||
|
||||
<Reference Include="System.Data"/>
|
||||
|
||||
<Reference Include="System.Net.Http"/>
|
||||
|
||||
<Reference Include="System.Xml"/>
|
||||
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="appdetails\AppDetails.cs" />
|
||||
<Compile Include="appdetails\Classes\ReleaseDate.cs" />
|
||||
<Compile Include="appdetails\Classes\Recommendations.cs" />
|
||||
<Compile Include="appdetails\Classes\PriceOverview.cs" />
|
||||
<Compile Include="appdetails\Classes\Platforms.cs" />
|
||||
<Compile Include="appdetails\Classes\PcRequirements.cs" />
|
||||
<Compile Include="appdetails\Classes\PackageGroup.cs" />
|
||||
<Compile Include="appdetails\Classes\Movie.cs" />
|
||||
<Compile Include="appdetails\Classes\Genre.cs" />
|
||||
<Compile Include="appdetails\Classes\Category.cs" />
|
||||
<Compile Include="appdetails\Classes\Highlighted.cs" />
|
||||
<Compile Include="appdetails\Classes\Achievements.cs" />
|
||||
<Compile Include="appdetails\Classes\Sub.cs" />
|
||||
<Compile Include="appdetails\Classes\SupportInfo.cs" />
|
||||
<Compile Include="appdetails\Classes\Screenshot.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="appdetails\Classes\SteamApp.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
</Project>
|
45
SteamStorefrontAPI/appdetails/AppDetails.cs
Normal file
45
SteamStorefrontAPI/appdetails/AppDetails.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SteamStorefrontAPI.Classes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public static class AppDetails
|
||||
{
|
||||
private static HttpClient client = new HttpClient();
|
||||
private const string steamBaseUri = "http://store.steampowered.com/api/appdetails";
|
||||
|
||||
public static async Task<SteamApp> GetAsync(int AppId)
|
||||
{
|
||||
return await GetAsync(AppId, null, null);
|
||||
}
|
||||
|
||||
public static async Task<SteamApp> GetAsync(int AppId, string CountryCode)
|
||||
{
|
||||
return await GetAsync(AppId, CountryCode, null);
|
||||
}
|
||||
|
||||
public static async Task<SteamApp> GetAsync(int AppId, string CountryCode, string Language)
|
||||
{
|
||||
string steamUri = $"{steamBaseUri}?appids={AppId}";
|
||||
steamUri = CountryCode is null ? steamUri : $"{steamUri}&cc={CountryCode}";
|
||||
steamUri = Language is null ? steamUri : $"{steamUri}&l={Language}";
|
||||
|
||||
var response = await client.GetAsync(steamUri);
|
||||
if (!response.IsSuccessStatusCode) { return null; }
|
||||
|
||||
var result = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// The actual payload is wrapped, drill down to the third level to get to it
|
||||
var jsonData = JToken.Parse(result).First.First;
|
||||
if (!bool.Parse(jsonData["success"].ToString())) { return null; }
|
||||
|
||||
return jsonData["data"].ToObject<SteamApp>();
|
||||
}
|
||||
}
|
||||
}
|
20
SteamStorefrontAPI/appdetails/Classes/Achievements.cs
Normal file
20
SteamStorefrontAPI/appdetails/Classes/Achievements.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class Achievements
|
||||
{
|
||||
[JsonProperty("total")]
|
||||
public long Total { get; set; }
|
||||
|
||||
[JsonProperty("highlighted")]
|
||||
public List<Highlighted> Highlighted { get; set; }
|
||||
}
|
||||
}
|
20
SteamStorefrontAPI/appdetails/Classes/Category.cs
Normal file
20
SteamStorefrontAPI/appdetails/Classes/Category.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class Category
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
21
SteamStorefrontAPI/appdetails/Classes/Genre.cs
Normal file
21
SteamStorefrontAPI/appdetails/Classes/Genre.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class Genre
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
}
|
||||
|
||||
}
|
20
SteamStorefrontAPI/appdetails/Classes/Highlighted.cs
Normal file
20
SteamStorefrontAPI/appdetails/Classes/Highlighted.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class Highlighted
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("path")]
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
30
SteamStorefrontAPI/appdetails/Classes/Movie.cs
Normal file
30
SteamStorefrontAPI/appdetails/Classes/Movie.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class Movie
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("thumbnail")]
|
||||
public string Thumbnail { get; set; }
|
||||
|
||||
[JsonProperty("webm")]
|
||||
public Dictionary<string, string> Webm { get; set; }
|
||||
|
||||
[JsonProperty("highlight")]
|
||||
public bool Highlight { get; set; }
|
||||
}
|
||||
|
||||
}
|
39
SteamStorefrontAPI/appdetails/Classes/PackageGroup.cs
Normal file
39
SteamStorefrontAPI/appdetails/Classes/PackageGroup.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
|
||||
public class PackageGroup
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[JsonProperty("selection_text")]
|
||||
public string SelectionText { get; set; }
|
||||
|
||||
[JsonProperty("save_text")]
|
||||
public string SaveText { get; set; }
|
||||
|
||||
[JsonProperty("display_type")]
|
||||
public long DisplayType { get; set; }
|
||||
|
||||
[JsonProperty("is_recurring_subscription")]
|
||||
public string IsRecurringSubscription { get; set; }
|
||||
|
||||
[JsonProperty("subs")]
|
||||
public List<Sub> Subs { get; set; }
|
||||
}
|
||||
}
|
20
SteamStorefrontAPI/appdetails/Classes/PcRequirements.cs
Normal file
20
SteamStorefrontAPI/appdetails/Classes/PcRequirements.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class PcRequirements
|
||||
{
|
||||
[JsonProperty("minimum")]
|
||||
public string Minimum { get; set; }
|
||||
|
||||
[JsonProperty("recommended")]
|
||||
public string Recommended { get; set; }
|
||||
}
|
||||
}
|
24
SteamStorefrontAPI/appdetails/Classes/Platforms.cs
Normal file
24
SteamStorefrontAPI/appdetails/Classes/Platforms.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class Platforms
|
||||
{
|
||||
[JsonProperty("windows")]
|
||||
public bool Windows { get; set; }
|
||||
|
||||
[JsonProperty("mac")]
|
||||
public bool Mac { get; set; }
|
||||
|
||||
[JsonProperty("linux")]
|
||||
public bool Linux { get; set; }
|
||||
}
|
||||
|
||||
}
|
64
SteamStorefrontAPI/appdetails/Classes/PriceOverview.cs
Normal file
64
SteamStorefrontAPI/appdetails/Classes/PriceOverview.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class PriceOverview
|
||||
{
|
||||
[JsonProperty("currency")]
|
||||
public string Currency { get; set; }
|
||||
|
||||
[JsonProperty("initial")]
|
||||
[JsonConverter(typeof(LongToDoubleConverter))]
|
||||
public double Initial { get; set; }
|
||||
|
||||
[JsonProperty("final")]
|
||||
[JsonConverter(typeof(LongToDoubleConverter))]
|
||||
public double Final { get; set; }
|
||||
|
||||
[JsonProperty("discount_percent")]
|
||||
public long DiscountPercent { get; set; }
|
||||
}
|
||||
|
||||
public class LongToDoubleConverter : JsonConverter
|
||||
{
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
long longValue = long.Parse(reader.Value.ToString());
|
||||
double convertedValue = longValue / 100.0;
|
||||
return convertedValue;
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException("Unnecessary because CanRead is CanWrite. The type will skip the converter.");
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
}
|
||||
|
||||
public class PriceOverviewSerializer : JsonSerializer
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
17
SteamStorefrontAPI/appdetails/Classes/Recommendations.cs
Normal file
17
SteamStorefrontAPI/appdetails/Classes/Recommendations.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class Recommendations
|
||||
{
|
||||
[JsonProperty("total")]
|
||||
public long Total { get; set; }
|
||||
}
|
||||
}
|
20
SteamStorefrontAPI/appdetails/Classes/ReleaseDate.cs
Normal file
20
SteamStorefrontAPI/appdetails/Classes/ReleaseDate.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class ReleaseDate
|
||||
{
|
||||
[JsonProperty("coming_soon")]
|
||||
public bool ComingSoon { get; set; }
|
||||
|
||||
[JsonProperty("date")]
|
||||
public string Date { get; set; }
|
||||
}
|
||||
}
|
24
SteamStorefrontAPI/appdetails/Classes/Screenshot.cs
Normal file
24
SteamStorefrontAPI/appdetails/Classes/Screenshot.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
|
||||
public class Screenshot
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
[JsonProperty("path_thumbnail")]
|
||||
public string PathThumbnail { get; set; }
|
||||
|
||||
[JsonProperty("path_full")]
|
||||
public string PathFull { get; set; }
|
||||
}
|
||||
}
|
119
SteamStorefrontAPI/appdetails/Classes/SteamApp.cs
Normal file
119
SteamStorefrontAPI/appdetails/Classes/SteamApp.cs
Normal file
@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace SteamStorefrontAPI.Classes
|
||||
{
|
||||
public class SteamApp
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("steam_appid")]
|
||||
public long SteamAppid { get; set; }
|
||||
|
||||
[JsonProperty("required_age")]
|
||||
public string RequiredAge { get; set; }
|
||||
|
||||
[JsonProperty("is_free")]
|
||||
public bool IsFree { get; set; }
|
||||
|
||||
[JsonProperty("detailed_description")]
|
||||
public string DetailedDescription { get; set; }
|
||||
|
||||
[JsonProperty("about_the_game")]
|
||||
public string AboutTheGame { get; set; }
|
||||
|
||||
[JsonProperty("short_description")]
|
||||
public string ShortDescription { get; set; }
|
||||
|
||||
[JsonProperty("supported_languages")]
|
||||
public string SupportedLanguages { get; set; }
|
||||
|
||||
[JsonProperty("header_image")]
|
||||
public string HeaderImage { get; set; }
|
||||
|
||||
[JsonProperty("website")]
|
||||
public string Website { get; set; }
|
||||
|
||||
[JsonProperty("pc_requirements")]
|
||||
public PcRequirements PcRequirements { get; set; }
|
||||
|
||||
[JsonProperty("mac_requirements")]
|
||||
public List<object> MacRequirements { get; set; }
|
||||
|
||||
[JsonProperty("linux_requirements")]
|
||||
public List<object> LinuxRequirements { get; set; }
|
||||
|
||||
[JsonProperty("legal_notice")]
|
||||
public string LegalNotice { get; set; }
|
||||
|
||||
[JsonProperty("developers")]
|
||||
public List<string> Developers { get; set; }
|
||||
|
||||
[JsonProperty("publishers")]
|
||||
public List<string> Publishers { get; set; }
|
||||
|
||||
[JsonProperty("price_overview")]
|
||||
public PriceOverview PriceOverview { get; set; }
|
||||
|
||||
[JsonProperty("packages")]
|
||||
public List<long> Packages { get; set; }
|
||||
|
||||
[JsonProperty("package_groups")]
|
||||
public List<PackageGroup> PackageGroups { get; set; }
|
||||
|
||||
[JsonProperty("platforms")]
|
||||
public Platforms Platforms { get; set; }
|
||||
|
||||
[JsonProperty("categories")]
|
||||
public List<Category> Categories { get; set; }
|
||||
|
||||
[JsonProperty("genres")]
|
||||
public List<Genre> Genres { get; set; }
|
||||
|
||||
[JsonProperty("screenshots")]
|
||||
public List<Screenshot> Screenshots { get; set; }
|
||||
|
||||
[JsonProperty("movies")]
|
||||
public List<Movie> Movies { get; set; }
|
||||
|
||||
[JsonProperty("recommendations")]
|
||||
public Recommendations Recommendations { get; set; }
|
||||
|
||||
[JsonProperty("achievements")]
|
||||
public Achievements Achievements { get; set; }
|
||||
|
||||
[JsonProperty("release_date")]
|
||||
public ReleaseDate ReleaseDate { get; set; }
|
||||
|
||||
[JsonProperty("support_info")]
|
||||
public SupportInfo SupportInfo { get; set; }
|
||||
|
||||
[JsonProperty("background")]
|
||||
public string Background { get; set; }
|
||||
|
||||
public static SteamApp FromJson(string json) {
|
||||
|
||||
var serializerSettings = new JsonSerializerSettings
|
||||
{
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
|
||||
DateParseHandling = DateParseHandling.None,
|
||||
Converters = {
|
||||
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
|
||||
},
|
||||
};
|
||||
|
||||
return JsonConvert.DeserializeObject<SteamApp>(json, serializerSettings);
|
||||
}
|
||||
}
|
||||
}
|
39
SteamStorefrontAPI/appdetails/Classes/Sub.cs
Normal file
39
SteamStorefrontAPI/appdetails/Classes/Sub.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
|
||||
public class Sub
|
||||
{
|
||||
[JsonProperty("packageid")]
|
||||
public long Packageid { get; set; }
|
||||
|
||||
[JsonProperty("percent_savings_text")]
|
||||
public string PercentSavingsText { get; set; }
|
||||
|
||||
[JsonProperty("percent_savings")]
|
||||
public long PercentSavings { get; set; }
|
||||
|
||||
[JsonProperty("option_text")]
|
||||
public string OptionText { get; set; }
|
||||
|
||||
[JsonProperty("option_description")]
|
||||
public string OptionDescription { get; set; }
|
||||
|
||||
[JsonProperty("can_get_free_license")]
|
||||
public string CanGetFreeLicense { get; set; }
|
||||
|
||||
[JsonProperty("is_free_license")]
|
||||
public bool IsFreeLicense { get; set; }
|
||||
|
||||
[JsonProperty("price_in_cents_with_discount")]
|
||||
public long PriceInCentsWithDiscount { get; set; }
|
||||
}
|
||||
}
|
20
SteamStorefrontAPI/appdetails/Classes/SupportInfo.cs
Normal file
20
SteamStorefrontAPI/appdetails/Classes/SupportInfo.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SteamStorefrontAPI
|
||||
{
|
||||
public class SupportInfo
|
||||
{
|
||||
[JsonProperty("url")]
|
||||
public string Url { get; set; }
|
||||
|
||||
[JsonProperty("email")]
|
||||
public string Email { get; set; }
|
||||
}
|
||||
}
|
4
SteamStorefrontAPI/packages.config
Normal file
4
SteamStorefrontAPI/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net471" />
|
||||
</packages>
|
6
SteamStorefrontConsole/App.config
Normal file
6
SteamStorefrontConsole/App.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
|
||||
</startup>
|
||||
</configuration>
|
32
SteamStorefrontConsole/Program.cs
Normal file
32
SteamStorefrontConsole/Program.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using SteamStorefrontAPI;
|
||||
using SteamStorefrontAPI.Classes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace SteamStorefrontConsole
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static HttpClient client = new HttpClient();
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Task.Run(async () => await GetGame()).Wait();
|
||||
|
||||
}
|
||||
|
||||
static async Task GetGame()
|
||||
{
|
||||
//var steamApp = Task.Run(async () => await AppDetails.GetAsync(637670)).Result;
|
||||
//var steamApp = Task.Run(async () => await AppDetails.GetAsync(443790)).Result;
|
||||
var steamApp = Task.Run(async () => await AppDetails.GetAsync(213670)).Result;
|
||||
|
||||
Console.WriteLine(steamApp);
|
||||
}
|
||||
}
|
||||
}
|
36
SteamStorefrontConsole/Properties/AssemblyInfo.cs
Normal file
36
SteamStorefrontConsole/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SteamStorefrontConsole")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SteamStorefrontConsole")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("44aab32b-8986-48e0-8a08-42ce967d01f4")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
58
SteamStorefrontConsole/SteamStorefrontConsole.csproj
Normal file
58
SteamStorefrontConsole/SteamStorefrontConsole.csproj
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{44AAB32B-8986-48E0-8A08-42CE967D01F4}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>SteamStorefrontConsole</RootNamespace>
|
||||
<AssemblyName>SteamStorefrontConsole</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SteamStorefrontAPI\SteamStorefrontAPI.csproj">
|
||||
<Project>{76131abe-46bd-4a82-b5e6-f29a47f2f64d}</Project>
|
||||
<Name>SteamStorefrontAPI</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user