Skip to content

Commit

Permalink
Fix update-checker logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Jameak committed Mar 18, 2017
1 parent 8248f81 commit 6754953
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Added layer management window
* Improved the layer adding window. Local files can now be dropped into the textbox, and it is clearer that a layer mask can be left out.
* Added automatic mask generation to the layer adding window. Borders with transparency can have a mask generated for non-enclosed transparent areas.
* Fix update checker logic.
* Minor UI fixes.

## 1.0.1 - 2017-03-13
Expand Down
21 changes: 16 additions & 5 deletions src/Stamper.DataAccess/UpdateChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,29 @@ public static async Task<Tuple<bool, string>> CheckForUpdate(bool forceCheck)
{
var val = await result.Content.ReadAsStringAsync();
var response = JsonConvert.DeserializeObject<List<GithubRelease>>(val);



var currentVersion = ParseVersion(Properties.Settings.Default.Version);
foreach (var githubRelease in response)
{
if (!githubRelease.Draft && !githubRelease.Prerelease)
{
var releaseVersion = ParseVersion(githubRelease.Tag_name);

if (currentVersion.Item1 < releaseVersion.Item1)
{
return new Tuple<bool, string>(true, githubRelease.Tag_name);
}

if (currentVersion.Item1 < releaseVersion.Item1) return new Tuple<bool, string>(true, githubRelease.Tag_name);
if (currentVersion.Item2 < releaseVersion.Item2) return new Tuple<bool, string>(true, githubRelease.Tag_name);
if (currentVersion.Item3 < releaseVersion.Item3) return new Tuple<bool, string>(true, githubRelease.Tag_name);
if (currentVersion.Item1 == releaseVersion.Item1 && currentVersion.Item2 < releaseVersion.Item2)
{
return new Tuple<bool, string>(true, githubRelease.Tag_name);
}

if (currentVersion.Item1 == releaseVersion.Item1 && currentVersion.Item2 == releaseVersion.Item2 &&
currentVersion.Item3 < releaseVersion.Item3)
{
return new Tuple<bool, string>(true, githubRelease.Tag_name);
}
}
}
}
Expand Down

0 comments on commit 6754953

Please sign in to comment.