Things for the changelog.
This commit is contained in:
parent
54979f9a69
commit
18195be91d
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Katteker.Gui.Properties;
|
using Katteker.Gui.Properties;
|
||||||
@ -95,8 +96,9 @@ namespace Katteker.Gui
|
|||||||
|
|
||||||
private async void UpdateWindow_Load(object sender, EventArgs e)
|
private async void UpdateWindow_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var changelog = await ChangelogHelper.LoadChangelogAsync(Changelog, PublishPath).ConfigureAwait(false);
|
var changelogContent = await ChangelogHelper.LoadChangelogAsync(Changelog, PublishPath).ConfigureAwait(false);
|
||||||
Invoke(new Action(() => changelogBrowser.DocumentText = changelog));
|
changelogContent = changelogContent.ChangelogAsHtml(Path.GetExtension(Changelog));
|
||||||
|
Invoke(new Action(() => changelogBrowser.DocumentText = changelogContent));
|
||||||
if (_entry == null)
|
if (_entry == null)
|
||||||
{
|
{
|
||||||
Invoke(new Action(() => { WriteTitle(Resources.No_update_available); }));
|
Invoke(new Action(() => { WriteTitle(Resources.No_update_available); }));
|
||||||
|
@ -7,7 +7,7 @@ namespace Katteker
|
|||||||
{
|
{
|
||||||
public static class ChangelogHelper
|
public static class ChangelogHelper
|
||||||
{
|
{
|
||||||
private static string GenerateChangelogAsHtml(string text, string extension)
|
public static string ChangelogAsHtml(this string text, string extension)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
switch (extension)
|
switch (extension)
|
||||||
@ -39,23 +39,30 @@ namespace Katteker
|
|||||||
using (var response = await webReq.GetResponseAsync().ConfigureAwait(false))
|
using (var response = await webReq.GetResponseAsync().ConfigureAwait(false))
|
||||||
using (var sr = new StreamReader(response.GetResponseStream()))
|
using (var sr = new StreamReader(response.GetResponseStream()))
|
||||||
{
|
{
|
||||||
return GenerateChangelogAsHtml(await sr.ReadToEndAsync().ConfigureAwait(false),
|
return await sr.ReadToEndAsync().ConfigureAwait(false);
|
||||||
Path.GetExtension(filename));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (WebException)
|
catch (Exception)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var changelogFilename = Path.GetFileName(filename);
|
var changelogFilename = Path.GetFileName(filename);
|
||||||
if (changelogFilename == null) return GenerateChangelogAsHtml("Changelog not found", ".txt");
|
if (changelogFilename == null) return null;
|
||||||
var currentChangelogPath = Path.Combine(Environment.CurrentDirectory, changelogFilename);
|
var currentChangelogPath = Path.Combine(Environment.CurrentDirectory, changelogFilename);
|
||||||
if (File.Exists(currentChangelogPath))
|
if (File.Exists(currentChangelogPath))
|
||||||
{
|
{
|
||||||
return GenerateChangelogAsHtml(File.ReadAllText(currentChangelogPath), Path.GetExtension(filename));
|
return File.ReadAllText(currentChangelogPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GenerateChangelogAsHtml("Changelog not found", ".txt");
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||||
// indem Sie "*" wie unten gezeigt eingeben:
|
// indem Sie "*" wie unten gezeigt eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.2")]
|
[assembly: AssemblyVersion("1.0.3")]
|
||||||
[assembly: AssemblyFileVersion("1.0.2")]
|
[assembly: AssemblyFileVersion("1.0.3")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user