Compare commits

...
1 Commits
5 changed files with 55 additions and 33 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.50
1.0.51
+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.50")]
[assembly: AssemblyFileVersion("1.0.50")]
[assembly: AssemblyInformationalVersion("1.0.50")]
[assembly: AssemblyVersion("1.0.51")]
[assembly: AssemblyFileVersion("1.0.51")]
[assembly: AssemblyInformationalVersion("1.0.51")]
+8
View File
@@ -222,6 +222,14 @@ namespace JiraTimeBot.UI
{
//если обновились - отключаем до рестарта
tmrUpdate.Enabled = false;
var result = MessageBox.Show($"Приложение обновлено до новой версии. Перезапустить сейчас?",
"Обновление",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
updater.SelfRestart();
}
}
}
catch (Exception ex)
+1
View File
@@ -5,5 +5,6 @@ namespace JiraTimeBot.Update
internal interface IUpdater
{
bool UpdateToNewVersion(bool firstTime);
void SelfRestart();
}
}
+13
View File
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
@@ -124,6 +125,18 @@ namespace JiraTimeBot.Update
return false;
}
}
public void SelfRestart()
{
var name = Application.ExecutablePath;
ProcessStartInfo startInfo = new ProcessStartInfo {
Arguments = "/C choice /C Y /N /D Y /T 1 & \"" + name + "\"",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
};
Process.Start(startInfo);
Application.Exit();
}
private bool DownloadFile(string url, string to)