Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Asus unsupported sdk version handling #2023

Merged
merged 1 commit into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project-Aurora/Project-Aurora/Devices/Asus/AsusDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public bool Initialize()
{
asusHandler?.Stop();

asusHandler = new AsusHandler();
asusHandler = new AsusHandler(Global.Configuration.VarRegistry.GetVariable<bool>($"{DeviceName}_enable_unsupported_version"));
isActive = asusHandler.Start();
return isActive;
}
Expand Down
10 changes: 4 additions & 6 deletions Project-Aurora/Project-Aurora/Devices/Asus/AsusHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public class AsusHandler
/// </summary>
public bool HasSdk => AuraSdk != null;

public AsusHandler()
public AsusHandler(bool enableUnsupportedVersion = false)
{
try
{
if (CheckVersion(out string message))
if (CheckVersion(enableUnsupportedVersion, out string message))
AuraSdk = new AuraSdk() as IAuraSdk2;
else
AuraSdk = null;
Expand All @@ -47,12 +47,10 @@ public AsusHandler()
/// Checks to see if the version of Aura installed is the correct one
/// </summary>
/// <returns>true if the registry entry equals to <see cref="RecommendedAsusVersion"/></returns>
private bool CheckVersion(out string message)
private bool CheckVersion(bool enableUnsupportedVersion, out string message)
{
message = null;

bool enableUnsupportedVersion = Global.Configuration.VarRegistry.GetVariable<bool>($"{DeviceName}_disconnect_when_stop");


//Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Asus\AURA\Version
using (var root = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void SaveConfigFile()

private bool LoadAuraSdk()
{
asusHandler = new AsusHandler();
asusHandler = new AsusHandler(Global.Configuration.VarRegistry.GetVariable<bool>($"Asus_enable_unsupported_version"));
asusHandler.AuraSdk?.SwitchMode();

if (asusHandler.HasSdk)
Expand Down