Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02bee8abbd | ||
|
|
0f00ba3f0e | ||
|
|
71d02f7efe |
+1
-1
@@ -1 +1 @@
|
||||
1.0.17
|
||||
1.0.18
|
||||
|
||||
@@ -26,6 +26,6 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.17")]
|
||||
[assembly: AssemblyFileVersion("1.0.17")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.17")]
|
||||
[assembly: AssemblyVersion("1.0.18")]
|
||||
[assembly: AssemblyFileVersion("1.0.18")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.18")]
|
||||
|
||||
@@ -210,19 +210,23 @@ namespace JiraTimeBotForm.UI
|
||||
var downloadUrl = checker.GetDownloadUrl(release);
|
||||
_log.Info($"Доступна новая версия: {gitVersion} {downloadUrl}");
|
||||
|
||||
var success = checker.DownloadFile(downloadUrl);
|
||||
var success = checker.DownloadFile(downloadUrl, "update.zip");
|
||||
if (!success)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var result = InstallUpdate(gitVersion);
|
||||
var result = InstallUpdate(gitVersion, "update.zip");
|
||||
if (result)
|
||||
{
|
||||
//если обновились - отключаем до рестарта
|
||||
tmrUpdate.Enabled = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.Info($"Вы используете последнюю версию.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -231,7 +235,7 @@ namespace JiraTimeBotForm.UI
|
||||
}
|
||||
}
|
||||
|
||||
private bool InstallUpdate(Version gitVersion)
|
||||
private bool InstallUpdate(Version gitVersion, string updateFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -244,7 +248,7 @@ namespace JiraTimeBotForm.UI
|
||||
Directory.CreateDirectory(bkpDir);
|
||||
}
|
||||
|
||||
using (ZipArchive archive = ZipFile.OpenRead(Path.Combine(appFile.DirectoryName, "update.zip")))
|
||||
using (ZipArchive archive = ZipFile.OpenRead(Path.Combine(appFile.DirectoryName, updateFile)))
|
||||
{
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace JiraTimeBotForm.Update
|
||||
return release;
|
||||
}
|
||||
|
||||
public bool DownloadFile(string url)
|
||||
public bool DownloadFile(string url, string to)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace JiraTimeBotForm.Update
|
||||
{
|
||||
client.Headers.Add("User-Agent",
|
||||
"Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0");
|
||||
client.DownloadFile(url, "update.zip");
|
||||
client.DownloadFile(url, to);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user