mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Advanced Settings Plugin downloader
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
//
|
||||
|
||||
|
||||
using GHelper.Helpers;
|
||||
using System.Management;
|
||||
using System.Net;
|
||||
|
||||
namespace Ryzen
|
||||
{
|
||||
@@ -52,7 +54,8 @@ namespace Ryzen
|
||||
CPUName = obj["Name"].ToString();
|
||||
CPUModel = obj["Caption"].ToString();
|
||||
}
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.Message);
|
||||
}
|
||||
@@ -142,6 +145,52 @@ namespace Ryzen
|
||||
return CPUName.Contains("6900H") || CPUName.Contains("7945H") || CPUName.Contains("7845H");
|
||||
}
|
||||
|
||||
public static bool IsRingExsists()
|
||||
{
|
||||
string exeDir = Path.GetDirectoryName(Application.ExecutablePath);
|
||||
return File.Exists(exeDir + "\\" + "WinRing0x64.dll");
|
||||
}
|
||||
|
||||
public static void DownloadRing()
|
||||
{
|
||||
string requestUri = "https://github.com/seerge/g-helper/releases/latest/download/PluginAdvancedSettings.zip";
|
||||
|
||||
Uri uri = new Uri(requestUri);
|
||||
|
||||
string exeDir = Path.GetDirectoryName(Application.ExecutablePath);
|
||||
string zipName = Path.GetFileName(uri.LocalPath);
|
||||
string zipLocation = exeDir + "\\" + zipName;
|
||||
|
||||
using (WebClient client = new WebClient())
|
||||
{
|
||||
Logger.WriteLine(requestUri);
|
||||
Logger.WriteLine(exeDir);
|
||||
Logger.WriteLine(zipName);
|
||||
|
||||
try
|
||||
{
|
||||
client.DownloadFile(uri, zipLocation);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.Message);
|
||||
Logger.WriteLine(ex.ToString());
|
||||
if (!ProcessHelper.IsUserAdministrator()) ProcessHelper.RunAsAdmin("uv");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
System.IO.Compression.ZipFile.ExtractToDirectory(zipLocation, exeDir, overwriteFiles: true);
|
||||
File.Delete(zipLocation);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetAddresses()
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user