немного изменений

This commit is contained in:
Danil Kislov
2019-03-19 10:51:25 +03:00
parent 71fbd6ee80
commit 71d02f7efe
3 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -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.16")]
[assembly: AssemblyFileVersion("1.0.16")]
[assembly: AssemblyInformationalVersion("1.0.16")]
+4 -4
View File
@@ -210,13 +210,13 @@ 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)
{
//если обновились - отключаем до рестарта
@@ -231,7 +231,7 @@ namespace JiraTimeBotForm.UI
}
}
private bool InstallUpdate(Version gitVersion)
private bool InstallUpdate(Version gitVersion, string updateFile)
{
try
{
@@ -244,7 +244,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)
{
+2 -2
View File
@@ -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;
}
}