Compare commits
No commits in common. "18195be91dafda128f2ef2bd23e58f08ccd569dd" and "b2ef60a595732144be6dbddbecfe4233e3a9c4bb" have entirely different histories.
18195be91d
...
b2ef60a595
@ -89,6 +89,7 @@ namespace KattekerCreator
|
|||||||
return semanticVersion?.Change(build: string.Empty);
|
return semanticVersion?.Change(build: string.Empty);
|
||||||
Version.TryParse(productVersion, out var version);
|
Version.TryParse(productVersion, out var version);
|
||||||
return SemanticVersion.Parse(version.ToString(3));
|
return SemanticVersion.Parse(version.ToString(3));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using Vestris.ResourceLib;
|
using Vestris.ResourceLib;
|
||||||
|
|
||||||
namespace KattekerCreator.Helper
|
namespace KattekerCreator.Helper
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
<Compile Include="IconExtractor\IconExtractor.cs" />
|
<Compile Include="IconExtractor\IconExtractor.cs" />
|
||||||
<Compile Include="IconExtractor\IconUtil.cs" />
|
<Compile Include="IconExtractor\IconUtil.cs" />
|
||||||
<Compile Include="IconExtractor\NativeMethods.cs" />
|
<Compile Include="IconExtractor\NativeMethods.cs" />
|
||||||
<Compile Include="PathFragments.cs" />
|
|
||||||
<Compile Include="PhysicalFile.cs" />
|
<Compile Include="PhysicalFile.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace KattekerCreator
|
|
||||||
{
|
|
||||||
public class PathFragments
|
|
||||||
{
|
|
||||||
private readonly string[] _fragments;
|
|
||||||
|
|
||||||
public PathFragments(string path)
|
|
||||||
{
|
|
||||||
_fragments = path.Split(Path.DirectorySeparatorChar);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int FragmentLength => _fragments.Length;
|
|
||||||
|
|
||||||
public override bool Equals(object obj) => string.Equals(ToString(), obj?.ToString());
|
|
||||||
|
|
||||||
public override int GetHashCode() => (_fragments != null ? _fragments.GetHashCode() : 0);
|
|
||||||
|
|
||||||
public override string ToString() => string.Join(Path.DirectorySeparatorChar.ToString(), _fragments.Take(_fragments.Length - 1));
|
|
||||||
|
|
||||||
protected bool Equals(PathFragments other) => Equals(_fragments, other._fragments);
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,13 +2,13 @@
|
|||||||
{
|
{
|
||||||
public class PhysicalFile
|
public class PhysicalFile
|
||||||
{
|
{
|
||||||
public PhysicalFile(string source, string target)
|
public PhysicalFile(string sourcePath, string targetPath)
|
||||||
{
|
{
|
||||||
Source = source;
|
SourcePath = sourcePath;
|
||||||
Target = target;
|
TargetPath = targetPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Source { get; }
|
public string SourcePath { get; }
|
||||||
public string Target { get; }
|
public string TargetPath { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -69,11 +69,14 @@ namespace KattekerCreator
|
|||||||
//Start makensis.exe
|
//Start makensis.exe
|
||||||
var setupFilePath = CompileSetupScript(templateFile);
|
var setupFilePath = CompileSetupScript(templateFile);
|
||||||
//Copy to Output-Folder
|
//Copy to Output-Folder
|
||||||
CopyToOutputFolder(setupFilePath);
|
if (CopyToOutputFolder(setupFilePath))
|
||||||
|
{
|
||||||
//Create/Modify RELEASE File
|
//Create/Modify RELEASE File
|
||||||
var releaseEntry = AddPackageToReleaseFile(setupFilePath);
|
var releaseEntry = AddPackageToReleaseFile(setupFilePath);
|
||||||
//Copy installer as setup.exe
|
//Copy installer as setup.exe
|
||||||
CopyAsSetup(setupFilePath, releaseEntry);
|
CopyAsSetup(setupFilePath, releaseEntry);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,20 +103,31 @@ namespace KattekerCreator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CopyToOutputFolder(string setupFilePath)
|
private bool CopyToOutputFolder(string setupFilePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (setupFilePath == null) throw new ArgumentNullException(nameof(setupFilePath));
|
if (setupFilePath == null) throw new ArgumentNullException(nameof(setupFilePath));
|
||||||
var setupFile = Path.GetFileName(setupFilePath);
|
var setupFile = Path.GetFileName(setupFilePath);
|
||||||
if (string.IsNullOrEmpty(setupFile)) throw new ArgumentException();
|
if (string.IsNullOrEmpty(setupFile)) throw new ArgumentException();
|
||||||
if (!File.Exists(setupFilePath)) throw new FileNotFoundException(setupFile);
|
if (!File.Exists(setupFilePath)) throw new FileNotFoundException(setupFile);
|
||||||
if (!Directory.Exists(_appArguments.OutputDir)) Directory.CreateDirectory(_appArguments.OutputDir);
|
|
||||||
if (!string.IsNullOrEmpty(_appArguments.ChangeLog))
|
if (!string.IsNullOrEmpty(_appArguments.ChangeLog))
|
||||||
{
|
{
|
||||||
|
|
||||||
var changeLogPath = Path.Combine(Path.GetDirectoryName(_appArguments.ProgramFile), _appArguments.ChangeLog);
|
var changeLogPath = Path.Combine(Path.GetDirectoryName(_appArguments.ProgramFile), _appArguments.ChangeLog);
|
||||||
if (!File.Exists(changeLogPath)) throw new FileNotFoundException(changeLogPath);
|
if (!File.Exists(changeLogPath)) throw new FileNotFoundException(changeLogPath);
|
||||||
File.Copy(changeLogPath, Path.Combine(_appArguments.OutputDir, _appArguments.ChangeLog), true);
|
File.Copy(changeLogPath, Path.Combine(_appArguments.OutputDir, Path.GetFileName(_appArguments.ChangeLog) ?? throw new InvalidOperationException()), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Directory.Exists(_appArguments.OutputDir)) Directory.CreateDirectory(_appArguments.OutputDir);
|
||||||
File.Copy(setupFilePath, Path.Combine(_appArguments.OutputDir, setupFile), true);
|
File.Copy(setupFilePath, Path.Combine(_appArguments.OutputDir, setupFile), true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.WriteErrorLine(e.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string CompileSetupScript(string templateFile)
|
private static string CompileSetupScript(string templateFile)
|
||||||
|
@ -56,7 +56,7 @@ Section "install" ;No components page, name is not important
|
|||||||
<# foreach(var directory in Directories) { #><#= $" CreateDirectory \"$INSTDIR\\{directory}\"{Environment.NewLine}" #><# } #>
|
<# foreach(var directory in Directories) { #><#= $" CreateDirectory \"$INSTDIR\\{directory}\"{Environment.NewLine}" #><# } #>
|
||||||
|
|
||||||
; Put file there
|
; Put file there
|
||||||
<#foreach(var file in Files) { #><#= $" File \"/oname={file.Target}\" \"{file.Source}\"{Environment.NewLine}" #><# } #>
|
<#foreach(var file in Files) { #><#= $" File \"/oname={file.TargetPath}\" \"{file.SourcePath}\"{Environment.NewLine}" #><# } #>
|
||||||
|
|
||||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||||
; Desktop
|
; Desktop
|
||||||
|
@ -30,21 +30,55 @@ namespace KattekerCreator
|
|||||||
public string UninstallIcon { get; set; }
|
public string UninstallIcon { get; set; }
|
||||||
public string ReleaseChannel { get; set; }
|
public string ReleaseChannel { get; set; }
|
||||||
|
|
||||||
private readonly List<PathFragments> _directoriesList = new List<PathFragments>();
|
private readonly List<DirSplit> _directoriesList = new List<DirSplit>();
|
||||||
private string _appName;
|
private string _appName;
|
||||||
|
|
||||||
private IEnumerable<string> DirectoriesToCreate()
|
private IEnumerable<string> DirectoriesToCreate()
|
||||||
{
|
{
|
||||||
foreach (var physicalFile in Files)
|
foreach (var physicalFile in Files)
|
||||||
{
|
{
|
||||||
var dirSplit = new PathFragments(physicalFile.Target);
|
var dirSplit = new DirSplit(physicalFile.TargetPath);
|
||||||
if (dirSplit.FragmentLength > 1 && !_directoriesList.Contains(dirSplit))
|
if (dirSplit.SplitCount > 1 && !_directoriesList.Contains(dirSplit))
|
||||||
{
|
{
|
||||||
_directoriesList.Add(dirSplit);
|
_directoriesList.Add(dirSplit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _directoriesList.Select(x => x.ToString());
|
return _directoriesList.Select(x=> x.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DirSplit
|
||||||
|
{
|
||||||
|
private const char SplitChar = '\\';
|
||||||
|
|
||||||
|
private readonly string[] _splits;
|
||||||
|
|
||||||
|
public int SplitCount => _splits.Length;
|
||||||
|
|
||||||
|
public DirSplit(string path)
|
||||||
|
{
|
||||||
|
_splits = path.Split(SplitChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return string.Join(SplitChar.ToString(), _splits.Take(_splits.Length - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return string.Equals(ToString(), obj?.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool Equals(DirSplit other)
|
||||||
|
{
|
||||||
|
return Equals(_splits, other._splits);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return (_splits != null ? _splits.GetHashCode() : 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,11 +8,10 @@
|
|||||||
Title="MainWindow"
|
Title="MainWindow"
|
||||||
Width="800"
|
Width="800"
|
||||||
Height="450"
|
Height="450"
|
||||||
Background="Chartreuse"
|
Background="DarkBlue"
|
||||||
ContentRendered="MainWindow_OnContentRendered"
|
ContentRendered="MainWindow_OnContentRendered"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Button Margin="10" FontSize="24" Content="Update" Click="ButtonBase_OnClick"></Button>
|
<Button Margin="10" FontSize="24" Content="Update" Click="ButtonBase_OnClick"></Button>
|
||||||
<TextBlock Text=":-(" FontSize="60" HorizontalAlignment="Center" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Window>
|
</Window>
|
@ -49,5 +49,5 @@ using System.Windows;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.48")]
|
[assembly: AssemblyVersion("1.0.36.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.48")]
|
[assembly: AssemblyFileVersion("1.0.36.0")]
|
||||||
|
@ -3,11 +3,11 @@ using System.IO;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Katteker
|
namespace Katteker.Gui
|
||||||
{
|
{
|
||||||
public static class ChangelogHelper
|
internal static class ChangelogHelper
|
||||||
{
|
{
|
||||||
public static string ChangelogAsHtml(this string text, string extension)
|
private static string GenerateHtmlifyChangelog(string text, string extension)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
switch (extension)
|
switch (extension)
|
||||||
@ -17,7 +17,7 @@ namespace Katteker
|
|||||||
result = plainText.Replace(Environment.NewLine, "<br />");
|
result = plainText.Replace(Environment.NewLine, "<br />");
|
||||||
break;
|
break;
|
||||||
case ".md":
|
case ".md":
|
||||||
result = new MarkdownSharp.Markdown().Transform(text);
|
result = CommonMark.CommonMarkConverter.Convert(text);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = text;
|
result = text;
|
||||||
@ -27,7 +27,7 @@ namespace Katteker
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<string> LoadChangelogAsync(string filename, string path)
|
internal static async Task<string> LoadChangelogAsync(string filename, string path)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(filename) || !string.IsNullOrEmpty(path))
|
if (!string.IsNullOrEmpty(filename) || !string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
@ -39,30 +39,23 @@ 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 await sr.ReadToEndAsync().ConfigureAwait(false);
|
return GenerateHtmlifyChangelog(await sr.ReadToEndAsync().ConfigureAwait(false),
|
||||||
|
Path.GetExtension(filename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (WebException)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var changelogFilename = Path.GetFileName(filename);
|
var changelogFilename = Path.GetFileName(filename);
|
||||||
if (changelogFilename == null) return null;
|
if (changelogFilename == null) return GenerateHtmlifyChangelog("Changelog not found", ".txt");
|
||||||
var currentChangelogPath = Path.Combine(Environment.CurrentDirectory, changelogFilename);
|
var currentChangelogPath = Path.Combine(Environment.CurrentDirectory, changelogFilename);
|
||||||
if (File.Exists(currentChangelogPath))
|
if (File.Exists(currentChangelogPath))
|
||||||
{
|
{
|
||||||
return File.ReadAllText(currentChangelogPath);
|
return GenerateHtmlifyChangelog(File.ReadAllText(currentChangelogPath), Path.GetExtension(filename));
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
// ignore;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return GenerateHtmlifyChangelog("Changelog not found", ".txt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,6 +34,9 @@
|
|||||||
<DocumentationFile>bin\Release\Katteker.Gui.xml</DocumentationFile>
|
<DocumentationFile>bin\Release\Katteker.Gui.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="CommonMark, Version=0.1.0.0, Culture=neutral, PublicKeyToken=001ef8810438905d, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\CommonMark.NET.0.15.1\lib\net45\CommonMark.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@ -42,6 +45,7 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="ChangelogHelper.cs" />
|
||||||
<Compile Include="Wrapper.cs" />
|
<Compile Include="Wrapper.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
@ -58,6 +62,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
@ -31,5 +31,6 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
// übernehmen, indem Sie "*" eingeben:
|
// übernehmen, indem Sie "*" eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyInformationalVersion("1.0.0")]
|
||||||
|
18
Katteker.Gui/Properties/Resources.Designer.cs
generated
18
Katteker.Gui/Properties/Resources.Designer.cs
generated
@ -60,15 +60,6 @@ namespace Katteker.Gui.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Could not update your application..
|
|
||||||
/// </summary>
|
|
||||||
internal static string CouldNotUpdateYourApplication {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("CouldNotUpdateYourApplication", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Installed new Version! Would you like to restart the Application?.
|
/// Looks up a localized string similar to Installed new Version! Would you like to restart the Application?.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -132,15 +123,6 @@ namespace Katteker.Gui.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Updater.
|
|
||||||
/// </summary>
|
|
||||||
internal static string Updater {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Updater", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to You can update to Version: .
|
/// Looks up a localized string similar to You can update to Version: .
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -144,10 +144,4 @@
|
|||||||
<data name="SquirrelWrapper_CheckForUpdate_AskYourLocalDistributor" xml:space="preserve">
|
<data name="SquirrelWrapper_CheckForUpdate_AskYourLocalDistributor" xml:space="preserve">
|
||||||
<value> Ask your local distributor.</value>
|
<value> Ask your local distributor.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Updater" xml:space="preserve">
|
|
||||||
<value>Updater</value>
|
|
||||||
</data>
|
|
||||||
<data name="CouldNotUpdateYourApplication" xml:space="preserve">
|
|
||||||
<value>Could not update your application.</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
13
Katteker.Gui/UpdateWindow.Designer.cs
generated
13
Katteker.Gui/UpdateWindow.Designer.cs
generated
@ -21,6 +21,7 @@ namespace Katteker.Gui
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdateWindow));
|
||||||
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
|
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||||
this.titleLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
this.titleLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.closeWindowBtn = new System.Windows.Forms.Button();
|
this.closeWindowBtn = new System.Windows.Forms.Button();
|
||||||
@ -84,7 +85,6 @@ namespace Katteker.Gui
|
|||||||
this.titleLayoutPanel.Controls.Add(this.minimizeBtn, 2, 0);
|
this.titleLayoutPanel.Controls.Add(this.minimizeBtn, 2, 0);
|
||||||
this.titleLayoutPanel.Controls.Add(this.label1, 0, 0);
|
this.titleLayoutPanel.Controls.Add(this.label1, 0, 0);
|
||||||
this.titleLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.titleLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.titleLayoutPanel.ForeColor = System.Drawing.SystemColors.Control;
|
|
||||||
this.titleLayoutPanel.Location = new System.Drawing.Point(0, 0);
|
this.titleLayoutPanel.Location = new System.Drawing.Point(0, 0);
|
||||||
this.titleLayoutPanel.Name = "titleLayoutPanel";
|
this.titleLayoutPanel.Name = "titleLayoutPanel";
|
||||||
this.titleLayoutPanel.RowCount = 1;
|
this.titleLayoutPanel.RowCount = 1;
|
||||||
@ -101,6 +101,7 @@ namespace Katteker.Gui
|
|||||||
this.closeWindowBtn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Red;
|
this.closeWindowBtn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Red;
|
||||||
this.closeWindowBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
this.closeWindowBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
this.closeWindowBtn.Font = new System.Drawing.Font("Segoe UI Symbol", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.closeWindowBtn.Font = new System.Drawing.Font("Segoe UI Symbol", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.closeWindowBtn.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
this.closeWindowBtn.Location = new System.Drawing.Point(658, 0);
|
this.closeWindowBtn.Location = new System.Drawing.Point(658, 0);
|
||||||
this.closeWindowBtn.Margin = new System.Windows.Forms.Padding(0);
|
this.closeWindowBtn.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.closeWindowBtn.Name = "closeWindowBtn";
|
this.closeWindowBtn.Name = "closeWindowBtn";
|
||||||
@ -117,6 +118,7 @@ namespace Katteker.Gui
|
|||||||
this.maximizeBtn.FlatAppearance.BorderSize = 0;
|
this.maximizeBtn.FlatAppearance.BorderSize = 0;
|
||||||
this.maximizeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
this.maximizeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
this.maximizeBtn.Font = new System.Drawing.Font("Segoe UI Symbol", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.maximizeBtn.Font = new System.Drawing.Font("Segoe UI Symbol", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.maximizeBtn.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
this.maximizeBtn.Location = new System.Drawing.Point(618, 0);
|
this.maximizeBtn.Location = new System.Drawing.Point(618, 0);
|
||||||
this.maximizeBtn.Margin = new System.Windows.Forms.Padding(0);
|
this.maximizeBtn.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.maximizeBtn.Name = "maximizeBtn";
|
this.maximizeBtn.Name = "maximizeBtn";
|
||||||
@ -131,11 +133,12 @@ namespace Katteker.Gui
|
|||||||
//
|
//
|
||||||
this.titlebar.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.titlebar.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.titlebar.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.titlebar.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.titlebar.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
this.titlebar.Location = new System.Drawing.Point(123, 0);
|
this.titlebar.Location = new System.Drawing.Point(123, 0);
|
||||||
this.titlebar.Name = "titlebar";
|
this.titlebar.Name = "titlebar";
|
||||||
this.titlebar.Size = new System.Drawing.Size(452, 30);
|
this.titlebar.Size = new System.Drawing.Size(452, 30);
|
||||||
this.titlebar.TabIndex = 0;
|
this.titlebar.TabIndex = 0;
|
||||||
this.titlebar.Text = "Updater";
|
this.titlebar.Text = "titleBar";
|
||||||
this.titlebar.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
this.titlebar.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
this.titlebar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Titlebar_MouseDown);
|
this.titlebar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Titlebar_MouseDown);
|
||||||
//
|
//
|
||||||
@ -145,6 +148,7 @@ namespace Katteker.Gui
|
|||||||
this.minimizeBtn.FlatAppearance.BorderSize = 0;
|
this.minimizeBtn.FlatAppearance.BorderSize = 0;
|
||||||
this.minimizeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
this.minimizeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
this.minimizeBtn.Font = new System.Drawing.Font("Segoe UI Symbol", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.minimizeBtn.Font = new System.Drawing.Font("Segoe UI Symbol", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.minimizeBtn.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
this.minimizeBtn.Location = new System.Drawing.Point(578, 0);
|
this.minimizeBtn.Location = new System.Drawing.Point(578, 0);
|
||||||
this.minimizeBtn.Margin = new System.Windows.Forms.Padding(0);
|
this.minimizeBtn.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.minimizeBtn.Name = "minimizeBtn";
|
this.minimizeBtn.Name = "minimizeBtn";
|
||||||
@ -159,6 +163,7 @@ namespace Katteker.Gui
|
|||||||
//
|
//
|
||||||
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.label1.Font = new System.Drawing.Font("Segoe UI Symbol", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.label1.Font = new System.Drawing.Font("Segoe UI Symbol", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.label1.ForeColor = System.Drawing.SystemColors.Window;
|
||||||
this.label1.Location = new System.Drawing.Point(3, 0);
|
this.label1.Location = new System.Drawing.Point(3, 0);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(114, 30);
|
this.label1.Size = new System.Drawing.Size(114, 30);
|
||||||
@ -271,13 +276,11 @@ namespace Katteker.Gui
|
|||||||
this.DoubleBuffered = true;
|
this.DoubleBuffered = true;
|
||||||
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||||
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "UpdateWindow";
|
this.Name = "UpdateWindow";
|
||||||
this.ShowIcon = false;
|
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Activated += new System.EventHandler(this.UpdateWindow_Activated);
|
|
||||||
this.Deactivate += new System.EventHandler(this.UpdateWindow_Deactivate);
|
|
||||||
this.Load += new System.EventHandler(this.UpdateWindow_Load);
|
this.Load += new System.EventHandler(this.UpdateWindow_Load);
|
||||||
this.mainSplitContainer.Panel1.ResumeLayout(false);
|
this.mainSplitContainer.Panel1.ResumeLayout(false);
|
||||||
this.mainSplitContainer.Panel2.ResumeLayout(false);
|
this.mainSplitContainer.Panel2.ResumeLayout(false);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
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;
|
||||||
@ -9,18 +8,14 @@ namespace Katteker.Gui
|
|||||||
{
|
{
|
||||||
public sealed partial class UpdateWindow : Form
|
public sealed partial class UpdateWindow : Form
|
||||||
{
|
{
|
||||||
private readonly UpdateManager _updateManager;
|
|
||||||
private readonly ReleaseEntry _entry;
|
|
||||||
private const int HTCAPTION = 0x2;
|
private const int HTCAPTION = 0x2;
|
||||||
private const int WM_NCLBUTTONDOWN = 0xA1;
|
private const int WM_NCLBUTTONDOWN = 0xA1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Update Window
|
/// The Update Window
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UpdateWindow(UpdateManager updateManager, ReleaseEntry entry)
|
public UpdateWindow()
|
||||||
{
|
{
|
||||||
_updateManager = updateManager;
|
|
||||||
_entry = entry;
|
|
||||||
Font = SystemFonts.MessageBoxFont;
|
Font = SystemFonts.MessageBoxFont;
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
if (Environment.OSVersion.Version.Major >= 6)
|
if (Environment.OSVersion.Version.Major >= 6)
|
||||||
@ -28,9 +23,19 @@ namespace Katteker.Gui
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string Changelog => _updateManager.ChangelogFilename;
|
private string Changelog => UpdateManager.ChangelogFilename;
|
||||||
|
|
||||||
private string PublishPath => _updateManager.UrlOrPath;
|
/// <summary>
|
||||||
|
/// Last release entry.
|
||||||
|
/// </summary>
|
||||||
|
public ReleaseEntry ReleaseEntry { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update manager
|
||||||
|
/// </summary>
|
||||||
|
public UpdateManager UpdateManager { get; set; }
|
||||||
|
|
||||||
|
private string PublishPath => UpdateManager.UrlOrPath;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -71,41 +76,22 @@ namespace Katteker.Gui
|
|||||||
|
|
||||||
private void Titlebar_MouseDown(object sender, MouseEventArgs e)
|
private void Titlebar_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Button == MouseButtons.Left && e.Clicks >= 2)
|
|
||||||
{
|
|
||||||
MaximizeBtn_Click(sender, e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (e.Button != MouseButtons.Left) return;
|
if (e.Button != MouseButtons.Left) return;
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
|
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void UpdateWindow_Activated(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
titleLayoutPanel.BackColor = SystemColors.ControlDarkDark;
|
|
||||||
titleLayoutPanel.ForeColor = SystemColors.Control;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateWindow_Deactivate(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
titleLayoutPanel.BackColor = SystemColors.Control;
|
|
||||||
titleLayoutPanel.ForeColor = SystemColors.ControlText;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void UpdateWindow_Load(object sender, EventArgs e)
|
private async void UpdateWindow_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var changelogContent = await ChangelogHelper.LoadChangelogAsync(Changelog, PublishPath).ConfigureAwait(false);
|
var changelog = await ChangelogHelper.LoadChangelogAsync(Changelog, PublishPath).ConfigureAwait(false);
|
||||||
changelogContent = changelogContent.ChangelogAsHtml(Path.GetExtension(Changelog));
|
Invoke(new Action(() => changelogBrowser.DocumentText = changelog));
|
||||||
Invoke(new Action(() => changelogBrowser.DocumentText = changelogContent));
|
if (ReleaseEntry == null)
|
||||||
if (_entry == null)
|
|
||||||
{
|
{
|
||||||
Invoke(new Action(() => { WriteTitle(Resources.No_update_available); }));
|
Invoke(new Action(() => { WriteTitle(Resources.No_update_available); }));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var latest = _entry.Version;
|
var latest = ReleaseEntry.Version;
|
||||||
Invoke(new Action(() =>
|
Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
WriteTitle(Resources.You_can_update_to_Version + latest);
|
WriteTitle(Resources.You_can_update_to_Version + latest);
|
||||||
@ -121,9 +107,20 @@ namespace Katteker.Gui
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var progress = new Progress<int>(x => Invoke(new Action(() => { progressBar1.Value = x; })));
|
var progress = new Progress<int>(x => Invoke(new Action(() => { progressBar1.Value = x; })));
|
||||||
await _updateManager.UpdateAppAsync(progress).ConfigureAwait(false);
|
await UpdateManager.UpdateAppAsync(progress).ConfigureAwait(false);
|
||||||
|
|
||||||
WriteTitle(Resources.You_re_up_to_date);
|
WriteTitle(Resources.You_re_up_to_date);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
WriteTitle(ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
progressBar1.Visible = false;
|
||||||
|
updBtn.Visible = false;
|
||||||
var messResult = MessageBox.Show(
|
var messResult = MessageBox.Show(
|
||||||
Resources.Installed_new_Version,
|
Resources.Installed_new_Version,
|
||||||
Resources.New_Version,
|
Resources.New_Version,
|
||||||
@ -134,23 +131,9 @@ namespace Katteker.Gui
|
|||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(Resources.CouldNotUpdateYourApplication + Environment.NewLine + ex.Message, Gui.Properties.Resources.Updater, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
WriteTitle(Resources.Updater);
|
|
||||||
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
progressBar1.Visible = false;
|
|
||||||
updBtn.Visible = false;
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteTitle(string text)
|
private void WriteTitle(string text)
|
||||||
{
|
{
|
||||||
Invoke(new Action(() =>
|
Invoke(new Action(() =>
|
||||||
|
@ -117,4 +117,81 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABYYGwFCSV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k6+2/7vc3v+339f/xPXv/9r////Z////2f///6DG
|
||||||
|
w/+22d7/2v///8X4/f9ehZvPubuYAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACYnpg7apO398//
|
||||||
|
///T////p8bM/y8sX/8/MH3/NTBx/zAmXP9bZHv/psbK/8z4+f/Y////jau2/3B7ov98gqf/hZWd/7/m
|
||||||
|
4f/a////xe30/8L7/f/a////eqfG/3WEk4EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGR3
|
||||||
|
lbWw5/L/0v///9P///+Jp67/Lydl/zgubP8xOFv/kKmx/9T++//N////1v///6S8wf97d6r/trD//7Wv
|
||||||
|
//+gm+H/X3GM/7DY3v/N/Pn/1////4691/9Nboa3xMKtBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALTF
|
||||||
|
mw2Ln5NQfqPD/9P////N+f//2f///3WKlP8rImH/Nz5m/6zN0P/a////yfv//8z7///N9uj/cn6d/7Wx
|
||||||
|
+v+srPj/n5ve/3t3ov9JWoD/W4i0/2aax/9chrf/UnKM1K64lRoAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAmpuYUnOEmKuv3+n/z/7//8z8/P/a////b3iN/yYpS/+iw87/1////8z8/P/O/P3/2P///5i9
|
||||||
|
0P9SXoT/doOz/19rkf9IS2D/Z2ls/5GWnP91gpr/ZJDE/0hytf+KlYiDAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAABje5eGbY6k2cX9/v/P/f//yfj7/5/Awv8+SVL/bH2B/+D////J+f//0f///8Pz
|
||||||
|
+v9smLD/Pl59/2Jmdv9ecZT/ZX6f/6Ouuf////////////r49P+RoKv/UXiw/159lJwAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAGF9nYltlq3cx////9D7///L+f3/v+Pm/6nDyP94nJn/vevn/9f/
|
||||||
|
//+75+7/Tnmi/1Jpiv/V2df/9vr4/9Pc4/+CiY3/5ubn/8XHx/+YnJ///////+no4/9aeJz/P2abtgAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmJyVU3yTl6u97vb/z/3//8z7/f/M////1f///8/5
|
||||||
|
+//Q/f7/uefs/0l6rv9bbY7/4Nzi/////P/q7en//////+fm5f/HxMP/fHl4/zEvMf/4+Pz/7+7s/2J/
|
||||||
|
mv9WdqDNs6yOAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC6uqAElp6UQoSqxf/Q////z/3//838
|
||||||
|
///N/v3/2f///7zm8f9HdqT/V4nE/3uFl///////kpeU/yIhJv/n4+H//////7a0s//v7u3/6enm////
|
||||||
|
//+4t7X/X4Sn/1N8s/ylraAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADI0LgCdYqWmXeh
|
||||||
|
vP656/j/yvn//8n1/v+czNr/R3Sg/1aHyP94p+L/dYKP//v7+f/IyMv/gICE//Tx8///////f4SL/7q4
|
||||||
|
uv/c4eP/qK+t/1ReZv9WdJj/Y47M/0VtlMNujZWShJiUL7O9tQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAjJOLS2mJmNFtj6XsaJCX6DpchPFAcrT/gqvi/3io4P9lhK3/r7K3/////////////////7Oz
|
||||||
|
q/9YfZ7/W4W2/0ZUcP9OXXT/Ynen/3Sj1f91ptv/WIbH/0Vwsf9EcbD+cImVtbu/ogoAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAwdKpC622sRSnv7ARpLOtJkRrltptoND/eaba/3Gj4f9ngKH/ipCW/5+n
|
||||||
|
rf93gIT/SlVz/1p1m/90qtv/ZY64/32k1P90ntD/XY3L/zpuj/9gh8L/bJ3W/3uk2/9Vicr/cIqQeZGm
|
||||||
|
kyoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJadk0xUgLX/cp3a/3Wh2v9ReqLWcHuVBwAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtr+jJENtlehZjdH/VH22/3uU
|
||||||
|
l38AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAg6KaP3KG
|
||||||
|
jb2MnJd0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAA/wB///8Af///gH///4Af//+AA///AAD//gAAf/4AAD/8AAAf+AAAD/AA
|
||||||
|
AA/wAAAP4AAAH+AAAB+AAAA/gAAAf4AAAH+AAAB/gAAAP4AAAD/AAAAH8AAAA/gAAAH/gAAB/4ABgf/A
|
||||||
|
A///wA///8H////A////wP///8H////j//8=
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -1,5 +1,5 @@
|
|||||||
using System.Linq;
|
using System;
|
||||||
using System.Threading;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Katteker.Gui.Properties;
|
using Katteker.Gui.Properties;
|
||||||
@ -11,8 +11,6 @@ namespace Katteker.Gui
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Wrapper
|
public static class Wrapper
|
||||||
{
|
{
|
||||||
private static UpdateManager _manager;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks for Updates.
|
/// Checks for Updates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -26,36 +24,35 @@ namespace Katteker.Gui
|
|||||||
/// <returns>Task</returns>
|
/// <returns>Task</returns>
|
||||||
public static async Task CheckForUpdateAsync(bool isStartup)
|
public static async Task CheckForUpdateAsync(bool isStartup)
|
||||||
{
|
{
|
||||||
if (_manager == null && !UpdateManager.TryCreate(out _manager))
|
using (var window = new UpdateWindow())
|
||||||
{
|
{
|
||||||
if (!isStartup)
|
var dialogResult = DialogResult.Cancel;
|
||||||
|
if (!UpdateManager.TryCreate(out var manager) && !isStartup)
|
||||||
{
|
{
|
||||||
MessageBox.Show(Resources.SquirrelWrapper_CheckForUpdate,
|
MessageBox.Show(Resources.SquirrelWrapper_CheckForUpdate,
|
||||||
Resources.SquirrelWrapper_CheckForUpdate_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
Resources.SquirrelWrapper_CheckForUpdate_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var releases = (await _manager.CheckForUpdateAsync().ConfigureAwait(false)).ToArray();
|
var releases = (await manager.CheckForUpdateAsync().ConfigureAwait(true)).ToArray();
|
||||||
if (releases.Any() || !isStartup)
|
window.UpdateManager = manager;
|
||||||
|
window.ReleaseEntry = releases.LastOrDefault();
|
||||||
|
if (isStartup)
|
||||||
{
|
{
|
||||||
var thread = new Thread(ThreadProcess);
|
if (releases?.Any() == true)
|
||||||
thread.SetApartmentState(ApartmentState.STA);
|
{
|
||||||
thread.Start(releases.LastOrDefault());
|
dialogResult = window.ShowDialog();
|
||||||
thread.Join();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dialogResult = window.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void ThreadProcess(object argument)
|
|
||||||
{
|
|
||||||
var entry = (ReleaseEntry) argument;
|
|
||||||
using (var window = new UpdateWindow(_manager, entry))
|
|
||||||
{
|
|
||||||
var dialogResult = window.ShowDialog();
|
|
||||||
if (dialogResult == DialogResult.OK)
|
if (dialogResult == DialogResult.OK)
|
||||||
{
|
{
|
||||||
_manager.RestartApp();
|
manager.RestartApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
Katteker.Gui/packages.config
Normal file
4
Katteker.Gui/packages.config
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="CommonMark.NET" version="0.15.1" targetFramework="net45" />
|
||||||
|
</packages>
|
@ -38,10 +38,8 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ChangelogHelper.cs" />
|
|
||||||
<Compile Include="Constants.cs" />
|
<Compile Include="Constants.cs" />
|
||||||
<Compile Include="KattekerConfig.cs" />
|
<Compile Include="KattekerConfig.cs" />
|
||||||
<Compile Include="MarkdownSharp.cs" />
|
|
||||||
<Compile Include="SemanticVersion.cs" />
|
<Compile Include="SemanticVersion.cs" />
|
||||||
<Compile Include="UpdateInfo.cs" />
|
<Compile Include="UpdateInfo.cs" />
|
||||||
<Compile Include="UpdateManager.cs" />
|
<Compile Include="UpdateManager.cs" />
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -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.3")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.3")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
@ -10,9 +10,6 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Katteker
|
namespace Katteker
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Update manager, which handles the updates.
|
|
||||||
/// </summary>
|
|
||||||
public class UpdateManager
|
public class UpdateManager
|
||||||
{
|
{
|
||||||
private static readonly string _baseDir = AppDomain.CurrentDomain.BaseDirectory;
|
private static readonly string _baseDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
@ -43,13 +40,6 @@ namespace Katteker
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string UrlOrPath => _urlOrPath;
|
public string UrlOrPath => _urlOrPath;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create the update manager.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="urlOrPath">path to the publishing directory</param>
|
|
||||||
/// <param name="applicationName">name of the application to update.</param>
|
|
||||||
/// <param name="rootDirectory">root directory.</param>
|
|
||||||
/// <returns>the update manager.</returns>
|
|
||||||
public static UpdateManager Create(string urlOrPath = null, string applicationName = null, string rootDirectory = null)
|
public static UpdateManager Create(string urlOrPath = null, string applicationName = null, string rootDirectory = null)
|
||||||
{
|
{
|
||||||
_config = ReadConfigFile();
|
_config = ReadConfigFile();
|
||||||
@ -59,14 +49,6 @@ namespace Katteker
|
|||||||
return new UpdateManager(urlOrPath, appName, rootAppDirectory);
|
return new UpdateManager(urlOrPath, appName, rootAppDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Try to create the update manager.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="manager">update manager</param>
|
|
||||||
/// <param name="urlOrPath">path to the publishing directory</param>
|
|
||||||
/// <param name="applicationName">name of the application to update.</param>
|
|
||||||
/// <param name="rootDirectory">root directory.</param>
|
|
||||||
/// <returns>true if the creation success, false otherwise.</returns>
|
|
||||||
public static bool TryCreate(out UpdateManager manager, string urlOrPath = null, string applicationName = null, string rootDirectory = null)
|
public static bool TryCreate(out UpdateManager manager, string urlOrPath = null, string applicationName = null, string rootDirectory = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -80,7 +62,6 @@ namespace Katteker
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<ReleaseEntry>> CheckForUpdateAsync()
|
public async Task<IEnumerable<ReleaseEntry>> CheckForUpdateAsync()
|
||||||
{
|
{
|
||||||
_releases = Utility.IsWebUrl(_urlOrPath) ? await DownloadIndexAsync(_urlOrPath).ConfigureAwait(false) : GetFromFilesystem(_urlOrPath);
|
_releases = Utility.IsWebUrl(_urlOrPath) ? await DownloadIndexAsync(_urlOrPath).ConfigureAwait(false) : GetFromFilesystem(_urlOrPath);
|
||||||
@ -88,11 +69,6 @@ namespace Katteker
|
|||||||
return updateInfo.ReleasesToApply;
|
return updateInfo.ReleasesToApply;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Restart the application.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="exeToStart"></param>
|
|
||||||
/// <param name="arguments"></param>
|
|
||||||
public void RestartApp(string exeToStart = null, string arguments = null)
|
public void RestartApp(string exeToStart = null, string arguments = null)
|
||||||
{
|
{
|
||||||
exeToStart = exeToStart ?? Path.GetFileName(Assembly.GetEntryAssembly().Location);
|
exeToStart = exeToStart ?? Path.GetFileName(Assembly.GetEntryAssembly().Location);
|
||||||
@ -105,11 +81,6 @@ namespace Katteker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Update application.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="progress">The updating process.</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<bool> UpdateAppAsync(IProgress<int> progress = null)
|
public async Task<bool> UpdateAppAsync(IProgress<int> progress = null)
|
||||||
{
|
{
|
||||||
progress?.Report(0);
|
progress?.Report(0);
|
||||||
@ -125,7 +96,7 @@ namespace Katteker
|
|||||||
var url = urlOrPath.TrimEnd('/');
|
var url = urlOrPath.TrimEnd('/');
|
||||||
url += "/" + Constants.RELEASE;
|
url += "/" + Constants.RELEASE;
|
||||||
var content = await new WebClient().DownloadStringTaskAsync(url).ConfigureAwait(false);
|
var content = await new WebClient().DownloadStringTaskAsync(url).ConfigureAwait(false);
|
||||||
var lines = content.Split(new[] {'\r', '\n'}, StringSplitOptions.RemoveEmptyEntries);
|
var lines = content.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
return new Releases(lines);
|
return new Releases(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +108,6 @@ namespace Katteker
|
|||||||
if (!File.Exists(configPath)) throw new FileNotFoundException("Configuration file not found.", configPath);
|
if (!File.Exists(configPath)) throw new FileNotFoundException("Configuration file not found.", configPath);
|
||||||
return KattekerConfig.ReadFromFile(configPath);
|
return KattekerConfig.ReadFromFile(configPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool VerifyFileChecksum(string targetFile, string lastEntrySha1)
|
private static bool VerifyFileChecksum(string targetFile, string lastEntrySha1)
|
||||||
{
|
{
|
||||||
var hash = Utility.ComputeFileHash(targetFile);
|
var hash = Utility.ComputeFileHash(targetFile);
|
||||||
@ -177,7 +147,8 @@ namespace Katteker
|
|||||||
|
|
||||||
private async Task<bool> UpdateAppImplAsync(ReleaseEntry lastEntry, IProgress<int> progress)
|
private async Task<bool> UpdateAppImplAsync(ReleaseEntry lastEntry, IProgress<int> progress)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
var targetFile = Path.Combine(_packageDir, lastEntry.Filename);
|
var targetFile = Path.Combine(_packageDir, lastEntry.Filename);
|
||||||
//download file.
|
//download file.
|
||||||
await PutFileInPackageFolderAsync(lastEntry.Filename).ConfigureAwait(false);
|
await PutFileInPackageFolderAsync(lastEntry.Filename).ConfigureAwait(false);
|
||||||
@ -195,10 +166,16 @@ namespace Katteker
|
|||||||
updater.Start();
|
updater.Start();
|
||||||
updater.WaitForExit();
|
updater.WaitForExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
progress?.Report(100);
|
progress?.Report(100);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user