Skip to content

Commit f253d98

Browse files
author
Justin
committed
Fixed wrong model being returned from GetMatchHistoryBySequenceNumber.
1 parent 54a31d9 commit f253d98

12 files changed

Lines changed: 183 additions & 18 deletions

SteamWebAPI2.Net451/SteamWebAPI2.Net451.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
4040
<Private>True</Private>
4141
</Reference>
42-
<Reference Include="Steam.Models, Version=1.0.0.34, Culture=neutral, processorArchitecture=MSIL">
43-
<HintPath>..\packages\Steam.Models.1.0.0.34\lib\net451\Steam.Models.dll</HintPath>
42+
<Reference Include="Steam.Models, Version=1.0.0.36, Culture=neutral, processorArchitecture=MSIL">
43+
<HintPath>..\packages\Steam.Models.1.0.0.36\lib\net451\Steam.Models.dll</HintPath>
4444
<Private>True</Private>
4545
</Reference>
4646
<Reference Include="System" />

SteamWebAPI2.Net451/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
<packages>
33
<package id="AutoMapper" version="4.2.1" targetFramework="net451" />
44
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net451" />
5-
<package id="Steam.Models" version="1.0.0.34" targetFramework="net451" />
5+
<package id="Steam.Models" version="1.0.0.36" targetFramework="net451" />
66
</packages>

SteamWebAPI2.Net452/SteamWebAPI2.Net452.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
4040
<Private>True</Private>
4141
</Reference>
42-
<Reference Include="Steam.Models, Version=1.0.0.34, Culture=neutral, processorArchitecture=MSIL">
43-
<HintPath>..\packages\Steam.Models.1.0.0.34\lib\net452\Steam.Models.dll</HintPath>
42+
<Reference Include="Steam.Models, Version=1.0.0.36, Culture=neutral, processorArchitecture=MSIL">
43+
<HintPath>..\packages\Steam.Models.1.0.0.36\lib\net452\Steam.Models.dll</HintPath>
4444
<Private>True</Private>
4545
</Reference>
4646
<Reference Include="System" />

SteamWebAPI2.Net452/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
<packages>
33
<package id="AutoMapper" version="4.2.1" targetFramework="net452" />
44
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
5-
<package id="Steam.Models" version="1.0.0.34" targetFramework="net452" />
5+
<package id="Steam.Models" version="1.0.0.36" targetFramework="net452" />
66
</packages>

SteamWebAPI2.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.24720.0
4+
VisualStudioVersion = 14.0.25123.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamWebAPI2", "SteamWebAPI2\SteamWebAPI2.csproj", "{F5BE3B4F-5F56-45CB-9EEB-2BC017AC8EB5}"
77
EndProject

SteamWebAPI2/AutoMapperConfiguration.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ public static void Initialize()
163163
x.CreateMap<MatchHistoryPlayer, MatchHistoryPlayerModel>();
164164
x.CreateMap<MatchHistoryResult, MatchHistoryModel>();
165165

166+
x.CreateMap<MatchHistoryBySequenceNumberMatch, MatchHistoryBySequenceNumberMatchModel>();
167+
x.CreateMap<MatchHistoryBySequenceNumberMatchPlayer, MatchHistoryBySequenceNumberMatchPlayerModel>();
168+
x.CreateMap<MatchHistoryBySequenceNumberMatchPlayerAbilityUpgrade, MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel>();
169+
166170
x.CreateMap<TeamInfo, TeamInfoModel>();
167171

168172
x.CreateMap<EconItemResult, EconItemResultModel>();

SteamWebAPI2/Interfaces/DOTA2Match.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public async Task<MatchHistoryModel> GetMatchHistoryAsync(int? heroId = null, in
8686
return matchHistoryModel;
8787
}
8888

89-
public async Task<IReadOnlyCollection<MatchHistoryMatchModel>> GetMatchHistoryBySequenceNumberAsync(long? startAtMatchSequenceNumber = null, int? matchesRequested = null)
89+
public async Task<IReadOnlyCollection<MatchHistoryBySequenceNumberMatchModel>> GetMatchHistoryBySequenceNumberAsync(long? startAtMatchSequenceNumber = null, int? matchesRequested = null)
9090
{
9191
List<SteamWebRequestParameter> parameters = new List<SteamWebRequestParameter>();
9292

@@ -95,9 +95,10 @@ public async Task<IReadOnlyCollection<MatchHistoryMatchModel>> GetMatchHistoryBy
9595

9696
var matchHistory = await CallMethodAsync<MatchHistoryBySequenceNumberResultContainer>("GetMatchHistoryBySequenceNum", 1, parameters);
9797

98-
var matchHistoryModel = AutoMapperConfiguration.Mapper.Map<MatchHistoryBySequenceNumberResult, MatchHistoryModel>(matchHistory.Result);
99-
100-
return matchHistoryModel.Matches;
98+
var matchHistoryModels = AutoMapperConfiguration.Mapper
99+
.Map<IList<MatchHistoryBySequenceNumberMatch>, IList<MatchHistoryBySequenceNumberMatchModel>>(matchHistory.Result.Matches);
100+
101+
return new ReadOnlyCollection<MatchHistoryBySequenceNumberMatchModel>(matchHistoryModels);
101102
}
102103

103104
public async Task<IReadOnlyCollection<TeamInfoModel>> GetTeamInfoByTeamIdAsync(long? startAtTeamId = null, int? teamsRequested = null)

SteamWebAPI2/Interfaces/IDOTA2Match.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public interface IDOTA2Match
1111
Task<IReadOnlyCollection<LiveLeagueGameModel>> GetLiveLeagueGamesAsync(int? leagueId = default(int?), long? matchId = default(long?));
1212
Task<MatchDetailModel> GetMatchDetailsAsync(long matchId);
1313
Task<MatchHistoryModel> GetMatchHistoryAsync(int? heroId = default(int?), int? gameMode = default(int?), int? skill = default(int?), string minPlayers = "", string accountId = "", string leagueId = "", long? startAtMatchId = default(long?), string matchesRequested = "", string tournamentGamesOnly = "");
14-
Task<IReadOnlyCollection<MatchHistoryMatchModel>> GetMatchHistoryBySequenceNumberAsync(long? startAtMatchSequenceNumber = default(long?), int? matchesRequested = default(int?));
14+
Task<IReadOnlyCollection<MatchHistoryBySequenceNumberMatchModel>> GetMatchHistoryBySequenceNumberAsync(long? startAtMatchSequenceNumber = default(long?), int? matchesRequested = default(int?));
1515
Task<IReadOnlyCollection<TeamInfoModel>> GetTeamInfoByTeamIdAsync(long? startAtTeamId = default(long?), int? teamsRequested = default(int?));
1616
}
1717
}

SteamWebAPI2/Models/DOTA2/MatchHistoryBySequenceNumberResultContainer.cs

Lines changed: 162 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,171 @@
1-
using System.Collections.Generic;
1+
using Newtonsoft.Json;
2+
using SteamWebAPI2.Utilities.JsonConverters;
3+
using System;
4+
using System.Collections.Generic;
25

36
namespace SteamWebAPI2.Models.DOTA2
47
{
8+
internal class MatchHistoryBySequenceNumberMatchPlayerAbilityUpgrade
9+
{
10+
[JsonProperty(PropertyName = "ability")]
11+
public int Ability { get; set; }
12+
13+
[JsonProperty(PropertyName = "time")]
14+
public int Time { get; set; }
15+
16+
[JsonProperty(PropertyName = "level")]
17+
public int Level { get; set; }
18+
}
19+
20+
internal class MatchHistoryBySequenceNumberMatchPlayer
21+
{
22+
[JsonProperty(PropertyName = "ability_upgrades")]
23+
public IList<MatchHistoryBySequenceNumberMatchPlayerAbilityUpgrade> AbilityUpgrades { get; set; }
24+
25+
[JsonProperty(PropertyName = "account_id")]
26+
public long AccountId { get; set; }
27+
28+
[JsonProperty(PropertyName = "player_slot")]
29+
public int PlayerSlot { get; set; }
30+
31+
[JsonProperty(PropertyName = "hero_id")]
32+
public int HeroId { get; set; }
33+
34+
[JsonProperty(PropertyName = "item_0")]
35+
public int Item0 { get; set; }
36+
37+
[JsonProperty(PropertyName = "item_1")]
38+
public int Item1 { get; set; }
39+
40+
[JsonProperty(PropertyName = "item_2")]
41+
public int Item2 { get; set; }
42+
43+
[JsonProperty(PropertyName = "item_3")]
44+
public int Item3 { get; set; }
45+
46+
[JsonProperty(PropertyName = "item_4")]
47+
public int Item4 { get; set; }
48+
49+
[JsonProperty(PropertyName = "item_5")]
50+
public int Item5 { get; set; }
51+
52+
[JsonProperty(PropertyName = "kills")]
53+
public int Kills { get; set; }
54+
55+
[JsonProperty(PropertyName = "deaths")]
56+
public int Deaths { get; set; }
57+
58+
[JsonProperty(PropertyName = "assists")]
59+
public int Assists { get; set; }
60+
61+
[JsonProperty(PropertyName = "leaver_status")]
62+
public int LeaverStatus { get; set; }
63+
64+
[JsonProperty(PropertyName = "last_hits")]
65+
public int LastHits { get; set; }
66+
67+
[JsonProperty(PropertyName = "denies")]
68+
public int Denies { get; set; }
69+
70+
[JsonProperty(PropertyName = "gold_per_min")]
71+
public int GoldPerMin { get; set; }
72+
73+
[JsonProperty(PropertyName = "xp_per_min")]
74+
public int XpPerMin { get; set; }
75+
76+
[JsonProperty(PropertyName = "level")]
77+
public int Level { get; set; }
78+
79+
[JsonProperty(PropertyName = "gold")]
80+
public int Gold { get; set; }
81+
82+
[JsonProperty(PropertyName = "gold_spent")]
83+
public int GoldSpent { get; set; }
84+
85+
[JsonProperty(PropertyName = "hero_damage")]
86+
public int HeroDamage { get; set; }
87+
88+
[JsonProperty(PropertyName = "tower_damage")]
89+
public int TowerDamage { get; set; }
90+
91+
[JsonProperty(PropertyName = "hero_healing")]
92+
public int HeroHealing { get; set; }
93+
}
94+
95+
internal class MatchHistoryBySequenceNumberMatch
96+
{
97+
[JsonProperty(PropertyName = "players")]
98+
public IList<MatchHistoryBySequenceNumberMatchPlayer> Players { get; set; }
99+
100+
[JsonProperty(PropertyName = "radiant_win")]
101+
public bool RadiantWin { get; set; }
102+
103+
[JsonProperty(PropertyName = "duration")]
104+
public int Duration { get; set; }
105+
106+
[JsonProperty(PropertyName = "start_time")]
107+
[JsonConverter(typeof(UnixTimeJsonConverter))]
108+
public DateTime StartTime { get; set; }
109+
110+
[JsonProperty(PropertyName = "match_id")]
111+
public long MatchId { get; set; }
112+
113+
[JsonProperty(PropertyName = "match_seq_num")]
114+
public int MatchSequenceNumber { get; set; }
115+
116+
[JsonProperty(PropertyName = "tower_status_radiant")]
117+
public int RadiantTowerStatus { get; set; }
118+
119+
[JsonProperty(PropertyName = "tower_status_dire")]
120+
public int DireTowerStatus { get; set; }
121+
122+
[JsonProperty(PropertyName = "barracks_status_radiant")]
123+
public int RadiantBarracksStatus { get; set; }
124+
125+
[JsonProperty(PropertyName = "barracks_status_dire")]
126+
public int DireBarracksStatus { get; set; }
127+
128+
[JsonProperty(PropertyName = "cluster")]
129+
public int Cluster { get; set; }
130+
131+
[JsonProperty(PropertyName = "first_blood_time")]
132+
public long FirstBloodTime { get; set; }
133+
134+
[JsonProperty(PropertyName = "lobby_type")]
135+
public int LobbyType { get; set; }
136+
137+
[JsonProperty(PropertyName = "human_players")]
138+
public int HumanPlayers { get; set; }
139+
140+
[JsonProperty(PropertyName = "leagueid")]
141+
public int LeagueId { get; set; }
142+
143+
[JsonProperty(PropertyName = "positive_votes")]
144+
public int PositiveVotes { get; set; }
145+
146+
[JsonProperty(PropertyName = "negative_votes")]
147+
public int NegativeVotes { get; set; }
148+
149+
[JsonProperty(PropertyName = "game_mode")]
150+
public int GameMode { get; set; }
151+
152+
[JsonProperty(PropertyName = "flags")]
153+
public int Flags { get; set; }
154+
155+
[JsonProperty(PropertyName = "engine")]
156+
public int Engine { get; set; }
157+
158+
[JsonProperty(PropertyName = "radiant_score")]
159+
public int RadiantScore { get; set; }
160+
161+
[JsonProperty(PropertyName = "dire_score")]
162+
public int DireScore { get; set; }
163+
}
164+
5165
internal class MatchHistoryBySequenceNumberResult
6166
{
7167
public int Status { get; set; }
8-
public IList<MatchHistoryMatch> Matches { get; set; }
168+
public IList<MatchHistoryBySequenceNumberMatch> Matches { get; set; }
9169
}
10170

11171
internal class MatchHistoryBySequenceNumberResultContainer

SteamWebAPI2/Models/DOTA2/MatchHistoryResultContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal class MatchHistoryMatch
2626
[JsonProperty(PropertyName = "dire_team_id")]
2727
public int DireTeamId { get; set; }
2828

29-
public List<MatchHistoryPlayer> Players { get; set; }
29+
public IList<MatchHistoryPlayer> Players { get; set; }
3030
}
3131

3232
internal class MatchHistoryPlayer

0 commit comments

Comments
 (0)