fix : static void AddFirewallRule() { try { ExecuteCommand("netsh", "advfirewall…
- User
fix : static void AddFirewallRule() { try { ExecuteCommand("netsh", "advfirewall firewall add rule " + "name="Botanko" " + "dir=out " + "action=block " + "protocol=UDP " + "localport=80-17499,17501-19999,20003-65535 " + "remoteport=80-19999,20003-65535 " + "program="Path.Combine(bluestacksDir, "HD-Player.exe");
//Console.WriteLine("\nFirewall rule added."); firewallRuleActive = true; } catch (Exception ex) { //Console.WriteLine($"\nError adding firewall rule: {ex.Message}"); } } - Assistant
- User
dont change this AddFirewallRule()
- Assistant
- User
i want to use InstallDir from here static string GetBlueStacksInstallDir() { try { // Check both 32-bit and 64-bit registry views string installDir = null;
// Check 64-bit registry first using (var key64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64) .OpenSubKey(@"SOFTWARE\BlueStacks_msi5")) { installDir = key64?.GetValue("InstallDir")?.ToString(); if (!string.IsNullOrEmpty(installDir) && Directory.Exists(installDir)) { //Console.WriteLine($"Found BlueStacks MSI installation in 64-bit registry: {installDir}"); return installDir; } } // If not found in 64-bit, check 32-bit registry using (var key32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32) .OpenSubKey(@"SOFTWARE\BlueStacks_msi5")) { installDir = key32?.GetValue("InstallDir")?.ToString(); if (!string.IsNullOrEmpty(installDir) && Directory.Exists(installDir)) { //Console.WriteLine($"Found MSI installation in 32-bit registry: {installDir}"); return installDir; } } Console.WriteLine("MSI App Player is not Installed"); return null; } catch (Exception ex) { Console.WriteLine($"Error retrieving MSI install directory: {ex.Message}"); return null; } } - Assistant