diff --git a/Katteker.Gui/UpdateWindow.cs b/Katteker.Gui/UpdateWindow.cs index 491bcd3..d7087fc 100644 --- a/Katteker.Gui/UpdateWindow.cs +++ b/Katteker.Gui/UpdateWindow.cs @@ -1,5 +1,6 @@ using System; using System.Drawing; +using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; using Katteker.Gui.Properties; @@ -95,8 +96,9 @@ namespace Katteker.Gui private async void UpdateWindow_Load(object sender, EventArgs e) { - var changelog = await ChangelogHelper.LoadChangelogAsync(Changelog, PublishPath).ConfigureAwait(false); - Invoke(new Action(() => changelogBrowser.DocumentText = changelog)); + var changelogContent = await ChangelogHelper.LoadChangelogAsync(Changelog, PublishPath).ConfigureAwait(false); + changelogContent = changelogContent.ChangelogAsHtml(Path.GetExtension(Changelog)); + Invoke(new Action(() => changelogBrowser.DocumentText = changelogContent)); if (_entry == null) { Invoke(new Action(() => { WriteTitle(Resources.No_update_available); })); diff --git a/Katteker/ChangelogHelper.cs b/Katteker/ChangelogHelper.cs index 545a192..0c4fec4 100644 --- a/Katteker/ChangelogHelper.cs +++ b/Katteker/ChangelogHelper.cs @@ -7,7 +7,7 @@ namespace Katteker { public static class ChangelogHelper { - private static string GenerateChangelogAsHtml(string text, string extension) + public static string ChangelogAsHtml(this string text, string extension) { string result; switch (extension) @@ -39,23 +39,30 @@ namespace Katteker using (var response = await webReq.GetResponseAsync().ConfigureAwait(false)) using (var sr = new StreamReader(response.GetResponseStream())) { - return GenerateChangelogAsHtml(await sr.ReadToEndAsync().ConfigureAwait(false), - Path.GetExtension(filename)); + return await sr.ReadToEndAsync().ConfigureAwait(false); } } - catch (WebException) + catch (Exception) { - var changelogFilename = Path.GetFileName(filename); - if (changelogFilename == null) return GenerateChangelogAsHtml("Changelog not found", ".txt"); - var currentChangelogPath = Path.Combine(Environment.CurrentDirectory, changelogFilename); - if (File.Exists(currentChangelogPath)) + try { - return GenerateChangelogAsHtml(File.ReadAllText(currentChangelogPath), Path.GetExtension(filename)); + var changelogFilename = Path.GetFileName(filename); + if (changelogFilename == null) return null; + var currentChangelogPath = Path.Combine(Environment.CurrentDirectory, changelogFilename); + if (File.Exists(currentChangelogPath)) + { + return File.ReadAllText(currentChangelogPath); + } + + } + catch (Exception) + { + // ignore; } } } - return GenerateChangelogAsHtml("Changelog not found", ".txt"); + return null; } } } \ No newline at end of file diff --git a/Katteker/Properties/AssemblyInfo.cs b/Katteker/Properties/AssemblyInfo.cs index dd23e8e..f69120d 100644 --- a/Katteker/Properties/AssemblyInfo.cs +++ b/Katteker/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.2")] -[assembly: AssemblyFileVersion("1.0.2")] +[assembly: AssemblyVersion("1.0.3")] +[assembly: AssemblyFileVersion("1.0.3")]