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
+31 -31
View File
@@ -1,31 +1,31 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("JiraTimeBot")] [assembly: AssemblyTitle("JiraTimeBot")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JiraTimeBot")] [assembly: AssemblyProduct("JiraTimeBot")]
[assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")] [assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// 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;
} }
} }