Compare commits

...
3 Commits
Author SHA1 Message Date
Danil Kislov 02bee8abbd Релиз 2019-03-19 10:53:30 +03:00
Danil Kislov 0f00ba3f0e Сообщение о последней версии 2019-03-19 10:52:44 +03:00
Danil Kislov 71d02f7efe немного изменений 2019-03-19 10:51:25 +03:00
4 changed files with 42 additions and 38 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.17 1.0.18
+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 // 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.17")] [assembly: AssemblyVersion("1.0.18")]
[assembly: AssemblyFileVersion("1.0.17")] [assembly: AssemblyFileVersion("1.0.18")]
[assembly: AssemblyInformationalVersion("1.0.17")] [assembly: AssemblyInformationalVersion("1.0.18")]
+8 -4
View File
@@ -210,19 +210,23 @@ namespace JiraTimeBotForm.UI
var downloadUrl = checker.GetDownloadUrl(release); var downloadUrl = checker.GetDownloadUrl(release);
_log.Info($"Доступна новая версия: {gitVersion} {downloadUrl}"); _log.Info($"Доступна новая версия: {gitVersion} {downloadUrl}");
var success = checker.DownloadFile(downloadUrl); var success = checker.DownloadFile(downloadUrl, "update.zip");
if (!success) if (!success)
{ {
return; return;
} }
var result = InstallUpdate(gitVersion); var result = InstallUpdate(gitVersion, "update.zip");
if (result) if (result)
{ {
//если обновились - отключаем до рестарта //если обновились - отключаем до рестарта
tmrUpdate.Enabled = false; tmrUpdate.Enabled = false;
} }
} }
else
{
_log.Info($"Вы используете последнюю версию.");
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -231,7 +235,7 @@ namespace JiraTimeBotForm.UI
} }
} }
private bool InstallUpdate(Version gitVersion) private bool InstallUpdate(Version gitVersion, string updateFile)
{ {
try try
{ {
@@ -244,7 +248,7 @@ namespace JiraTimeBotForm.UI
Directory.CreateDirectory(bkpDir); 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) foreach (ZipArchiveEntry entry in archive.Entries)
{ {
+2 -2
View File
@@ -38,7 +38,7 @@ namespace JiraTimeBotForm.Update
return release; return release;
} }
public bool DownloadFile(string url) public bool DownloadFile(string url, string to)
{ {
try try
{ {
@@ -47,7 +47,7 @@ namespace JiraTimeBotForm.Update
{ {
client.Headers.Add("User-Agent", client.Headers.Add("User-Agent",
"Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0"); "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; return true;
} }
} }