private void InitSystemIcons() { List <AppInfo> list = ((IEnumerable <AppInfo>) new JsonParser(string.Empty).GetAppList()).ToList <AppInfo>(); this.mHomeApp?.InitMoreAppsIcon(); foreach (AppInfo appInfo in list) { if (string.Compare(appInfo.Package, "com.android.vending", StringComparison.OrdinalIgnoreCase) != 0 && string.Compare(appInfo.Package, "com.google.android.play.games", StringComparison.OrdinalIgnoreCase) != 0) { AppIconModel newIconForKey = this.GetNewIconForKey(appInfo.Package); newIconForKey.Init(appInfo); newIconForKey.AppName = "STRING_" + appInfo.Name.ToUpper(CultureInfo.InvariantCulture).Trim().Replace(" ", "_") + "_APP"; newIconForKey.IsInstalledApp = false; newIconForKey.AddToMoreAppsDock(55.0, 55.0); this.mHomeApp?.AddMoreAppsDockPanelIcon(newIconForKey, (DownloadInstallApk)null); } else { AppIconModel newIconForKey = this.GetNewIconForKey(appInfo.Package); newIconForKey.Init(appInfo); newIconForKey.IsInstalledApp = false; newIconForKey.mIsAppRemovable = false; newIconForKey.AppName = "STRING_" + appInfo.Name.ToUpper(CultureInfo.InvariantCulture).Trim().Replace(" ", "_") + "_APP"; newIconForKey.AddToInstallDrawer(); this.mHomeApp?.AddInstallDrawerIcon(newIconForKey, (DownloadInstallApk)null); } } }
private static void AddGRMIndicationForIncompatibleApp( AppIconModel appIcon, MainWindow ParentWindow, GrmRuleSet passedRuleSet) { ParentWindow.Dispatcher.Invoke((Delegate)(() => { switch (EnumHelper.Parse <MessageType>(passedRuleSet.MessageWindow.MessageType, MessageType.None)) { case MessageType.None: appIcon.AppIncompatType = AppIncompatType.Error; GrmHandler.sDictAppRuleSet[ParentWindow.mVmName].Remove(appIcon.PackageName); break; case MessageType.Info: appIcon.AppIncompatType = AppIncompatType.Info; GrmHandler.sDictAppRuleSet[ParentWindow.mVmName][appIcon.PackageName] = passedRuleSet; break; case MessageType.Error: appIcon.AppIncompatType = AppIncompatType.Error; GrmHandler.sDictAppRuleSet[ParentWindow.mVmName][appIcon.PackageName] = passedRuleSet; break; } })); }
internal void OpenApp(string packageName, bool isCheckForGrm = true) { AppIconModel appIcon = this.GetAppIcon(packageName); if (appIcon == null) { return; } if ((uint)appIcon.AppIncompatType > 0U & isCheckForGrm && !this.mParentWindow.mTopBar.mAppTabButtons.mDictTabs.ContainsKey(packageName)) { GrmHandler.HandleCompatibility(appIcon.PackageName, this.mParentWindow.mVmName); } else { this.mParentWindow.mTopBar.mAppTabButtons.AddAppTab(appIcon.AppName, appIcon.PackageName, appIcon.ActivityName, appIcon.ImageName, false, true, false); this.mParentWindow.mAppHandler.SwitchWhenPackageNameRecieved = appIcon.PackageName; this.mParentWindow.mAppHandler.SendRunAppRequestAsync(appIcon.PackageName, "", false); if (appIcon.IsRedDotVisible) { appIcon.IsRedDotVisible = false; HomeAppManager.AddPackageInRedDotShownRegistry(appIcon.PackageName); } HomeAppManager.SendStats(appIcon.PackageName); } }
private AppIconModel GetNewIconForKey(string key) { AppIconModel newAppIconCreated = new AppIconModel(); this.RemoveAppIcon(key, newAppIconCreated); this.dictAppIcons[key] = newAppIconCreated; return(newAppIconCreated); }
private static void RemoveAppCompatError(AppIconModel appIcon, MainWindow ParentWindow) { ParentWindow.Dispatcher.Invoke((Delegate)(() => { appIcon.AppIncompatType = AppIncompatType.None; GrmHandler.sDictAppRuleSet[ParentWindow.mVmName].Remove(appIcon.PackageName); })); }
private void AddIcon(AppInfo item) { AppIconModel newIconForKey = this.GetNewIconForKey(item.Package); newIconForKey.Init(item); newIconForKey.AddToInstallDrawer(); this.mHomeApp?.AddInstallDrawerIcon(newIconForKey, (DownloadInstallApk)null); }
internal void InitMoreAppsIcon() { AppIconModel model = new AppIconModel(); model.AppName = LocaleStrings.GetLocalizedString("STRING_MORE_APPS", ""); model.ImageName = "moreapps"; model.AddToDock(50.0, 50.0); this.moreAppsIcon = new AppIconUI(this.ParentWindow, model); this.moreAppsIcon.Click += new RoutedEventHandler(this.MoreAppsIcon_Click); this.mDockPanel.Children.Add((UIElement)this.moreAppsIcon); }
private AppIconUI GetNewAppIconUI( AppIconModel iconModel, DownloadInstallApk downloadInstallApk = null) { AppIconUI appIconUi = new AppIconUI(this.ParentWindow, iconModel); if (downloadInstallApk != null) { appIconUi.InitAppDownloader(downloadInstallApk); } return(appIconUi); }
public AppIconUI(MainWindow window, AppIconModel model) { this.ParentWindow = window; this.mAppIconModel = model; this.DataContext = (object)this.mAppIconModel; this.InitializeComponent(); if (this.mAppIconModel == null) { return; } this.SetAppIconLocation(this.mAppIconModel.IconLocation, this.mAppIconModel.IconHeight, this.mAppIconModel.IconWidth); }
private void AddAppSuggestionIcon(AppSuggestionPromotion appSuggestionInfo) { string appPackage = appSuggestionInfo.AppPackage; double height = 50.0; double width = 50.0; AppIconModel newIconForKey = this.GetNewIconForKey(appPackage); try { if (newIconForKey == null) { return; } newIconForKey.IsAppSuggestionActive = true; newIconForKey.PackageName = appPackage; if (appSuggestionInfo.IsShowRedDot) { newIconForKey.IsRedDotVisible = true; } newIconForKey.Init(appSuggestionInfo); if (appSuggestionInfo.IsEmailRequired && !RegistryManager.Instance.Guest[this.mParentWindow.mVmName].IsGoogleSigninDone) { return; } if (string.Equals(appSuggestionInfo.AppLocation, "dock", StringComparison.InvariantCultureIgnoreCase)) { if (appSuggestionInfo.IconHeight != 0.0) { height = appSuggestionInfo.IconHeight; } if (appSuggestionInfo.IconWidth != 0.0) { width = appSuggestionInfo.IconWidth; } newIconForKey.AddToDock(height, width); this.mHomeApp?.AddDockPanelIcon(newIconForKey, (DownloadInstallApk)null); } else if (string.Equals(appSuggestionInfo.AppLocation, "more_apps", StringComparison.InvariantCultureIgnoreCase)) { newIconForKey.AddToMoreAppsDock(55.0, 55.0); this.mHomeApp?.AddMoreAppsDockPanelIcon(newIconForKey, (DownloadInstallApk)null); } else { newIconForKey.AddToInstallDrawer(); this.mHomeApp?.AddInstallDrawerIcon(newIconForKey, (DownloadInstallApk)null); } } catch (Exception ex) { Logger.Error("Exception in adding app suggestion icon: " + ex.ToString()); } }
internal void AddMacroAppIcon(string package) { if (string.IsNullOrEmpty(package)) { return; } AppIconModel newIconForKey = this.GetNewIconForKey(package + "_macro"); string appname = LocaleStrings.GetLocalizedString("STRING_REROLL_APP_PREFIX", "") + " - " + newIconForKey.AppName; newIconForKey.InitRerollIcon(package, appname); newIconForKey.AddToInstallDrawer(); this.mHomeApp?.AddInstallDrawerIcon(newIconForKey, (DownloadInstallApk)null); }
internal void RemoveAppIcon(string package, AppIconModel newAppIconCreated = null) { if (package == null || !this.dictAppIcons.ContainsKey(package)) { return; } if (newAppIconCreated != null) { newAppIconCreated.AppIncompatType = this.dictAppIcons[package].AppIncompatType; } this.mHomeApp?.RemoveAppIconFromUI(this.dictAppIcons[package]); this.dictAppIcons.Remove(package); }
internal void Init( string args, string appName, PlayStoreAction action, bool isWindowForcedTillLoaded = false) { this.Dispatcher.Invoke((Delegate)(() => { if (!this.ParentWindow.mGuestBootCompleted) { CustomMessageWindow customMessageWindow = new CustomMessageWindow(); BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_POST_OTS_SYNCING_BUTTON_MESSAGE", ""); BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_GUEST_NOT_BOOTED", ""); customMessageWindow.AddButton(ButtonColors.Blue, "STRING_OK", (EventHandler)null, (string)null, false, (object)null, true); customMessageWindow.Owner = (Window)this.ParentWindow; customMessageWindow.ShowDialog(); } else if (action == PlayStoreAction.OpenApp && this.ParentWindow.mAppHandler.IsAppInstalled(args) && !"com.android.vending".Equals(args, StringComparison.InvariantCultureIgnoreCase)) { AppIconModel appIcon = this.ParentWindow.mWelcomeTab.mHomeAppManager.GetAppIcon(args); if (appIcon == null) { return; } if (appIcon.AppIncompatType != AppIncompatType.None && !this.ParentWindow.mTopBar.mAppTabButtons.mDictTabs.ContainsKey(appIcon.PackageName)) { GrmHandler.HandleCompatibility(appIcon.PackageName, this.ParentWindow.mVmName); } else { this.ParentWindow.mTopBar.mAppTabButtons.AddAppTab(appIcon.AppName, appIcon.PackageName, appIcon.ActivityName, appIcon.ImageName, true, true, false); } } else { if (string.IsNullOrEmpty(args)) { return; } if (!this.ParentWindow.WelcomeTabParentGrid.IsVisible) { this.ParentWindow.mCommonHandler.HomeButtonHandler(false, false); } this.mBaseControl.mTitleLabel.Content = (object)appName; this.mAction = action; this.Visibility = Visibility.Visible; this.ParentWindow.ChangeOrientationFromClient(false, false); this.ProcessArgs(args, isWindowForcedTillLoaded); } })); }
internal void OpenFrontendAppTabControl(string packageName, PlayStoreAction action) { this.Dispatcher.Invoke((Delegate)(() => { if (action == PlayStoreAction.OpenApp && this.ParentWindow.mAppHandler.IsAppInstalled(packageName) && !"com.android.vending".Equals(packageName, StringComparison.InvariantCultureIgnoreCase)) { AppIconModel appIcon = this.mHomeAppManager.GetAppIcon(packageName); if (appIcon == null) { return; } if (appIcon.AppIncompatType != AppIncompatType.None && !this.ParentWindow.mTopBar.mAppTabButtons.mDictTabs.ContainsKey(packageName)) { GrmHandler.HandleCompatibility(appIcon.PackageName, this.ParentWindow.mVmName); } else { this.ParentWindow.mTopBar.mAppTabButtons.AddAppTab(appIcon.AppName, appIcon.PackageName, appIcon.ActivityName, appIcon.ImageName, true, true, false); } } else { if (string.IsNullOrEmpty(packageName)) { return; } AppIconModel appIcon = this.mHomeAppManager.GetAppIcon("com.android.vending"); if (appIcon == null) { return; } if (action == PlayStoreAction.OpenApp) { this.ParentWindow.mTopBar.mAppTabButtons.AddAppTab(appIcon.AppName, appIcon.PackageName, appIcon.ActivityName, appIcon.ImageName, false, true, false); this.ParentWindow.mAppHandler.SwitchWhenPackageNameRecieved = "com.android.vending"; this.ParentWindow.mAppHandler.LaunchPlayRequestAsync(packageName); } else { if (action != PlayStoreAction.SearchApp) { return; } this.ParentWindow.mTopBar.mAppTabButtons.AddAppTab(appIcon.AppName, appIcon.PackageName, appIcon.ActivityName, appIcon.ImageName, false, true, false); this.ParentWindow.mAppHandler.SwitchWhenPackageNameRecieved = "com.android.vending"; this.ParentWindow.mAppHandler.SendSearchPlayRequestAsync(packageName); } } })); }
internal static void RefreshGrmIndication(string package, string vmName = "Android") { try { List <AppRequirement> requirements = AppRequirementsParser.Instance.Requirements; if (requirements == null) { return; } if (!GrmHandler.sDictAppRuleSet.ContainsKey(vmName)) { GrmHandler.sDictAppRuleSet[vmName] = new Dictionary <string, GrmRuleSet>(); } AppIconModel appIcon = BlueStacksUIUtils.DictWindows[vmName].mWelcomeTab.mHomeAppManager.GetAppIcon(package); if (appIcon == null) { return; } if (appIcon.AppIncompatType != AppIncompatType.None && !requirements.Any <AppRequirement>((Func <AppRequirement, bool>)(_ => string.Equals(_.PackageName, package, StringComparison.OrdinalIgnoreCase)))) { GrmHandler.RemoveAppCompatError(appIcon, BlueStacksUIUtils.DictWindows[vmName]); } AppRequirement appRequirement = requirements.Where <AppRequirement>((Func <AppRequirement, bool>)(_ => string.Compare(_.PackageName, package, StringComparison.OrdinalIgnoreCase) == 0)).FirstOrDefault <AppRequirement>() ?? requirements.Where <AppRequirement>((Func <AppRequirement, bool>)(_ => { if (!_.PackageName.EndsWith("*", StringComparison.InvariantCulture)) { return(false); } return(package.StartsWith(_.PackageName.Trim('*'), StringComparison.InvariantCulture)); })).FirstOrDefault <AppRequirement>(); if (appRequirement == null) { return; } GrmRuleSet requirement = appRequirement.EvaluateRequirement(package, vmName); if (requirement != null) { GrmHandler.AddGRMIndicationForIncompatibleApp(appIcon, BlueStacksUIUtils.DictWindows[vmName], requirement); } else { GrmHandler.RemoveAppCompatError(appIcon, BlueStacksUIUtils.DictWindows[vmName]); } } catch (Exception ex) { Logger.Error("Exception in RefreshGrmIndication. Exception: " + ex?.ToString()); } }
internal AppIconModel GetAppIcon(string packageName) { if (FeatureManager.Instance.IsCustomUIForNCSoft && packageName == BlueStacksUIUtils.sUserAccountPackageName) { Logger.Info("Setting packageName to com.android.vending when com.uncube.account is received"); packageName = "com.android.vending"; } AppIconModel appIconModel = (AppIconModel)null; if (this.dictAppIcons.ContainsKey(packageName) && !string.IsNullOrEmpty(packageName)) { appIconModel = this.dictAppIcons[packageName]; } return(appIconModel); }
internal void AddAppIcon( string package, string appName, string apkUrl, DownloadInstallApk downloader) { if (string.IsNullOrEmpty(package)) { return; } AppIconModel newIconForKey = this.GetNewIconForKey(package); newIconForKey.Init(package, appName, apkUrl); newIconForKey.AddToInstallDrawer(); this.mHomeApp?.AddInstallDrawerIcon(newIconForKey, downloader); }
private void SigninBtn_Click(object sender, RoutedEventArgs e) { try { AppIconModel appIcon = this.ParentWindow.mWelcomeTab.mHomeAppManager.GetAppIcon("com.android.vending"); if (appIcon != null) { this.ParentWindow.mTopBar.mAppTabButtons.AddAppTab(appIcon.AppName, appIcon.PackageName, appIcon.ActivityName, appIcon.ImageName, true, true, false); } ClientStats.SendMiscellaneousStatsAsync("GoogleSigninClick", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, (string)null, (string)null, RegistryManager.Instance.InstallID, (string)null, (string)null, (string)null, "Android"); BlueStacksUIUtils.CloseContainerWindow((FrameworkElement)this); } catch (Exception ex) { Logger.Error("Exception in SigninBtn_Click. Exception: " + ex?.ToString()); } }
internal void AddInstallDrawerIcon(AppIconModel icon, DownloadInstallApk downloadInstallApk = null) { int index = 0; foreach (AppIconUI appIconUi in this.InstalledAppsDrawer.Children.OfType <AppIconUI>()) { if (appIconUi.mAppIconModel.MyAppPriority <= icon.MyAppPriority) { ++index; } else { break; } } AppIconUI newAppIconUi = this.GetNewAppIconUI(icon, downloadInstallApk); this.InstalledAppsDrawer.Children.Insert(index, (UIElement)newAppIconUi); }
private void RemoveIconIfExists() { List <string> stringList = new List <string>(); JsonParser jsonParser = new JsonParser(this.mParentWindow.mVmName); foreach (AppIconModel appIconModel in this.dictAppIcons.Values) { AppIconModel icon = appIconModel; lock (((ICollection)PromotionObject.Instance.AppSuggestionList).SyncRoot) { if (!icon.IsAppSuggestionActive) { if (!icon.IsInstalledApp) { if (!PromotionObject.Instance.AppSuggestionList.Any <AppSuggestionPromotion>((Func <AppSuggestionPromotion, bool>)(_ => string.Equals(_.AppLocation, "more_apps", StringComparison.InvariantCulture)))) { continue; } } else { continue; } } if (!PromotionObject.Instance.AppSuggestionList.Any <AppSuggestionPromotion>((Func <AppSuggestionPromotion, bool>)(_ => string.Equals(_.AppPackage, icon.PackageName, StringComparison.InvariantCultureIgnoreCase)))) { if (!jsonParser.IsAppInstalled(icon.PackageName)) { stringList.Add(icon.PackageName); } else { icon.RemovePromotionBorderInstalledApp(); } } } } foreach (string package in stringList) { this.RemoveAppIcon(package, (AppIconModel)null); } }
internal void AddDockPanelIcon(AppIconModel icon, DownloadInstallApk downloadInstallApk = null) { int index = 0; foreach (AppIconUI appIconUi in this.mDockPanel.Children.OfType <AppIconUI>()) { if (appIconUi.mAppIconModel.MyAppPriority <= icon.MyAppPriority) { ++index; } else { break; } } AppIconUI newAppIconUi = this.GetNewAppIconUI(icon, downloadInstallApk); this.mDockPanel.Children.Insert(index, (UIElement)newAppIconUi); this.mDockPanel.Children.Remove((UIElement)this.moreAppsIcon); this.mDockPanel.Children.Add((UIElement)this.moreAppsIcon); }
internal void RemoveAppIconFromUI(AppIconModel appIcon) { this.InstalledAppsDrawer.Children.Remove((UIElement)this.InstalledAppsDrawer.Children.Cast <AppIconUI>().Where <AppIconUI>((Func <AppIconUI, bool>)(s => s.mAppIconModel.PackageName == appIcon.PackageName)).FirstOrDefault <AppIconUI>()); this.mDockPanel.Children.Remove((UIElement)this.mDockPanel.Children.Cast <AppIconUI>().Where <AppIconUI>((Func <AppIconUI, bool>)(s => s.mAppIconModel.PackageName == appIcon.PackageName)).FirstOrDefault <AppIconUI>()); this.mMoreAppsDockPanel.Children.Remove((UIElement)this.mMoreAppsDockPanel.Children.Cast <AppIconUI>().Where <AppIconUI>((Func <AppIconUI, bool>)(s => s.mAppIconModel.PackageName == appIcon.PackageName)).FirstOrDefault <AppIconUI>()); }
public void AppLaunched(string packageName, string currentActivity = "", bool forced = false) { lock (this.sLockObject) { if (this.ParentWindow.IsClosed) { return; } this.CurrentActivityName = currentActivity; if ((packageName == BlueStacksUIUtils.sUserAccountPackageName || packageName == "com.android.vending") && this.mSwitchWhenPackageNameRecieved == "com.android.vending") { packageName = this.mSwitchWhenPackageNameRecieved; if (string.Compare(this.mLastRunAppSentForSynced, packageName, StringComparison.OrdinalIgnoreCase) == 0) { this.mSwitchWhenPackageNameRecieved = ""; } } if (!forced && string.Equals(packageName, this.mLastAppDisplayed, StringComparison.InvariantCultureIgnoreCase)) { return; } if (!this.mIsOneTimeSetupCompleted) { if (string.IsNullOrEmpty(packageName) || !packageName.StartsWith("com.google.android.gms", StringComparison.InvariantCultureIgnoreCase) && !packageName.Equals("com.google.android.setupwizard", StringComparison.InvariantCultureIgnoreCase)) { return; } this.StartOTSCheckThread(); } else { Logger.Info("SwitchWhenPackageNameRecieved: {0}", (object)this.mSwitchWhenPackageNameRecieved); this.ParentWindow.ShowLoadingGrid(false); bool receivedFromImap = string.Compare(this.mLastRunAppSentForSynced, packageName, StringComparison.OrdinalIgnoreCase) == 0; if (receivedFromImap) { this.mLastRunAppSentForSynced = ""; } if (!string.IsNullOrEmpty(this.mSwitchWhenPackageNameRecieved) && string.Equals(packageName, this.mSwitchWhenPackageNameRecieved, StringComparison.OrdinalIgnoreCase)) { this.mSwitchWhenPackageNameRecieved = string.Empty; if (AppHandler.EventOnAppDisplayed == null) { this.ParentWindow.Dispatcher.Invoke((Delegate)(() => { this.ParentWindow.mTopBar.mAppTabButtons.GoToTab(packageName, receivedFromImap, false); Publisher.PublishMessage(BrowserControlTags.tabSwitched, this.ParentWindow.mVmName, new JObject((object)new JProperty("PackageName", (object)packageName))); })); } else { EventHandler <EventArgs> eventOnAppDisplayed = AppHandler.EventOnAppDisplayed; AppHandler.EventOnAppDisplayed = (EventHandler <EventArgs>)null; MainWindow parentWindow = this.ParentWindow; EventArgs e = new EventArgs(); eventOnAppDisplayed((object)parentWindow, e); } } else if (this.mDefaultLauncher.Equals(packageName, StringComparison.InvariantCultureIgnoreCase)) { if (!Oem.IsOEMDmm) { Logger.Info("Assuming app is crashed/exited going to last tab"); this.ParentWindow.Dispatcher.Invoke((Delegate)(() => { if (this.ParentWindow.mFrontendGrid == null) { return; } if (this.ParentWindow.mFrontendGrid.Parent as Grid == this.ParentWindow.FrontendParentGrid) { if (this.ParentWindow.mTopBar.mAppTabButtons.SelectedTab != null && this.ParentWindow.mTopBar.mAppTabButtons.SelectedTab.mTabType == TabType.AppTab) { this.ParentWindow.mTopBar.mAppTabButtons.CloseTab(this.ParentWindow.mTopBar.mAppTabButtons.SelectedTab.TabKey, false, false, true, false, packageName); } if (RegistryManager.Instance.InstallationType != InstallationTypes.GamingEdition) { return; } this.PerformGamingAction("", ""); } else { this.ParentWindow.mWelcomeTab.mFrontendPopupControl.HideWindow(); } })); } } else { AppIconModel icon = this.ParentWindow.mWelcomeTab.mHomeAppManager.GetAppIcon(packageName); if (icon != null) { this.ParentWindow.Dispatcher.Invoke((Delegate)(() => this.ParentWindow.mTopBar.mAppTabButtons.AddAppTab(icon.AppName, icon.PackageName, icon.ActivityName, icon.ImageName, true, false, receivedFromImap))); } } this.mLastAppDisplayed = packageName; } } }
public void SendRunAppRequestAsync(string package, string activity = "", bool receivedFromImap = false) { ThreadPool.QueueUserWorkItem((WaitCallback)(obj => { if (this.ParentWindow.SendClientActions && !receivedFromImap) { Dictionary <string, string> data = new Dictionary <string, string>(); Dictionary <string, string> dictionary = new Dictionary <string, string>() { { "EventAction", "RunApp" }, { "Package", package }, { "Activity", activity } }; JsonSerializerSettings serializerSettings = Utils.GetSerializerSettings(); serializerSettings.Formatting = Newtonsoft.Json.Formatting.None; data.Add("operationData", JsonConvert.SerializeObject((object)dictionary, serializerSettings)); this.ParentWindow.mFrontendHandler.SendFrontendRequestAsync("handleClientOperation", data); } if (receivedFromImap) { this.mLastRunAppSentForSynced = package; if (package == "com.android.vending") { this.mSwitchWhenPackageNameRecieved = package; } } if (string.IsNullOrEmpty(activity)) { AppIconModel appIcon = this.ParentWindow.mWelcomeTab.mHomeAppManager.GetAppIcon(package); if (appIcon != null) { activity = appIcon.ActivityName; } if (string.IsNullOrEmpty(activity)) { activity = ".Main"; Logger.Info("Empty activity name ovveriding .Main for package: " + package); } } if (PackageActivityNames.ThirdParty.AllPUBGPackageNames.Contains(package)) { string displayQualityPubg = RegistryManager.Instance.Guest[this.ParentWindow.mVmName].DisplayQualityPubg; string gamingResolutionPubg = RegistryManager.Instance.Guest[this.ParentWindow.mVmName].GamingResolutionPubg; if (string.Equals(displayQualityPubg, "-1", StringComparison.InvariantCulture) && string.Equals(gamingResolutionPubg, "1", StringComparison.InvariantCulture)) { this.SendRunex(package, activity); } else { StringBuilder sb = new StringBuilder(); using (JsonWriter jsonWriter = (JsonWriter) new JsonTextWriter((TextWriter) new StringWriter(sb))) { jsonWriter.WriteStartObject(); if (string.Equals(RegistryManager.Instance.Guest[this.ParentWindow.mVmName].DisplayQualityPubg, "-1", StringComparison.InvariantCulture)) { jsonWriter.WritePropertyName("renderqualitylevel"); jsonWriter.WriteValue("0"); } else { jsonWriter.WritePropertyName("renderqualitylevel"); jsonWriter.WriteValue(RegistryManager.Instance.Guest[this.ParentWindow.mVmName].DisplayQualityPubg); } jsonWriter.WritePropertyName("contentscale"); jsonWriter.WriteValue(RegistryManager.Instance.Guest[this.ParentWindow.mVmName].GamingResolutionPubg); jsonWriter.WriteEndObject(); } Logger.Info("The response we get is: " + HTTPUtils.SendRequestToGuest("customStartActivity", new Dictionary <string, string>() { { "component", package + "/" + activity }, { "extras", sb.ToString() } }, this.ParentWindow.mVmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp")); } } else if (PackageActivityNames.ThirdParty.AllCallOfDutyPackageNames.Contains(package)) { int num1 = int.Parse(RegistryManager.Instance.Guest[this.ParentWindow.mVmName].DisplayQualityCOD, (IFormatProvider)CultureInfo.InvariantCulture); int num2 = int.Parse(RegistryManager.Instance.Guest[this.ParentWindow.mVmName].GamingResolutionCOD, (IFormatProvider)CultureInfo.InvariantCulture); int num3 = int.Parse("1", (IFormatProvider)CultureInfo.InvariantCulture); StringBuilder sb = new StringBuilder(); using (JsonWriter jsonWriter = (JsonWriter) new JsonTextWriter((TextWriter) new StringWriter(sb))) { jsonWriter.WriteStartObject(); if (string.Equals(num1.ToString((IFormatProvider)CultureInfo.InvariantCulture), "-1", StringComparison.InvariantCulture)) { jsonWriter.WritePropertyName("QualityLevel"); jsonWriter.WriteValue(int.Parse("0", (IFormatProvider)CultureInfo.InvariantCulture)); } else { jsonWriter.WritePropertyName("QualityLevel"); jsonWriter.WriteValue(num1); } jsonWriter.WritePropertyName("ResolutionHeight"); jsonWriter.WriteValue(num2); jsonWriter.WritePropertyName("FrameRateLevel"); jsonWriter.WriteValue(num3); jsonWriter.WriteEndObject(); } Logger.Info("The response we get is: " + HTTPUtils.SendRequestToGuest("customStartActivity", new Dictionary <string, string>() { { "component", package + "/" + activity }, { "extras", sb.ToString() } }, this.ParentWindow.mVmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp")); } else if ("com.android.chrome".Equals(package, StringComparison.InvariantCultureIgnoreCase)) { HTTPUtils.SendRequestToGuest("launchchrome", (Dictionary <string, string>)null, this.ParentWindow.mVmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"); } else { this.SendRunex(package, activity); } })); }