[OOBE]Hide "x64 ARM64 Installer Hash" lines in "What's New" (#18835)

This commit is contained in:
lncubus
2022-06-19 12:16:40 +02:00
committed by GitHub
parent 35c1438514
commit 759ea40b22

View File

@@ -52,6 +52,12 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
DataContext = ViewModel;
}
/// <summary>
/// Regex to remove installer hash sections from the release notes.
/// </summary>
private const string RemoveInstallerHashesRegex = @"((\r\n)+#+ installer hashes)?((\r\n)+#+( x64)?( arm64)? installer( SHA256)? hash(\r\n)+[0-9A-F]{64})+";
private const RegexOptions RemoveInstallerHashesRegexOptions = RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant;
private static async Task<string> GetReleaseNotesMarkdown()
{
string releaseNotesJSON = string.Empty;
@@ -78,12 +84,13 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
StringBuilder releaseNotesHtmlBuilder = new StringBuilder(string.Empty);
// Regex to remove installer hash sections from the release notes.
Regex removeHashRegex = new Regex(@"(\r\n)+#+ installer( SHA256)? hash(\r\n)+[0-9A-F]{64}", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
Regex removeHashRegex = new Regex(RemoveInstallerHashesRegex, RemoveInstallerHashesRegexOptions);
foreach (var release in latestReleases)
{
releaseNotesHtmlBuilder.AppendLine("# " + release.Name);
releaseNotesHtmlBuilder.AppendLine(removeHashRegex.Replace(release.ReleaseNotes, string.Empty));
var notes = removeHashRegex.Replace(release.ReleaseNotes, string.Empty);
releaseNotesHtmlBuilder.AppendLine(notes);
releaseNotesHtmlBuilder.AppendLine("&nbsp;");
}