Skip to content

Commit

Permalink
Changed Playtime to be a TimeSpan instead of uint of minutes.
Browse files Browse the repository at this point in the history
  • Loading branch information
babelshift committed Feb 20, 2017
1 parent 55fdc40 commit b95b20e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/SteamWebAPI2.Net45/SteamWebAPI2.Net45.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<Private>True</Private>
</Reference>
<Reference Include="Steam.Models, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Steam.Models.3.0.1-ci-00026\lib\net45\Steam.Models.dll</HintPath>
<HintPath>..\packages\Steam.Models.3.0.1-ci-00029\lib\net45\Steam.Models.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion src/SteamWebAPI2.Net45/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<packages>
<package id="AutoMapper" version="5.2.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="Steam.Models" version="3.0.1-ci-00026" targetFramework="net45" />
<package id="Steam.Models" version="3.0.1-ci-00029" targetFramework="net45" />
</packages>
14 changes: 13 additions & 1 deletion src/SteamWebAPI2/AutoMapperConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,19 @@ public static void Initialize()
}
});

x.CreateMap<OwnedGame, OwnedGameModel>();
x.CreateMap<OwnedGame, OwnedGameModel>()
.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<OwnedGamesResult, OwnedGamesResultModel>();
x.CreateMap<OwnedGamesResultContainer, OwnedGamesResultModel>().ConvertUsing(
src => Mapper.Map<OwnedGamesResult, OwnedGamesResultModel>(src.Result)
Expand Down
2 changes: 1 addition & 1 deletion src/SteamWebAPI2/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit b95b20e

Please sign in to comment.