From b95b20edd23b9940a3b6fa6137e31dae2f4bfceb Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Mon, 20 Feb 2017 11:00:56 -0500 Subject: [PATCH] Changed Playtime to be a TimeSpan instead of uint of minutes. --- src/SteamWebAPI2.Net45/SteamWebAPI2.Net45.csproj | 2 +- src/SteamWebAPI2.Net45/packages.config | 2 +- src/SteamWebAPI2/AutoMapperConfiguration.cs | 14 +++++++++++++- src/SteamWebAPI2/project.json | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/SteamWebAPI2.Net45/SteamWebAPI2.Net45.csproj b/src/SteamWebAPI2.Net45/SteamWebAPI2.Net45.csproj index ae94b3b..ec90609 100644 --- a/src/SteamWebAPI2.Net45/SteamWebAPI2.Net45.csproj +++ b/src/SteamWebAPI2.Net45/SteamWebAPI2.Net45.csproj @@ -40,7 +40,7 @@ True - ..\packages\Steam.Models.3.0.1-ci-00026\lib\net45\Steam.Models.dll + ..\packages\Steam.Models.3.0.1-ci-00029\lib\net45\Steam.Models.dll True diff --git a/src/SteamWebAPI2.Net45/packages.config b/src/SteamWebAPI2.Net45/packages.config index 6251bd6..9a28401 100644 --- a/src/SteamWebAPI2.Net45/packages.config +++ b/src/SteamWebAPI2.Net45/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/src/SteamWebAPI2/AutoMapperConfiguration.cs b/src/SteamWebAPI2/AutoMapperConfiguration.cs index 499665a..3685c30 100644 --- a/src/SteamWebAPI2/AutoMapperConfiguration.cs +++ b/src/SteamWebAPI2/AutoMapperConfiguration.cs @@ -328,7 +328,19 @@ public static void Initialize() } }); - x.CreateMap(); + x.CreateMap() + .ForMember(dest => dest.PlaytimeLastTwoWeeks, opts => opts.ResolveUsing(src => + { + if (!src.Playtime2weeks.HasValue) + { + return (TimeSpan?)null; + } + return TimeSpan.FromMinutes(src.Playtime2weeks.Value); + })) + .ForMember(dest => dest.PlaytimeForever, opts => opts.ResolveUsing(src => + { + return TimeSpan.FromMinutes(src.PlaytimeForever); + })); x.CreateMap(); x.CreateMap().ConvertUsing( src => Mapper.Map(src.Result) diff --git a/src/SteamWebAPI2/project.json b/src/SteamWebAPI2/project.json index da93d35..cde635e 100644 --- a/src/SteamWebAPI2/project.json +++ b/src/SteamWebAPI2/project.json @@ -29,6 +29,6 @@ "dependencies": { "AutoMapper": "5.2.0", "Newtonsoft.Json": "9.0.1", - "Steam.Models": "3.0.1-ci-00026" + "Steam.Models": "3.0.1-ci-00029" } } \ No newline at end of file