mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Advanced Settings Plugin downloader fixes
This commit is contained in:
@@ -37,14 +37,14 @@ namespace GHelper.Helpers
|
||||
return principal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
|
||||
public static void RunAsAdmin(string? param = null)
|
||||
public static void RunAsAdmin(string? param = null, bool force = false)
|
||||
{
|
||||
|
||||
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAdmin) < 2000) return;
|
||||
lastAdmin = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
|
||||
// Check if the current user is an administrator
|
||||
if (!IsUserAdministrator())
|
||||
if (!IsUserAdministrator() || force)
|
||||
{
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.UseShellExecute = true;
|
||||
|
||||
@@ -185,6 +185,7 @@ namespace Ryzen
|
||||
{
|
||||
System.IO.Compression.ZipFile.ExtractToDirectory(zipLocation, exeDir, overwriteFiles: true);
|
||||
File.Delete(zipLocation);
|
||||
ProcessHelper.RunAsAdmin("uv", true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user