internal void SendSearchPlayRequestAsync(string searchQuery) { ThreadPool.QueueUserWorkItem((WaitCallback)(obj => { if (searchQuery.Contains("search::")) { searchQuery = searchQuery.Remove(0, 8); } VmCmdHandler.RunCommand(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "searchplay {0}", (object)searchQuery), this.ParentWindow.mVmName, "bgp"); })); }
private void RestartInstanceHandler() { string abiResult = ""; if (this.EngineData.ABISetting != this.ABISetting) { abiResult = VmCmdHandler.RunCommand(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} {1}", (object)"switchAbi", (object)this.ABISetting.GetDescription()), this._VmName, "bgp"); } this.SaveEngineSettings(abiResult); BlueStacksUIUtils.CloseContainerWindow((FrameworkElement)this.ParentView); }
private static bool CheckIfGuestStarted() { try { if (VmCmdHandler.RunCommand("ping", Strings.CurrentDefaultVmName, "bgp") == null) { return(false); } } catch (Exception ex) { Console.WriteLine(string.Format("Error Occured, Err: {0}", (object)ex.ToString())); return(false); } return(true); }
private void SendDeviceProfileChangeToGuest(string json, JObject changedDeviceProfileObject) { if (!Utils.CheckIfDeviceProfileChanged(this.mCurrentDeviceProfileObject, changedDeviceProfileObject)) { return; } string command = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} {1}", (object)"changeDeviceProfile", (object)json); Logger.Info("Command for device profile change: " + command); new Thread((ThreadStart)(() => { try { string a = VmCmdHandler.RunCommand(command, this.ParentWindow.mVmName, "bgp"); Logger.Info("Result for device profile change command: " + a); if (string.Equals(a, "ok", StringComparison.InvariantCulture)) { this.AddToastPopup(LocaleStrings.GetLocalizedString("STRING_CHANGES_SAVED", "")); DeviceProfileControl.SendStatsOfDeviceProfileChangeAsync("success", changedDeviceProfileObject, this.mCurrentDeviceProfileObject); this.mCurrentDeviceProfileObject = changedDeviceProfileObject; Utils.UpdateValueInBootParams("pcode", changedDeviceProfileObject["pcode"].ToString(), this.ParentWindow.mVmName, false, "bgp"); Utils.UpdateValueInBootParams("caSelector", changedDeviceProfileObject["caSelector"].ToString(), this.ParentWindow.mVmName, false, "bgp"); if (SecurityMetrics.SecurityMetricsInstanceList.ContainsKey(this.ParentWindow.mVmName)) { SecurityMetrics.SecurityMetricsInstanceList[this.ParentWindow.mVmName].AddSecurityBreach(SecurityBreach.DEVICE_PROFILE_CHANGED, string.Empty); } } else { this.AddToastPopup(LocaleStrings.GetLocalizedString("STRING_SWITCH_PROFILE_FAILED", "")); DeviceProfileControl.SendStatsOfDeviceProfileChangeAsync("failed", changedDeviceProfileObject, this.mCurrentDeviceProfileObject); } this.Dispatcher.Invoke((Delegate)(() => this.SetUIAccordingToCurrentDeviceProfile())); } catch (Exception ex) { Logger.Error("Exception in change to predefined Pcode call to android: " + ex.ToString()); } })) { IsBackground = true }.Start(); }
public static bool DoRunCmd(string request, string vmName) { bool flag = false; if (VmCmdHandler.RunCommand(request, vmName, "bgp") == "ok") { flag = true; if (request.Contains("mpi.v23")) { Logger.Info("starting amidebug. not sending message to frontend."); return(flag); } IntPtr window = InteropWindow.FindWindow((string)null, BlueStacks.Common.Strings.AppTitle); if (window != IntPtr.Zero) { Logger.Info("Sending WM_USER_SHOW_WINDOW to Frontend Handle {0}", (object)window); InteropWindow.SendMessage(window, 1025U, IntPtr.Zero, IntPtr.Zero); } } string appName = ""; string packageName = ""; string activityName = ""; string imageName = ""; string appstore = ""; if (request.StartsWith("runex")) { string str = new Regex("^runex\\s+").Replace(request, ""); packageName = str.Substring(0, str.IndexOf('/')); if (!new JsonParser(vmName).GetAppInfoFromPackageName(packageName, out appName, out imageName, out activityName, out appstore)) { Logger.Error("Failed to get App info for: {0}. Not adding in launcher dock.", (object)packageName); return(flag); } } HDAgent.GetVersionFromPackage(packageName, vmName); string str1 = RegistryStrings.GadgetDir + imageName; return(flag); }
internal void StopAppRequest(string packageName) { ThreadPool.QueueUserWorkItem((WaitCallback)(obj => { try { Logger.Info("Will send stop {0} request", (object)packageName); Logger.Info("the response we get is {0}", (object)this.ParentWindow.mFrontendHandler.SendFrontendRequest("stopAppInfo", new Dictionary <string, string>() { { "appPackage", packageName } })); Logger.Info(VmCmdHandler.RunCommand(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "StopApp {0}", (object)packageName), this.ParentWindow.mVmName, "bgp")); } catch (Exception ex) { Logger.Error("Exception in StopAppRequest. Err : " + ex.ToString()); } })); }
private static void SendSecurityMessageToAndroidOnBootFinish() { try { Regex regex = new Regex("[^a-zA-Z0-9]"); Assembly executingAssembly = Assembly.GetExecutingAssembly(); X509Certificate signerCertificate = executingAssembly.GetModules()[0].GetSignerCertificate(); string str1 = string.Empty; if (signerCertificate != null) { string input = BitConverter.ToString(signerCertificate.GetSerialNumber()); str1 = !string.IsNullOrEmpty(input) ? regex.Replace(input, ".") : string.Empty; } string location = executingAssembly.Location; string str2 = !string.IsNullOrEmpty(location) ? regex.Replace(location, ".") : string.Empty; string baseKeyPath = RegistryManager.Instance.BaseKeyPath; VmCmdHandler.RunCommand(string.Format("{0} {1}", (object)"setBlueStacksConfig", (object)("{" + string.Format("\"regPath\":\"{0}\",", !string.IsNullOrEmpty(baseKeyPath) ? (object)regex.Replace(baseKeyPath, ".") : (object)string.Empty) + string.Format("\"location\":\"{0}\",", (object)str2) + string.Format("\"serial\":\"{0}\"", (object)str1) + "}")), MultiInstanceStrings.VmName, "bgp"); } catch (Exception ex) { int num = (int)System.Windows.Forms.MessageBox.Show(ex.ToString()); } }
private static void PowerEventArrive(object sender, EventArrivedEventArgs e) { try { foreach (PropertyData property in e.NewEvent.Properties) { if (property != null && property.Value != null && string.Compare(HDAgent.sPowerValues.ContainsKey(property.Value.ToString()) ? HDAgent.sPowerValues[property.Value.ToString()] : property.Value.ToString(), "Resume from Suspend", true) == 0) { long num = (DateTime.UtcNow.Ticks - 621355968000000000L) / 10000L; string cmd = string.Format("settime {0}", (object)num); Logger.Info("Number of ticks in milliseconds since epoch : " + num.ToString()); foreach (string vm in RegistryManager.Instance.VmList) { if (Utils.IsGuestBooted(vm, "bgp")) { Logger.Info("Response from bstcmdprocessor for time correction after sleep/hibernate : " + VmCmdHandler.RunCommand(cmd, vm, "bgp")); if (Oem.IsOEMDmm) { Utils.SetTimeZoneInGuest(vm); } } } } } } catch (Exception ex) { Logger.Error("An error ocured while setting time....Err : " + ex.ToString()); } }
private static void Main(string[] args) { Mutex lck = (Mutex)null; bool flag = false; Strings.CurrentDefaultVmName = "Android"; int num1 = ProcessUtils.CheckAlreadyRunningAndTakeLock(Strings.GetPlayerLockName(Strings.CurrentDefaultVmName, "bgp"), out lck) ? 1 : 0; lck?.Close(); if (num1 == 0 && BlueStacks.GuestCommandRunner.GuestCommandRunner.LaunchBlueStacks()) { flag = true; Console.WriteLine("Successfully Launched AppPlayer"); } lck?.Close(); if (!BlueStacks.GuestCommandRunner.GuestCommandRunner.CheckIfGuestStarted()) { Environment.Exit(-1); } AdbCommandRunner adbCommandRunner = new AdbCommandRunner(Strings.CurrentDefaultVmName); for (int index = 0; index < VMCommand.COMMAND.Length; ++index) { if (!string.IsNullOrEmpty(VMCommand.COMMAND[index]) && string.Compare(VmCmdHandler.RunCommand(VMCommand.COMMAND[index], Strings.CurrentDefaultVmName, "bgp"), "ok", true) != 0) { if (Oem.Instance.IsHideMessageBoxIconInTaskBar) { int num2 = (int)MessageBox.Show((IWin32Window) new Form(), "Error, Something went wrong!"); } else { int num3 = (int)MessageBox.Show("Error, Something went wrong!"); } adbCommandRunner.Dispose(); Environment.Exit(-1); } } adbCommandRunner.Dispose(); Thread.Sleep(2000); BlueStacks.GuestCommandRunner.GuestCommandRunner.StopZygote(); BlueStacks.GuestCommandRunner.GuestCommandRunner.StartZygote(); if (!flag) { return; } BlueStacks.GuestCommandRunner.GuestCommandRunner.ExitBlueStacks(); }
internal void SendRunex(string package, string activity) { VmCmdHandler.RunCommand(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "runex {0}/{1}", (object)package, (object)activity), this.ParentWindow.mVmName, "bgp"); }
internal void LaunchPlayRequestAsync(string packageName) { ThreadPool.QueueUserWorkItem((WaitCallback)(obj => VmCmdHandler.RunCommand(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "launchplay?pkgname={0}", (object)packageName), this.ParentWindow.mVmName, "bgp"))); }
internal void GoHome() { ThreadPool.QueueUserWorkItem((WaitCallback)(obj => VmCmdHandler.RunCommand("home", this.ParentWindow.mVmName, "bgp"))); }
public static void PlayMacro(string MacroName) { Macro macro = string.IsNullOrEmpty(MacroName) || !MacroData.Instance.DictMacros.ContainsKey(MacroName) ? MacroData.Instance.DictMacros.FirstOrDefault <KeyValuePair <string, Macro> >().Value : MacroData.Instance.DictMacros[MacroName]; int windowWidth = VMWindow.Instance.Width; int windowHeight = VMWindow.Instance.Height; if (MacroForm.t != null && MacroForm.t.IsAlive) { MacroForm.AbortReroll(); } MacroForm.t = new Thread((ThreadStart)(() => { try { DateTime dateTime = DateTime.Now; switch (macro.RepeatBehaiour) { case RepeatBehaviour.Once: dateTime = DateTime.Now.AddSeconds(2.0); break; case RepeatBehaviour.For5Minutes: dateTime = DateTime.Now.AddMinutes(5.0); break; case RepeatBehaviour.For1hour: dateTime = DateTime.Now.AddHours(1.0); break; case RepeatBehaviour.For8Hour: dateTime = DateTime.Now.AddHours(8.0); break; case RepeatBehaviour.Forever: dateTime = DateTime.Now.AddYears(5); break; } bool flag = true; while (DateTime.Now < dateTime) { if (flag) { flag = (uint)macro.AndroidCommandRepeatMode > 0U; foreach (KeyValuePair <string, SerializableDictionary <string, string> > dictAndroidCommand in (Dictionary <string, SerializableDictionary <string, string> >)macro.DictAndroidCommands) { try { JsonParser jsonParser = new JsonParser(MultiInstanceStrings.VmName); if (dictAndroidCommand.Key.StartsWith("MacroSleep")) { Thread.Sleep(Convert.ToInt32(dictAndroidCommand.Value.Keys.ElementAt <string>(0))); } else if (dictAndroidCommand.Key.Equals("runex") && jsonParser.GetAppInfoFromPackageName(MacroData.Instance.mPackageName) != null) { VmCmdHandler.RunCommand(string.Format("runex {0}/{1}", (object)MacroData.Instance.mPackageName, (object)jsonParser.GetAppInfoFromPackageName(MacroData.Instance.mPackageName).Activity), MultiInstanceStrings.VmName, "bgp"); } else { MacroForm.RunCommand(dictAndroidCommand); } } catch { } } } foreach (KeyValuePair <int, MacroAction> dictMacroAction in (Dictionary <int, MacroAction>)macro.DictMacroActions) { MacroAction macroAction = dictMacroAction.Value; Thread.Sleep((int)macroAction.DelayFromLastAction); switch (macroAction.ActionType) { case ActionType.MouseDown: InputMapper.Instance.HandleMouseDown((object)null, new MouseEventArgs(macroAction.MouseButton, 0, (int)(macroAction.ActionPointX * (double)windowWidth), (int)(macroAction.ActionPointY * (double)windowHeight), 0)); continue; case ActionType.MouseUp: InputMapper.Instance.HandleMouseUp((object)null, new MouseEventArgs(macroAction.MouseButton, 0, (int)(macroAction.ActionPointX * (double)windowWidth), (int)(macroAction.ActionPointY * (double)windowHeight), 0)); continue; default: continue; } } } MacroForm.t = (Thread)null; HTTPUtils.SendRequestToClient("macroCompleted", (Dictionary <string, string>)null, MultiInstanceStrings.VmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"); } catch (ThreadAbortException ex) { Logger.Error("Error running reroll", (object)ex.ToString()); } catch (Exception ex) { Logger.Error("Exception in running reroll. Err : ", (object)ex.ToString()); HTTPUtils.SendRequestToClient("macroCompleted", (Dictionary <string, string>)null, MultiInstanceStrings.VmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"); } })) { IsBackground = true }; MacroForm.t.Start(); }
private static void PerformGrmActionsWorker_DoWork( DoWorkEventArgs e, List <GrmAction> actions, string package, MainWindow ParentWindow) { try { ParentWindow.Dispatcher.Invoke((Delegate)(() => { ParentWindow.mFrontendGrid.Visibility = Visibility.Hidden; ParentWindow.mExitProgressGrid.ProgressText = LocaleStrings.GetLocalizedString("STRING_PERFORMING_ACTIONS", ""); ParentWindow.mExitProgressGrid.Visibility = Visibility.Visible; })); try { ClientStats.SendMiscellaneousStatsAsync("grm_action_clicked", RegistryManager.Instance.UserGuid, string.Join(",", actions.Select <GrmAction, string>((Func <GrmAction, string>)(_ => _.ActionType.ToString((IFormatProvider)CultureInfo.InvariantCulture))).ToArray <string>()), RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, "bgp", package, (string)null, (string)null, "Android"); } catch (Exception ex) { Logger.Error("Exception while sending misc stat for grm. " + ex?.ToString()); } e.Result = (object)false; foreach (GrmAction action1 in actions) { GrmActionType grmActionType = EnumHelper.Parse <GrmActionType>(action1.ActionType, GrmActionType.NoAction); bool? nullable1 = new bool?(false); EngineState engineState; switch (grmActionType) { case GrmActionType.UpdateRam: int num1 = int.Parse(action1.ActionDictionary["actionValue"], (IFormatProvider)CultureInfo.InvariantCulture); int num2 = 4096; int result; if (int.TryParse(PhysicalRamEvaluator.RAM, out result)) { num2 = (int)((double)result * 0.5); } string currentEngine1 = RegistryManager.Instance.CurrentEngine; engineState = EngineState.raw; string str1 = engineState.ToString(); if (currentEngine1 == str1 && num2 >= 3072) { num2 = 3072; } if (num2 < num1) { num1 = num2; } RegistryManager.Instance.Guest[ParentWindow.mVmName].Memory = num1; nullable1 = new bool?(true); break; case GrmActionType.UserBrowser: ParentWindow.Utils.HandleGenericActionFromDictionary(action1.ActionDictionary, "grm", ""); nullable1 = new bool?(false); break; case GrmActionType.DownloadFileAndExecute: Random random = new Random(); string str2 = action1.ActionDictionary["fileName"] + " "; string str3 = str2.Substring(0, str2.IndexOf(' ')); string str4 = str2.Substring(str2.IndexOf(' ') + 1); string str5 = Path.Combine(RegistryStrings.PromotionDirectory, string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}_{1}", (object)random.Next(), (object)str3)); try { using (WebClient webClient = new WebClient()) webClient.DownloadFile(action1.ActionDictionary["url"], str5); Thread.Sleep(2000); using (Process process = new Process()) { process.StartInfo.UseShellExecute = true; process.StartInfo.CreateNoWindow = true; if ((str5.ToUpperInvariant().EndsWith(".msi", StringComparison.InvariantCultureIgnoreCase) || str5.ToUpperInvariant().EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase)) && !BlueStacksUtils.IsSignedByBlueStacks(str5)) { Logger.Info("Not executing unsigned binary " + str5); GrmHandler.GrmExceptionMessageBox(ParentWindow); return; } if (str5.ToUpperInvariant().EndsWith(".msi", StringComparison.InvariantCultureIgnoreCase)) { process.StartInfo.FileName = "msiexec"; str4 = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "/i {0} {1}", (object)str5, (object)str4); process.StartInfo.Arguments = str4; } else { process.StartInfo.FileName = str5; process.StartInfo.Arguments = str4; } Logger.Info("Starting process: {0} {1}", (object)process.StartInfo.FileName, (object)str4); process.Start(); } } catch (Exception ex) { GrmHandler.GrmExceptionMessageBox(ParentWindow); Logger.Error("Failed to download and execute. err: " + ex?.ToString()); } nullable1 = new bool?(false); break; case GrmActionType.NoAction: nullable1 = new bool?(false); break; case GrmActionType.ContinueAnyway: ParentWindow.Dispatcher.Invoke((Delegate)(() => { ParentWindow.mFrontendGrid.Visibility = Visibility.Visible; ParentWindow.mExitProgressGrid.Visibility = Visibility.Hidden; if (GrmHandler.sDictAppRuleSet[ParentWindow.mVmName][package].MessageWindow.DontShowOption) { GrmHandler.DonotShowCheckboxHandling(ParentWindow, package); GrmHandler.RefreshGrmIndication(package, ParentWindow.mVmName); GrmHandler.SendUpdateGrmPackagesToAndroid(ParentWindow.mVmName); GrmHandler.SendUpdateGrmPackagesToBrowser(ParentWindow.mVmName); } ParentWindow.mWelcomeTab.mHomeAppManager.OpenApp(package, false); })); nullable1 = new bool?(); break; case GrmActionType.GlMode: string action2 = action1.ActionDictionary["actionValue"]; int glRenderMode = RegistryManager.Instance.Guest[ParentWindow.mVmName].GlRenderMode; int glMode1 = RegistryManager.Instance.Guest[ParentWindow.mVmName].GlMode; GlMode glMode2 = GlMode.PGA_GL; if (glRenderMode == 1 && glMode1 == 1) { glMode2 = GlMode.PGA_GL; } else if (glRenderMode == 1 && glMode1 == 2) { glMode2 = GlMode.AGA_GL; } else { switch (glMode1) { case 1: glMode2 = GlMode.PGA_DX; break; case 2: glMode2 = GlMode.AGA_DX; break; } } List <string> list1 = ((IEnumerable <string>)action2.Split(',')).Select <string, string>((Func <string, string>)(_ => _.Trim())).ToList <string>(); if (list1.Contains <string>(glMode2.ToString(), (IEqualityComparer <string>)StringComparer.InvariantCultureIgnoreCase)) { nullable1 = new bool?(false); break; } string str6 = list1.RandomElement <string>(); string str7 = ""; int num3; string str8; if (string.Compare(str6.Split('_')[1].Trim(), "GL", StringComparison.OrdinalIgnoreCase) == 0) { num3 = 1; str8 = str7 + "1"; } else { num3 = 4; str8 = str7 + "4"; } int num4; string args; if (string.Compare(str6.Split('_')[0].Trim(), "PGA", StringComparison.OrdinalIgnoreCase) == 0) { num4 = 1; args = str8 + " 1"; } else { num4 = 2; args = str8 + " 2"; } if (RunCommand.RunCmd(Path.Combine(RegistryStrings.InstallDir, "HD-GlCheck"), args, true, true, false, 0).ExitCode == 0) { RegistryManager.Instance.Guest[ParentWindow.mVmName].GlRenderMode = num3; Utils.UpdateValueInBootParams("GlMode", num4.ToString((IFormatProvider)CultureInfo.InvariantCulture), ParentWindow.mVmName, true, "bgp"); RegistryManager.Instance.Guest[ParentWindow.mVmName].GlMode = num4; } else { GrmHandler.GrmExceptionMessageBox(ParentWindow); Logger.Info("GL check execution for the required combination failed."); } nullable1 = new bool?(true); break; case GrmActionType.DeviceProfile: string strA = action1.ActionDictionary["pCode"]; string empty = string.Empty; string str9; if (string.Compare(strA, "custom", StringComparison.OrdinalIgnoreCase) == 0) { str9 = "{" + string.Format((IFormatProvider)CultureInfo.InvariantCulture, "\"createcustomprofile\":\"{0}\",", (object)"true") + string.Format((IFormatProvider)CultureInfo.InvariantCulture, "\"model\":\"{0}\",", (object)action1.ActionDictionary["model"]) + string.Format((IFormatProvider)CultureInfo.InvariantCulture, "\"brand\":\"{0}\",", (object)action1.ActionDictionary["brand"]) + string.Format((IFormatProvider)CultureInfo.InvariantCulture, "\"manufacturer\":\"{0}\"", (object)action1.ActionDictionary["manufacturer"]) + "}"; } else { List <string> list2 = ((IEnumerable <string>)strA.Split(',')).Select <string, string>((Func <string, string>)(_ => _.Trim())).ToList <string>(); string valueInBootParams = Utils.GetValueInBootParams("pcode", ParentWindow.mVmName, "", "bgp"); if (!list2.Contains(valueInBootParams)) { strA = list2.RandomElement <string>(); str9 = "{" + string.Format((IFormatProvider)CultureInfo.InvariantCulture, "\"createcustomprofile\":\"{0}\",", (object)"false") + string.Format((IFormatProvider)CultureInfo.InvariantCulture, "\"pcode\":\"{0}\"", (object)strA) + "}"; } else { break; } } if (string.Equals(VmCmdHandler.RunCommand(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} {1}", (object)"changeDeviceProfile", (object)str9), ParentWindow.mVmName, "bgp"), "ok", StringComparison.InvariantCulture)) { Utils.UpdateValueInBootParams("pcode", strA, ParentWindow.mVmName, false, "bgp"); if (PackageActivityNames.ThirdParty.AllCallOfDutyPackageNames.Contains(package)) { HTTPUtils.SendRequestToAgentAsync("clearAppData", new Dictionary <string, string>() { { nameof(package), package } }, ParentWindow.mVmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"); } } else { GrmHandler.GrmExceptionMessageBox(ParentWindow); Logger.Error("Setting device profile for the required combination failed."); } nullable1 = new bool?(false); break; case GrmActionType.BootParam: Utils.UpdateValueInBootParams(action1.ActionDictionary["param"].Trim(), action1.ActionDictionary["actionValue"].Trim(), ParentWindow.mVmName, true, "bgp"); nullable1 = new bool?(true); break; case GrmActionType.DPI: string action3 = action1.ActionDictionary["actionValue"]; Utils.SetDPIInBootParameters(RegistryManager.Instance.Guest[ParentWindow.mVmName].BootParameters, action3, ParentWindow.mVmName, "bgp"); nullable1 = new bool?(true); break; case GrmActionType.CpuCores: int num5 = int.Parse(action1.ActionDictionary["actionValue"], (IFormatProvider)CultureInfo.InvariantCulture); string currentEngine2 = RegistryManager.Instance.CurrentEngine; engineState = EngineState.raw; string str10 = engineState.ToString(); if (currentEngine2 != str10) { RegistryManager.Instance.Guest[ParentWindow.mVmName].VCPUs = num5 > 8 ? 8 : num5; } nullable1 = new bool?(true); break; case GrmActionType.Resolution: List <string> list3 = ((IEnumerable <string>)action1.ActionDictionary["actionValue"].Split(',')).Select <string, string>((Func <string, string>)(_ => _.Replace(" ", string.Empty))).ToList <string>(); string str11 = RegistryManager.Instance.Guest[ParentWindow.mVmName].GuestWidth.ToString((IFormatProvider)CultureInfo.InvariantCulture) + "x" + RegistryManager.Instance.Guest[ParentWindow.mVmName].GuestHeight.ToString((IFormatProvider)CultureInfo.InvariantCulture); if (!list3.Contains <string>(str11, (IEqualityComparer <string>)StringComparer.InvariantCultureIgnoreCase)) { string str12 = list3.RandomElement <string>(); RegistryManager.Instance.Guest[ParentWindow.mVmName].GuestWidth = int.Parse(str12.Split('x')[0].Trim(), (IFormatProvider)CultureInfo.InvariantCulture); RegistryManager.Instance.Guest[ParentWindow.mVmName].GuestHeight = int.Parse(str12.Split('x')[1].Trim(), (IFormatProvider)CultureInfo.InvariantCulture); nullable1 = new bool?(true); break; } break; case GrmActionType.RestartBluestacks: nullable1 = new bool?(true); break; case GrmActionType.RestartMachine: Process.Start("shutdown.exe", "-r -t 0"); break; case GrmActionType.Fps: int newFps = int.Parse(action1.ActionDictionary["actionValue"], (IFormatProvider)CultureInfo.InvariantCulture); RegistryManager.Instance.Guest[ParentWindow.mVmName].FPS = newFps; Utils.UpdateValueInBootParams("fps", newFps.ToString((IFormatProvider)CultureInfo.InvariantCulture), ParentWindow.mVmName, true, "bgp"); Utils.SendChangeFPSToInstanceASync(ParentWindow.mVmName, newFps, "bgp"); nullable1 = new bool?(false); break; case GrmActionType.EditRegistry: string action4 = action1.ActionDictionary["location"]; if (string.Compare(action4, "registryManager", StringComparison.OrdinalIgnoreCase) == 0) { PropertyInfo property = typeof(RegistryManager).GetProperty(action1.ActionDictionary["propertyName"]); object obj = Convert.ChangeType((object)action1.ActionDictionary["propertyValue"], Type.GetTypeCode(property.PropertyType), (IFormatProvider)CultureInfo.InvariantCulture); property.SetValue((object)RegistryManager.Instance, obj, (object[])null); } else if (string.Compare(action4, "instanceManager", StringComparison.OrdinalIgnoreCase) == 0) { PropertyInfo property = typeof(InstanceRegistry).GetProperty(action1.ActionDictionary["propertyName"]); object obj = Convert.ChangeType((object)action1.ActionDictionary["propertyValue"], Type.GetTypeCode(property.PropertyType), (IFormatProvider)CultureInfo.InvariantCulture); property.SetValue((object)RegistryManager.Instance.Guest[ParentWindow.mVmName], obj, (object[])null); } else { string registryPath = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Software\\BlueStacks{0}\\{1}", (object)BlueStacks.Common.Strings.GetOemTag(), (object)action1.ActionDictionary["propertyPath"].Replace("vmName", ParentWindow.mVmName)); object obj = (object)null; RegistryValueKind type = EnumHelper.Parse <RegistryValueKind>(action1.ActionDictionary["propertyRegistryKind"], RegistryValueKind.String); switch (type) { case RegistryValueKind.String: obj = (object)action1.ActionDictionary["propertyValue"]; break; case RegistryValueKind.DWord: obj = (object)int.Parse(action1.ActionDictionary["propertyValue"], (IFormatProvider)CultureInfo.InvariantCulture); break; } RegistryUtils.SetRegistryValue(registryPath, action1.ActionDictionary["propertyName"], obj, type, RegistryKeyKind.HKEY_LOCAL_MACHINE); } nullable1 = new bool?(false); break; case GrmActionType.ClearAppData: HTTPUtils.SendRequestToAgentAsync("clearAppData", new Dictionary <string, string>() { { nameof(package), package } }, ParentWindow.mVmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"); break; } bool?nullable2 = nullable1; bool flag = true; if (nullable2.GetValueOrDefault() == flag & nullable2.HasValue) { e.Result = (object)true; } else if (!nullable1.HasValue) { e.Result = (object)null; } } Thread.Sleep(1000); } catch (Exception ex) { Logger.Error("Exception in performing grm actions, ex: " + ex.ToString()); ClientStats.SendMiscellaneousStatsAsync("grm_action_error", RegistryManager.Instance.UserGuid, GrmHandler.sDictAppRuleSet[ParentWindow.mVmName][package].RuleId, RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, "bgp", package, ex.Message, (string)null, "Android"); GrmHandler.GrmExceptionMessageBox(ParentWindow); e.Result = (object)null; } }