Skip to content

Commit

Permalink
Merge pull request #300 from MarkSummerville/master
Browse files Browse the repository at this point in the history
Bug fix to address #299
  • Loading branch information
SirSparkles authored Jan 19, 2018
2 parents 4436b78 + a777a4b commit ec13087
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion TVRename#/Forms/UpdateNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public UpdateNotification(UpdateVersion update)
this.newVersion = update;
InitializeComponent();
this.tbReleaseNotes.Text = this.newVersion.ReleaseNotesText;
this.lblStatus.Text = $@"There is new version {update.VersionNumber}-{update.Prerelease} available since "+ update.ReleaseDate.ToLocalTime() + ".";
this.lblStatus.Text = $@"There is new version {update} available since {update.ReleaseDate.ToLocalTime()}.";

//If this call is slow then we can put it in a new thread and update the control as it comes back from GH
UpdateWithMarkdown();
Expand Down
17 changes: 14 additions & 3 deletions TVRename#/TVRename/TVDoc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3195,17 +3195,28 @@ public int CompareTo(object obj)
if (this.VersionNumber.CompareTo(otherUpdateVersion.VersionNumber) != 0) return this.VersionNumber.CompareTo(otherUpdateVersion.VersionNumber);

//We have the same version - now we have to get tricky and look at the extension (rc1, beta2 etc)
//if both have no extension then they are the same
if (string.IsNullOrWhiteSpace(this.Prerelease) && string.IsNullOrWhiteSpace(otherUpdateVersion.Prerelease)) return 0;

//If either are not present then you can assume they are FINAL versions and trump any rx1 verisons
if (String.IsNullOrWhiteSpace( this.Prerelease) ) return 1;
if (String.IsNullOrWhiteSpace(otherUpdateVersion .Prerelease)) return -1;
if (string.IsNullOrWhiteSpace( this.Prerelease) ) return 1;
if (string.IsNullOrWhiteSpace(otherUpdateVersion .Prerelease)) return -1;

//We have 2 suffixes
//Compare alphabetically alpha1 < alpha2 < beta1 < beta2 < rc1 < rc2 etc
return (String.Compare(this.Prerelease , otherUpdateVersion.Prerelease , StringComparison.OrdinalIgnoreCase) );
return (string.Compare(this.Prerelease , otherUpdateVersion.Prerelease , StringComparison.OrdinalIgnoreCase) );
}

public bool NewerThan(UpdateVersion compare) => (CompareTo(compare) > 0);

public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append(this.VersionNumber);
if (!string.IsNullOrWhiteSpace(this.Prerelease)) sb.Append("-" + this.Prerelease);
if (!string.IsNullOrWhiteSpace(this.Build)) sb.Append("-(" + this.Build+")");
return sb.ToString() ;
}
}


Expand Down

0 comments on commit ec13087

Please sign in to comment.