mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Auto updater shim for <2.8.0 versions
This commit is contained in:
parent
1b60e30a0b
commit
47cf9e70cb
@ -394,17 +394,32 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prior to 2.8.0, auto-updating was handled with this... bruteforce method
|
||||||
|
// now it's handled with the system mutex you see above, but we need to keep this logic for <2.8.0 versions
|
||||||
|
for (int i = 1; i <= 10; i++)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Copy(Paths.Process, Paths.Application, true);
|
File.Copy(Paths.Process, Paths.Application, true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Failed to update! (Could not replace executable)");
|
if (i == 1)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Waiting for write permissions to update version");
|
||||||
|
}
|
||||||
|
else if (i == 10)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Failed to update! (Could not get write permissions after 10 tries/5 seconds)");
|
||||||
App.Logger.WriteException(LOG_IDENT, ex);
|
App.Logger.WriteException(LOG_IDENT, ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
using (var uninstallKey = Registry.CurrentUser.CreateSubKey(App.UninstallKey))
|
using (var uninstallKey = Registry.CurrentUser.CreateSubKey(App.UninstallKey))
|
||||||
{
|
{
|
||||||
uninstallKey.SetValue("DisplayVersion", App.Version);
|
uninstallKey.SetValue("DisplayVersion", App.Version);
|
||||||
|
Loading…
Reference in New Issue
Block a user