Skip to content

Commit

Permalink
Add released date and changelog to updater
Browse files Browse the repository at this point in the history
  • Loading branch information
Gwindalmir committed Sep 4, 2021
1 parent 8e4de9d commit 3dbfeb8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 15 additions & 1 deletion WorkshopToolCommon/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Sandbox;
using Gwindalmir.Updater;
using Sandbox;
using Steamworks;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -142,4 +143,17 @@ public static bool IsInteractive(this TextWriter stream)
return false;
}
}

public static class UpdaterExtensions
{
public static string GetChangelog(this Release release)
{
var end = release.Body.IndexOf("To Install");

if (end <= 0)
end = release.Body.Length;

return release.Body.Substring(0, end).Trim();
}
}
}
4 changes: 3 additions & 1 deletion WorkshopToolCommon/ProgramBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ internal static void CheckForUpdate(Action<string> logMethod = null, Action<stri
if (!string.IsNullOrEmpty(asset?.Url))
{
ConsoleWriteColored(ConsoleColor.Green, () =>
logMethod($"Update Check: UPDATE AVAILABLE: {Assembly.GetEntryAssembly().GetName().Name} {release.TagName}"));
logMethod($"Update Check: UPDATE AVAILABLE: {release.TagName}, released {release.Published.ToLocalTime()}"));
logMethod($"Download at: {asset.Url}");

logMethod($"Changelog:\n{release.GetChangelog()}");
return;
}
}
Expand Down

0 comments on commit 3dbfeb8

Please sign in to comment.