Ejemplo n.º 1
0
 internal static void CheckAndRunPortableInstaller()
 {
     try
     {
         if (!Oem.Instance.IsPortableInstaller)
         {
             return;
         }
         string registryValue = (string)RegistryUtils.GetRegistryValue(Strings.RegistryBaseKeyPath, "Version", (object)"", RegistryKeyKind.HKEY_LOCAL_MACHINE);
         string fullName      = Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory.Trim('\\')).FullName;
         Logger.InitLogAtPath(Path.Combine(fullName, "Logs\\PortableInstaller.log"), nameof(PortableInstaller), true);
         if (!string.IsNullOrEmpty(registryValue) && !((string)RegistryUtils.GetRegistryValue(Strings.RegistryBaseKeyPath, "InstallDir", (object)"", RegistryKeyKind.HKEY_LOCAL_MACHINE) != Path.Combine(fullName, "BlueStacksPF")) && !Opt.Instance.isForceInstall)
         {
             return;
         }
         PortableInstaller.InstallPortableBlueStacks(AppDomain.CurrentDomain.BaseDirectory);
     }
     catch (Exception ex)
     {
         Logger.Info("Error in CheckAndRunPortableInstaller" + ex?.ToString());
     }
 }
Ejemplo n.º 2
0
 private static void InstallPortableBlueStacks(string cwd)
 {
     try
     {
         string fullName   = Directory.GetParent(cwd.Trim('\\')).FullName;
         string str        = Path.Combine(fullName, "Engine");
         string installDir = Path.Combine(fullName, "BlueStacksPF");
         string path1      = Path.Combine(Path.Combine(str, "Android"), "Android.bstk");
         string path2      = Path.Combine(Path.Combine(str, "Manager"), "BstkGlobal.xml");
         if (File.Exists(path1))
         {
             File.Delete(path1);
         }
         if (File.Exists(path2))
         {
             File.Delete(path2);
         }
         CommonInstallUtils.ModifyDirectoryPermissionsForEveryone(fullName);
         if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "install.bat")))
         {
             if (PortableInstaller.RunInstallBat(installDir, str) != 0)
             {
                 return;
             }
             PortableInstaller.FixRegistries(fullName, installDir);
             PortableInstaller.DoComRegistration(installDir);
             CommonInstallUtils.InstallVirtualBoxConfig(str, false);
             CommonInstallUtils.InstallVmConfig(installDir, str);
         }
         else
         {
             Logger.Error("Install.bat file missing");
         }
     }
     catch (Exception ex)
     {
         Logger.Error("Exception in InstallPortableBlueStacks " + ex?.ToString());
     }
 }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
            App.InitExceptionAndLogging();
            ProcessUtils.LogParentProcessDetails();
            if (args != null)
            {
                App.ParseWebMagnetArgs(ref args);
                Opt.Instance.Parse(args);
            }
            string path = Path.Combine(Path.Combine(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory.Trim('\\')).FullName, "Engine"), "Oem.cfg");

            Oem.CurrentOemFilePath = System.IO.File.Exists(path) ? path : Path.Combine(RegistryManager.Instance.EngineDataDir, "Oem.cfg");
            PortableInstaller.CheckAndRunPortableInstaller();
            if (!RegistryManager.Instance.Guest.ContainsKey(Opt.Instance.vmname))
            {
                Opt.Instance.vmname = "Android";
            }
            BlueStacks.Common.Strings.CurrentDefaultVmName = Opt.Instance.vmname;
            if (Opt.Instance.mergeCfg)
            {
                KMManager.MergeConfig(Opt.Instance.newPDPath);
                Environment.Exit(0);
            }
            string mBSTProcessIdentifier = "Bluestacks/" + RegistryManager.Instance.ClientVersion;

            if (!string.Join(string.Empty, args).Contains(mBSTProcessIdentifier))
            {
                Logger.Info("BOOT_STAGE: Client starting");
                if (Oem.IsOEMDmm)
                {
                    Logger.Info("checking DMMGamePlayer process");
                    if (!ProcessUtils.FindProcessByName("DMMGamePlayer") && !ProcessUtils.FindProcessByName("dmmemulatorsandboxlauncher"))
                    {
                        Logger.Info("DMM game player not running, so exiting");
                        Environment.Exit(0);
                    }
                }
                RegistryManager.ClientThemeName = RegistryManager.Instance.GetClientThemeNameFromRegistry();
                if (Oem.IsOEMDmm || !BlueStacksUpdater.CheckIfDownloadedFileExist())
                {
                    App app = new App();
                    app.Startup     += new StartupEventHandler(App.Application_Startup);
                    app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
                    app.InitializeComponent();
                    App.CheckIfAlreadyRunning();
                    RegistryManager.Instance.ClientLaunchParams = Opt.Instance.Json;
                    App.defaultResolution = new Fraction((long)RegistryManager.Instance.Guest[BlueStacks.Common.Strings.CurrentDefaultVmName].GuestWidth, (long)RegistryManager.Instance.Guest[BlueStacks.Common.Strings.CurrentDefaultVmName].GuestHeight);
                    SystemEvents.DisplaySettingsChanged += new EventHandler(App.HandleDisplaySettingsChanged);
                    BGPHelper.InitHttpServerAsync();
                    BlueStacksUIUtils.RunInstance(BlueStacks.Common.Strings.CurrentDefaultVmName, Opt.Instance.h, Opt.Instance.Json);
                    AppUsageTimer.SessionEventHandler();
                    if (!Oem.IsOEMDmm)
                    {
                        PromotionManager.ReloadPromotionsAsync();
                        GrmManager.UpdateGrmAsync((IEnumerable <string>)null);
                        GuidanceCloudInfoManager.Instance.AppsGuidanceCloudInfoRefresh();
                    }
                    if (!FeatureManager.Instance.IsHtmlHome)
                    {
                        BlueStacksUIUtils.DictWindows[BlueStacks.Common.Strings.CurrentDefaultVmName].CreateFirebaseBrowserControl();
                    }
                    MemoryManager.TrimMemory(true);
                    app.Run();
                }
                else
                {
                    BlueStacksUpdater.HandleUpgrade(RegistryManager.Instance.DownloadedUpdateFile);
                }
            }
            else
            {
                CefHelper.InitCef(args, mBSTProcessIdentifier);
            }
            AppUsageTimer.DetachSessionEventHandler();
            CefRuntime.Shutdown();
            App.ExitApplication();
        }