private static void BgGetOem_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     try
     {
         if (e.Result is JToken result)
         {
             InstalledOem.ResetCoexistingOems(result);
         }
         InstalledOem.CloudResponseRecieved = true;
         Logger.Debug("Oem List data Url: " + result?.ToString());
     }
     catch (Exception ex)
     {
         Logger.Error("Failed to get oem err: {0}", (object)ex.Message);
     }
 }
        private static void BgGetOem_DoWork(object sender, DoWorkEventArgs e)
        {
            JToken jtoken = (JToken)null;

            try
            {
                jtoken = JToken.Parse(BstHttpClient.Get(InstalledOem.CreateRequestUrlAndDownloadJsonData(), (Dictionary <string, string>)null, false, "Android", 0, 1, 0, false, "bgp"));
            }
            catch (Exception ex)
            {
                Logger.Error("Failed to get oem err: {0}", (object)ex.Message);
            }
            finally
            {
                e.Result = (object)jtoken;
            }
        }
        public static void LaunchOemInstance(
            string oem,
            string abi,
            string vmname      = "",
            string packageName = "",
            string actionWithRemainingInstances = "")
        {
            if (!InstalledOem.CheckIfOemInstancePresent(oem, abi))
            {
                return;
            }
            string partnerExePath = RegistryManager.RegistryManagers[oem].PartnerExePath;

            if (string.IsNullOrEmpty(vmname) || !((IEnumerable <string>)RegistryManager.RegistryManagers[oem].VmList).Contains <string>(vmname))
            {
                vmname = "Android";
                if (oem.Contains("bgp64"))
                {
                    int result;
                    if (!int.TryParse(abi, out result))
                    {
                        result = int.Parse(ABISetting.ARM64.GetDescription(), (IFormatProvider)CultureInfo.InvariantCulture);
                    }
                    abi = ((IEnumerable <int>)InstalledOem.BGP6432BitABIValues).Contains <int>(result) ? ABISetting.Auto64.GetDescription() : ABISetting.ARM64.GetDescription();
                    foreach (string vm in RegistryManager.RegistryManagers[oem].VmList)
                    {
                        if (string.Equals(abi, Utils.GetValueInBootParams("abivalue", vm, string.Empty, oem), StringComparison.InvariantCultureIgnoreCase))
                        {
                            vmname = vm;
                            break;
                        }
                    }
                }
            }
            string str = "-vmname " + vmname;

            if (!string.IsNullOrEmpty(packageName))
            {
                JObject jobject;
                if (new System.Version(RegistryManager.RegistryManagers[oem].Version) < new System.Version("4.210.0.0000"))
                {
                    jobject = new JObject()
                    {
                        {
                            "app_pkg",
                            (JToken)packageName
                        }
                    }
                }
                ;
                else
                {
                    jobject = new JObject()
                    {
                        {
                            "fle_pkg",
                            (JToken)packageName
                        },
                        {
                            "source",
                            (JToken)"mim"
                        }
                    }
                };
                if (jobject != null)
                {
                    str = str + " -json " + Uri.EscapeUriString(jobject.ToString(Formatting.None));
                }
            }
            Process.Start(new ProcessStartInfo()
            {
                Arguments       = str,
                UseShellExecute = false,
                CreateNoWindow  = true,
                FileName        = partnerExePath
            });
            if (string.Equals(actionWithRemainingInstances, "close", StringComparison.InvariantCultureIgnoreCase))
            {
                InstalledOem.ActionOnRemainingInstances("stopInstance", oem, vmname);
            }
            else
            {
                if (!string.Equals(actionWithRemainingInstances, "minimize", StringComparison.InvariantCultureIgnoreCase))
                {
                    return;
                }
                InstalledOem.ActionOnRemainingInstances("minimizeInstance", oem, vmname);
            }
        }