示例#1
0
        internal int InstallFLEApk(string packageName, string apkPath)
        {
            Logger.Info("Installing apk: {0}", (object)apkPath);
            int num = BluestacksProcessHelper.RunApkInstaller(apkPath, true, this.ParentWindow.mVmName);

            Logger.Info("Apk installer exit code: {0}", (object)num);
            if (num == 0)
            {
                if (DownloadInstallApk.sDownloadedApkList.Contains(packageName))
                {
                    ClientStats.SendClientStatsAsync("install_from_download", "success", "app_install", packageName, "", "");
                    DownloadInstallApk.sDownloadedApkList.Remove(packageName);
                    this.UpdateCdnAppEntry(true, packageName, "");
                }
                else if (DownloadInstallApk.sApkInstalledFromChooser.Contains(packageName))
                {
                    ClientStats.SendClientStatsAsync("install", "success", "app_install", packageName, "", "");
                    DownloadInstallApk.sApkInstalledFromChooser.Remove(packageName);
                }
                this.ParentWindow.Utils.RunAppOrCreateTabButton(packageName);
                Logger.Info("Installation successful.");
                File.Delete(apkPath);
            }
            else
            {
                if (DownloadInstallApk.sDownloadedApkList.Contains(packageName))
                {
                    ClientStats.SendClientStatsAsync("install_from_download", "fail", "app_install", packageName, num.ToString((IFormatProvider)CultureInfo.InvariantCulture), "");
                    DownloadInstallApk.sDownloadedApkList.Remove(packageName);
                }
                else if (DownloadInstallApk.sApkInstalledFromChooser.Contains(packageName))
                {
                    ClientStats.SendClientStatsAsync("install", "fail", "app_install", packageName, num.ToString((IFormatProvider)CultureInfo.InvariantCulture), "");
                    DownloadInstallApk.sApkInstalledFromChooser.Remove(packageName);
                }
                ClientStats.SendGeneralStats("apk_inst_error", new Dictionary <string, string>()
                {
                    {
                        "errcode",
                        Convert.ToString(num, (IFormatProvider)CultureInfo.InvariantCulture)
                    },
                    {
                        "precode",
                        "0"
                    },
                    {
                        "app_pkg",
                        packageName
                    }
                });
            }
            Logger.Info("Install Completed : " + packageName);
            return(num);
        }
示例#2
0
 internal static void ReleaseLock()
 {
     try
     {
         BluestacksProcessHelper.TakeLock("Global\\BlueStacks_BlueStacksUI_Closing_Lockbgp");
         if (App.BlueStacksUILock == null)
         {
             return;
         }
         App.BlueStacksUILock.Close();
         App.BlueStacksUILock = (Mutex)null;
     }
     catch (Exception ex)
     {
         Logger.Warning("Ignoring Exception while releasing lock. Err : " + ex.ToString());
     }
 }
 private static void HandleClientOnlyUpgrade(string downloadedFilePath)
 {
     Logger.Info("In HandleClientOnlyUpgrade");
     try
     {
         int num = BlueStacksUpdater.ExtractingClientInstaller(downloadedFilePath);
         if (num == 0)
         {
             BluestacksProcessHelper.RunUpdateInstaller(Path.Combine(Path.Combine(RegistryManager.Instance.SetupFolder, Path.GetFileNameWithoutExtension(downloadedFilePath)), "Bootstrapper.exe"), "", false);
         }
         else
         {
             Logger.Warning("Update extraction failed, ExitCode: {0}", (object)num);
             System.IO.File.Delete(downloadedFilePath);
         }
     }
     catch (Exception ex)
     {
         Logger.Error("Some Error in Client Upgrade err: ", (object)ex.ToString());
     }
 }
 private static void HandleFullUpgrade(string downloadedFilePath)
 {
     Logger.Info("In HandleFullUpgrade");
     BluestacksProcessHelper.RunUpdateInstaller(downloadedFilePath, "-u -upgradesourcepath BluestacksUI", false);
 }
        internal void StartFrontend()
        {
            ThreadPool.QueueUserWorkItem((WaitCallback)(obj =>
            {
                Logger.Info("BOOT_STAGE: Starting player");
                if (ProcessUtils.IsLockInUse(Strings.GetPlayerLockName(this.mVmName, "bgp")))
                {
                    this.KillFrontend(true);
                }
                this.mEventOnFrontendClosed = (EventHandler)null;
                this.mIsSufficientRAMAvailable = true;
                this.IsRestartFrontendWhenClosed = true;
                this.mFrontendStartTime = DateTime.Now;
                int num = BluestacksProcessHelper.StartFrontend(this.mVmName);
                if (this.ParentWindow == null)
                {
                    this.WaitForParentWindowInit();
                }
                if (this.ParentWindow != null)
                {
                    switch (num)
                    {
                    case -10:
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            string url = (string)null;
                            url = WebHelper.GetUrlWithParams(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}/{1}", (object)WebHelper.GetServerHost(), (object)"help_articles"), (string)null, (string)null, (string)null);
                            url = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}&article={1}", (object)url, (object)"enable_virtualization");
                            string path = "STRING_VTX_DISABLED_ENABLEIT_BODY";
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_RESTART_UTILITY_CANNOT_START", "");
                            customMessageWindow.AddAboveBodyWarning(LocaleStrings.GetLocalizedString("STRING_VTX_DISABLED_WARNING", ""));
                            customMessageWindow.AboveBodyWarningTextBlock.Visibility = Visibility.Visible;
                            customMessageWindow.MessageIcon.VerticalAlignment = VerticalAlignment.Center;
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, path, "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_CHECK_FAQ", (EventHandler)((sender1, e1) => BlueStacksUIUtils.OpenUrl(url)), (string)null, false, (object)null, true);
                            customMessageWindow.AddButton(ButtonColors.White, "STRING_EXIT", (EventHandler)null, (string)null, false, (object)null, true);
                            customMessageWindow.ShowDialog();
                            App.ExitApplication();
                        }));
                        break;

                    case -7:
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            Logger.Error("VBox couldn't detect driver");
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_ENGINE_FAIL_HEADER", "");
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_COULDNT_BOOT_TRY_RESTART", "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_RESTART_PC", new EventHandler(this.RestartPCEvent), (string)null, false, (object)null, true);
                            customMessageWindow.AddButton(ButtonColors.White, "STRING_EXIT", (EventHandler)null, (string)null, false, (object)null, true);
                            customMessageWindow.ShowDialog();
                            App.ExitApplication();
                        }));
                        break;

                    case -6:
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            Logger.Error("Unable to initialise audio on this machine");
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            customMessageWindow.ImageName = "sound_error";
                            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_AUDIO_SERVICE_FAILURE", "");
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlockTitle, "STRING_AUDIO_SERVICE_FAILUE_FIX", "");
                            customMessageWindow.BodyTextBlockTitle.Visibility = Visibility.Visible;
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_AUDIO_SERVICE_FAILURE_ALTERNATE_FIX", "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_READ_MORE", (EventHandler)((sender1, e1) => BlueStacksUIUtils.OpenUrl(WebHelper.GetUrlWithParams(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}/{1}", (object)WebHelper.GetServerHost(), (object)"help_articles"), (string)null, (string)null, (string)null) + "&article=audio_service_issue")), "external_link", true, (object)null, true);
                            customMessageWindow.ShowDialog();
                            App.ExitApplication();
                        }));
                        break;

                    case -5:
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            Logger.Error("Hyper v enabled on this machine");
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_RESTART_UTILITY_CANNOT_START", "");
                            customMessageWindow.AddWarning(LocaleStrings.GetLocalizedString("STRING_HYPERV_ENABLED_WARNING", ""), "message_error");
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_HYPERV_ENABLED_MESSAGE", "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_CHECK_FAQ", (EventHandler)((sender1, e1) => BlueStacksUIUtils.OpenUrl(WebHelper.GetUrlWithParams(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}/{1}", (object)WebHelper.GetServerHost(), (object)"help_articles"), (string)null, (string)null, (string)null) + "&article=disable_hypervisor")), (string)null, false, (object)null, true);
                            customMessageWindow.ShowDialog();
                            App.ExitApplication();
                        }));
                        break;

                    case -2:
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            Logger.Error("Android File Integrity check failed");
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_CORRUPT_INSTALLATION", "");
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_CORRUPT_INSTALLATION_MESSAGE", "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_EXIT", (EventHandler)null, (string)null, false, (object)null, true);
                            customMessageWindow.ShowDialog();
                            App.ExitApplication();
                        }));
                        break;

                    default:
                        if (!this.IsRestartFrontendWhenClosed)
                        {
                            break;
                        }
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            if (this.frontendRestartAttempts >= 2)
                            {
                                return;
                            }
                            ++this.frontendRestartAttempts;
                            this.ParentWindow.RestartFrontend();
                        }));
                        break;
                    }
                }
                else
                {
                    Logger.Error("parent window is null for vmName: {0} and frontend Exit code: {1}", (object)this.mVmName, (object)num);
                }
            }));
        }
示例#6
0
 internal void InstallApk(
     string packageName,
     string apkPath,
     bool isLaunchAfterInstall,
     bool isDeleteApk,
     string timestamp = "")
 {
     this.ParentWindow.mWelcomeTab.mHomeAppManager.ApkInstallStart(packageName, apkPath);
     DownloadInstallApk.SerialWorkQueueInstaller(this.ParentWindow.mVmName).Enqueue((SerialWorkQueue.Work)(() =>
     {
         Logger.Info("Installing apk: {0}", (object)apkPath);
         int num = BluestacksProcessHelper.RunApkInstaller(apkPath, true, this.ParentWindow.mVmName);
         Logger.Info("Apk installer exit code: {0}", (object)num);
         if (num == 0)
         {
             if (DownloadInstallApk.sDownloadedApkList.Contains(packageName))
             {
                 ClientStats.SendClientStatsAsync("install_from_download", "success", "app_install", packageName, "", "");
                 DownloadInstallApk.sDownloadedApkList.Remove(packageName);
                 this.UpdateCdnAppEntry(true, packageName, timestamp);
             }
             else if (DownloadInstallApk.sApkInstalledFromChooser.Contains(packageName))
             {
                 ClientStats.SendClientStatsAsync("install", "success", "app_install", packageName, "", "");
                 DownloadInstallApk.sApkInstalledFromChooser.Remove(packageName);
             }
             this.ParentWindow.mWelcomeTab.mHomeAppManager.ApkInstallCompleted(packageName);
             if (isLaunchAfterInstall)
             {
                 this.ParentWindow.Utils.RunAppOrCreateTabButton(packageName);
             }
             Logger.Info("Installation successful.");
             if (isDeleteApk)
             {
                 File.Delete(apkPath);
             }
             Logger.Info("Install Completed : " + packageName);
         }
         else
         {
             if (DownloadInstallApk.sDownloadedApkList.Contains(packageName))
             {
                 ClientStats.SendClientStatsAsync("install_from_download", "fail", "app_install", packageName, num.ToString((IFormatProvider)CultureInfo.InvariantCulture), "");
                 DownloadInstallApk.sDownloadedApkList.Remove(packageName);
             }
             else if (DownloadInstallApk.sApkInstalledFromChooser.Contains(packageName))
             {
                 ClientStats.SendClientStatsAsync("install", "fail", "app_install", packageName, num.ToString((IFormatProvider)CultureInfo.InvariantCulture), "");
                 DownloadInstallApk.sApkInstalledFromChooser.Remove(packageName);
             }
             ClientStats.SendGeneralStats("apk_inst_error", new Dictionary <string, string>()
             {
                 {
                     "errcode",
                     Convert.ToString(num, (IFormatProvider)CultureInfo.InvariantCulture)
                 },
                 {
                     "precode",
                     "0"
                 },
                 {
                     "app_pkg",
                     packageName
                 }
             });
             this.ParentWindow.mWelcomeTab.mHomeAppManager.ApkInstallFailed(packageName);
         }
     }));
 }