private void BGCreateNewInstance_RunWorkerCompleted( object sender, RunWorkerCompletedEventArgs e) { if (!(e.Result is Dictionary <string, string> result)) { return; } if (result["status"].Equals("success", StringComparison.InvariantCultureIgnoreCase)) { InstalledOem.SetInstalledCoexistingOems(); RegistryManager.RegistryManagers[this.currentDownloadingOem.AppPlayerOem].Guest[result["vmname"]].DisplayName = Strings.ProductDisplayName + " " + Utils.GetVmIdFromVmName(result["vmname"]) + " " + this.currentDownloadingOem.Suffix; Publisher.PublishMessage(BrowserControlTags.oemInstallCompleted, this.ParentWindow.mVmName, (JObject)null); } else { if (!result["status"].Equals("fail", StringComparison.InvariantCultureIgnoreCase)) { return; } Publisher.PublishMessage(BrowserControlTags.oemInstallFailed, this.ParentWindow.mVmName, new JObject() { ["MessageTitle"] = (JToken)LocaleStrings.GetLocalizedString("STRING_INSTALL_FAIL", ""), ["MessageBody"] = (JToken)LocaleStrings.GetLocalizedString("STRING_INSTALLATION_FAILED", ""), ["ActionType"] = (JToken)"failed" }); } }
private void BGCreateInstanceSameEngine_RunWorkerCompleted( object sender, RunWorkerCompletedEventArgs e) { if (!(e.Result is Dictionary <string, string> result)) { return; } if (result["status"].Equals("success", StringComparison.InvariantCultureIgnoreCase)) { InstalledOem.SetInstalledCoexistingOems(); JObject extraData = new JObject(); extraData["vmname"] = (JToken)result["vmname"]; extraData["averageBootTime"] = (JToken)RegistryManager.Instance.AvgBootTime; string[] vmList = RegistryManager.Instance.VmList; List <string> stringList = new List <string>(); foreach (string index in vmList) { stringList.Add(RegistryManager.Instance.Guest[index].DisplayName); } if (!string.IsNullOrEmpty(this.vmDisplayName) && stringList.Contains(this.vmDisplayName)) { int num = 1; while (stringList.Contains(this.vmDisplayName + " (" + num.ToString() + ")")) { ++num; } this.vmDisplayName = this.vmDisplayName + " (" + num.ToString() + ")"; } RegistryManager.Instance.Guest[result["vmname"]].DisplayName = this.vmDisplayName; string resolution = "Landscape " + RegistryManager.Instance.Guest[this.ParentWindow.mVmName].GuestWidth.ToString() + " x " + RegistryManager.Instance.Guest[this.ParentWindow.mVmName].GuestHeight.ToString(); string str = this.ParentWindow.mInstanceWiseCloudInfoManager.mInstanceWiseCloudInfo.GameFeaturePopupInfo.GameFeaturePopupPackages?.GetAppPackageObject(this.ParentWindow.StaticComponents.mSelectedTabButton.PackageName)?.ExtraInfo["game_popup_id"]; BlueStacks.Common.Stats.SendMultiInstanceStatsAsync("instance_creation_completed", this.vmDisplayName, "Medium (2 CPU cores) and Medium (2 GB)", resolution, int.Parse(result["abivalue"], (IFormatProvider)CultureInfo.InvariantCulture), result["DPI"], 1, result["oem"], "", (string)null, "Fresh", Utils.GetVmIdFromVmName(result["vmname"]), "", true, str); Publisher.PublishMessage(BrowserControlTags.oemInstallCompleted, this.ParentWindow.mVmName, extraData); } else { if (!result["status"].Equals("fail", StringComparison.InvariantCultureIgnoreCase)) { return; } Publisher.PublishMessage(BrowserControlTags.oemInstallFailed, this.ParentWindow.mVmName, new JObject() { ["MessageTitle"] = (JToken)LocaleStrings.GetLocalizedString("STRING_INSTALL_FAIL", ""), ["MessageBody"] = (JToken)LocaleStrings.GetLocalizedString("STRING_INSTALLATION_FAILED", ""), ["ActionType"] = (JToken)"failed" }); } }
private void InstallOemOperation() { try { Publisher.PublishMessage(BrowserControlTags.oemInstallStarted, this.ParentWindow.mVmName, (JObject)null); int mInstallFailedErrorCode = this.currentDownloadingOem.InstallOem(); if (mInstallFailedErrorCode != 0 || !RegistryManager.CheckOemInRegistry(this.currentDownloadingOem.AppPlayerOem, "Android")) { Logger.Warning("Installation failed: " + mInstallFailedErrorCode.ToString()); string str = mInstallFailedErrorCode == 0 ? LocaleStrings.GetLocalizedString("STRING_INSTALLATION_FAILED", "") : InstallerErrorHandling.AssignErrorStringForInstallerExitCodes(mInstallFailedErrorCode, "STRING_INSTALLATION_FAILED"); Publisher.PublishMessage(BrowserControlTags.oemInstallFailed, this.ParentWindow.mVmName, new JObject() { ["MessageTitle"] = (JToken)LocaleStrings.GetLocalizedString("STRING_INSTALL_FAIL", ""), ["MessageBody"] = (JToken)str, ["ActionType"] = (JToken)"failed" }); } else { InstalledOem.SetInstalledCoexistingOems(); if (this.currentDownloadingOem.AppPlayerOem.Contains("bgp64")) { Utils.UpdateValueInBootParams("abivalue", this.currentDownloadingOem.AbiValue.ToString((IFormatProvider)CultureInfo.InvariantCulture), "Android", true, this.currentDownloadingOem.AppPlayerOem); } RegistryManager.RegistryManagers[this.currentDownloadingOem.AppPlayerOem].Guest["Android"].DisplayName = Strings.ProductDisplayName + " " + this.currentDownloadingOem.Suffix; Publisher.PublishMessage(BrowserControlTags.oemInstallCompleted, this.ParentWindow.mVmName, (JObject)null); } } catch (Exception ex) { Logger.Error("Failed after running installer process: " + ex?.ToString()); Publisher.PublishMessage(BrowserControlTags.oemInstallFailed, this.ParentWindow.mVmName, new JObject() { ["MessageTitle"] = (JToken)LocaleStrings.GetLocalizedString("STRING_INSTALL_FAIL", ""), ["MessageBody"] = (JToken)LocaleStrings.GetLocalizedString("STRING_INSTALLATION_FAILED", ""), ["ActionType"] = (JToken)"failed" }); } }