Ejemplo n.º 1
0
        private static void FixRegistries(string userDefinedDir, string installDir)
        {
            string path1  = Path.Combine(userDefinedDir, "Engine");
            string index  = "Android";
            int    CSIDL1 = 46;
            int    CSIDL2 = 54;

            RegistryManager.Instance.SetAccessPermissions();
            RegistryManager.Instance.UserDefinedDir   = userDefinedDir.Trim('\\');
            RegistryManager.Instance.DataDir          = path1.Trim('\\') + "\\";
            RegistryManager.Instance.LogDir           = Path.Combine(userDefinedDir, "Logs").Trim('\\') + "\\";
            RegistryManager.Instance.InstallDir       = installDir.Trim('\\') + "\\";
            RegistryManager.Instance.EngineDataDir    = Path.Combine(userDefinedDir, "Engine");
            RegistryManager.Instance.ClientInstallDir = Path.Combine(userDefinedDir, "Client");
            RegistryManager.Instance.CefDataPath      = Path.Combine(userDefinedDir, "CefData");
            RegistryManager.Instance.SetupFolder      = Path.Combine(Directory.GetParent(userDefinedDir).ToString(), "BlueStacksSetup");
            RegistryManager.Instance.PartnerExePath   = Path.Combine(RegistryManager.Instance.InstallDir, "BlueStacks.exe");
            RegistryManager.Instance.UserGuid         = Guid.NewGuid().ToString();
            Utils.UpdateValueInBootParams("GUID", RegistryManager.Instance.UserGuid, index, true, "bgp");
            string str1 = Path.Combine(path1, index) + "\\";

            RegistryManager.Instance.Guest[index].BlockDevice0Name = "sda1";
            RegistryManager.Instance.Guest[index].BlockDevice0Path = str1 + "Root.vdi";
            RegistryManager.Instance.Guest[index].BlockDevice1Name = "sdb1";
            RegistryManager.Instance.Guest[index].BlockDevice1Path = str1 + "Data.vdi";
            RegistryManager.Instance.Guest[index].BlockDevice2Name = "sdc1";
            RegistryManager.Instance.Guest[index].BlockDevice2Path = str1 + "SDCard.vdi";
            string str2 = Path.Combine(path1, "UserData\\SharedFolder\\");

            RegistryManager.Instance.Guest[index].SharedFolder0Name     = "BstSharedFolder";
            RegistryManager.Instance.Guest[index].SharedFolder0Path     = str2;
            RegistryManager.Instance.Guest[index].SharedFolder0Writable = 1;
            string folderPath1 = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);

            RegistryManager.Instance.Guest[index].SharedFolder1Name     = "Pictures";
            RegistryManager.Instance.Guest[index].SharedFolder1Path     = folderPath1;
            RegistryManager.Instance.Guest[index].SharedFolder1Writable = 1;
            string folderPath2 = CommonInstallUtils.GetFolderPath(CSIDL2);

            RegistryManager.Instance.Guest[index].SharedFolder2Name     = "PublicPictures";
            RegistryManager.Instance.Guest[index].SharedFolder2Path     = folderPath2;
            RegistryManager.Instance.Guest[index].SharedFolder2Writable = 1;
            string folderPath3 = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            RegistryManager.Instance.Guest[index].SharedFolder3Name     = "Documents";
            RegistryManager.Instance.Guest[index].SharedFolder3Path     = folderPath3;
            RegistryManager.Instance.Guest[index].SharedFolder3Writable = 1;
            string folderPath4 = CommonInstallUtils.GetFolderPath(CSIDL1);

            RegistryManager.Instance.Guest[index].SharedFolder4Name     = "PublicDocuments";
            RegistryManager.Instance.Guest[index].SharedFolder4Path     = folderPath4;
            RegistryManager.Instance.Guest[index].SharedFolder4Writable = 1;
            string str3 = Path.Combine(path1, "UserData\\InputMapper");

            RegistryManager.Instance.Guest[index].SharedFolder5Name     = "InputMapper";
            RegistryManager.Instance.Guest[index].SharedFolder5Path     = str3;
            RegistryManager.Instance.Guest[index].SharedFolder5Writable = 1;
        }
Ejemplo n.º 2
0
 private void SetUninstallerProperties(string[] args)
 {
     UninstallerProperties.IsRunningInSilentMode = this.IsRunInHiddenMode(args);
     UninstallerProperties.GUID          = RegistryManager.Instance.UserGuid;
     UninstallerProperties.CampaignName  = RegistryManager.Instance.CampaignName;
     UninstallerProperties.CampaignMD5   = RegistryManager.Instance.CampaignMD5;
     UninstallerProperties.CloudHost     = App.GetCloudHost;
     UninstallerProperties.CurrentLocale = CommonInstallUtils.GetCurrentLocale();
     UninstallerProperties.UninstallId   = RegistryManager.Instance.InstallID;
     this.GetVmDesktopShortcutIconList();
 }
Ejemplo n.º 3
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());
     }
 }
 private void QuitAndKillBlueStacks()
 {
     CommonInstallUtils.KillBlueStacksProcesses((string)null, true);
     ServiceManager.StopService(Strings.BlueStacksDriverName, true);
 }
        private void UninstallerBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            this.StartProgressAnimationTimers();
            this.mUninstallerBackgroundWorker.ReportProgress(10, (object)LocaleStrings.GetLocalizedString("STRING_ENGINE_UNINSTALL", ""));
            this.QuitAndKillBlueStacks();
            if (string.Equals("bgp", "bgp", StringComparison.InvariantCultureIgnoreCase))
            {
                this.RemoveHelper();
            }
            string tempPath   = Path.GetTempPath();
            string installDir = RegistryStrings.InstallDir;

            try
            {
                CommonInstallUtils.DeleteDirectory(RegistryStrings.InstallDir);
            }
            catch (Exception ex)
            {
                Logger.Warning("An error occured while deleting installDir");
                Logger.Warning(ex.ToString());
                UninstallerStats.UninstallerComment |= 1;
                MainWindow.sWasUninstallationClean   = false;
            }
            try
            {
                CommonInstallUtils.DeleteDirectory(RegistryManager.Instance.UserDefinedDir);
            }
            catch (Exception ex)
            {
                Logger.Warning("An error occured while deleting datadir");
                Logger.Warning(ex.ToString());
                UninstallerStats.UninstallerComment |= 2;
                MainWindow.sWasUninstallationClean   = false;
            }
            try
            {
                CommonInstallUtils.DeleteDirectory(RegistryManager.Instance.SetupFolder);
            }
            catch
            {
            }
            this.DeleteShortcuts();
            this.DeleteRegistryHelper(RegistryManager.Instance.BaseKeyPath);
            this.DeleteRegistryHelper(Path.Combine("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", "BlueStacks" + Strings.OEMTag));
            try
            {
                if (!ServiceManager.UninstallService(Strings.BlueStacksDriverName, true))
                {
                    UninstallerStats.UninstallerComment |= 8;
                    MainWindow.sWasUninstallationClean   = false;
                }
            }
            catch (Exception ex)
            {
                Logger.Warning("An error occured while uninstalling services");
                Logger.Warning(ex.ToString());
                UninstallerStats.UninstallerComment |= 8;
                MainWindow.sWasUninstallationClean   = false;
            }
            this.mUninstallerBackgroundWorker.ReportProgress(80, (object)LocaleStrings.GetLocalizedString("STRING_CLIENT_UNINSTALL", ""));
            string path = Path.Combine(tempPath, "game_config.json");

            try
            {
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Couldnt delete " + path + ". Ex: " + ex.Message);
            }
            if (Oem.Instance.IsCreateInstallApkRegistry)
            {
                CommonInstallUtils.DeleteInstallApkScheme(installDir, "BlueStacks.Apk");
                CommonInstallUtils.DeleteInstallApkScheme(installDir, "BlueStacks.Xapk");
            }
            UninstallerStats.SendUninstallCompletedStats(this.mUserCommentString, this.mUninstallReasonString);
            Thread.Sleep(1000);
            this.mUninstallerBackgroundWorker.ReportProgress(100, (object)LocaleStrings.GetLocalizedString("STRING_UNINSTALL_FINISHED", ""));
        }