Add changelog during update

Thanks @Abrynos
This commit is contained in:
JustArchi
2018-09-21 03:29:54 +02:00
parent 18cd620db8
commit 3b82187824
6 changed files with 29 additions and 2 deletions

View File

@@ -197,6 +197,14 @@ namespace ArchiSteamFarm {
return null;
}
if (!string.IsNullOrEmpty(releaseResponse.ReleaseNotesInMarkdown)) {
string plainText = Utilities.MarkdownToText(releaseResponse.ReleaseNotesInMarkdown);
if (!string.IsNullOrEmpty(plainText)) {
ArchiLogger.LogGenericInfo(string.Format(Strings.UpdateChangelog, plainText));
}
}
ArchiLogger.LogGenericInfo(string.Format(Strings.UpdateDownloadingNewVersion, newVersion, binaryAsset.Size / 1024 / 1024));
WebBrowser.BinaryResponse response = await Program.WebBrowser.UrlGetToBinaryWithProgress(binaryAsset.DownloadURL).ConfigureAwait(false);

View File

@@ -63,7 +63,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
return BadRequest(new GenericResponse<string>(false, string.Format(Strings.ErrorIsEmpty, nameof(text))));
}
return Ok(new GenericResponse<string>(ArchiSteamFarm.Utilities.MarkdownToText(text)));
return Ok(new GenericResponse<string>(Utilities.MarkdownToText(text)));
}
[HttpPost("Send")]

View File

@@ -30,6 +30,9 @@ namespace ArchiSteamFarm.JSON {
[JsonProperty(PropertyName = "assets", Required = Required.Always)]
internal readonly HashSet<Asset> Assets;
[JsonProperty(PropertyName = "body", Required = Required.Always)]
internal readonly string ReleaseNotesInMarkdown;
[JsonProperty(PropertyName = "tag_name", Required = Required.Always)]
internal readonly string Tag;

View File

@@ -1251,6 +1251,16 @@ namespace ArchiSteamFarm.Localization {
}
}
/// <summary>
/// Wyszukuje zlokalizowany ciąg podobny do ciągu Changelog:
///{0}.
/// </summary>
internal static string UpdateChangelog {
get {
return ResourceManager.GetString("UpdateChangelog", resourceCulture);
}
}
/// <summary>
/// Wyszukuje zlokalizowany ciąg podobny do ciągu Checking for new version....
/// </summary>

View File

@@ -658,4 +658,9 @@ StackTrace:
<value>Workaround for {0} bug has been triggered.</value>
<comment>{0} will be replaced by the bug's name provided by ASF</comment>
</data>
<data name="UpdateChangelog" xml:space="preserve">
<value>Changelog:
{0}</value>
<comment>{0} will be replaced by complete changelog text from GitHub (in english). Please note that this string should include newlines for formatting.</comment>
</data>
</root>

View File

@@ -30,6 +30,7 @@ using System.Threading;
using System.Threading.Tasks;
using Humanizer;
using Humanizer.Localisation;
using Markdig;
namespace ArchiSteamFarm {
internal static class Utilities {
@@ -183,7 +184,7 @@ namespace ArchiSteamFarm {
return null;
}
string plainText = Markdig.Markdown.ToPlainText(markdownText);
string plainText = Markdown.ToPlainText(markdownText);
if (plainText == null) {
ASF.ArchiLogger.LogNullError(nameof(plainText));
return null;