Skip to content

Commit

Permalink
error handling, fixed #52
Browse files Browse the repository at this point in the history
  • Loading branch information
poma committed Oct 19, 2016
1 parent 8586a59 commit 07bf59a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Heroes.ReplayParser
4 changes: 2 additions & 2 deletions StatsDisplay/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 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("0.6.0")]
[assembly: AssemblyFileVersion("0.6.0")]
[assembly: AssemblyVersion("0.6.2")]
[assembly: AssemblyFileVersion("0.6.2")]
27 changes: 17 additions & 10 deletions StatsFetcher/FileProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ public static class FileProcessor
public static Game ProcessLobbyFile(string path)
{
var game = new BattleLobbyParser(path).Parse();
FetchProfiles(game);
FetchProfiles(game).ContinueWith(t => {
if (t.Exception != null) {
throw t.Exception;
}
});
return game;
}

Expand Down Expand Up @@ -95,18 +99,21 @@ private static async Task SafeCopy(string source, string dest, bool overwrite)
public static Replay ParseRejoin(string fileName)
{
try {
var replay = new Replay();

var archive = new MpqArchive(fileName);
archive.AddListfileFilenames();
using (var archive = new MpqArchive(fileName)) {
archive.AddListfileFilenames();
var replay = new Replay();

// Replay Details
ReplayDetails.Parse(replay, DataParser.GetMpqFile(archive, "save.details"), true);
// Replay Details
ReplayDetails.Parse(replay, DataParser.GetMpqFile(archive, "save.details"), true);

// Player level is stored there
ReplayAttributeEvents.Parse(replay, DataParser.GetMpqFile(archive, "replay.attributes.events"));
// Player level is stored there
// does not exist in brawl
if (archive.FileExists("replay.attributes.events")) {
ReplayAttributeEvents.Parse(replay, DataParser.GetMpqFile(archive, "replay.attributes.events"));
}

return replay;
return replay;
}
}
catch (Exception ex) {
//TODO: WE REALLY DON't want to do this
Expand Down
1 change: 1 addition & 0 deletions StatsFetcher/PlayerProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public PlayerProfile(Game game, string battleTag, Region region)
Game = game;
Ranks = new Dictionary<GameMode, MmrValue> {
{ GameMode.QuickMatch, null },
{ GameMode.UnrankedDraft, null },
{ GameMode.HeroLeague, null },
{ GameMode.TeamLeague, null }
};
Expand Down

0 comments on commit 07bf59a

Please sign in to comment.