private static void Main(string[] args)
        {
            Mutex lck  = (Mutex)null;
            bool  flag = false;

            Strings.CurrentDefaultVmName = "Android";
            int num1 = ProcessUtils.CheckAlreadyRunningAndTakeLock(Strings.GetPlayerLockName(Strings.CurrentDefaultVmName, "bgp"), out lck) ? 1 : 0;

            lck?.Close();
            if (num1 == 0 && BlueStacks.GuestCommandRunner.GuestCommandRunner.LaunchBlueStacks())
            {
                flag = true;
                Console.WriteLine("Successfully Launched AppPlayer");
            }
            lck?.Close();
            if (!BlueStacks.GuestCommandRunner.GuestCommandRunner.CheckIfGuestStarted())
            {
                Environment.Exit(-1);
            }
            AdbCommandRunner adbCommandRunner = new AdbCommandRunner(Strings.CurrentDefaultVmName);

            for (int index = 0; index < VMCommand.COMMAND.Length; ++index)
            {
                if (!string.IsNullOrEmpty(VMCommand.COMMAND[index]) && string.Compare(VmCmdHandler.RunCommand(VMCommand.COMMAND[index], Strings.CurrentDefaultVmName, "bgp"), "ok", true) != 0)
                {
                    if (Oem.Instance.IsHideMessageBoxIconInTaskBar)
                    {
                        int num2 = (int)MessageBox.Show((IWin32Window) new Form(), "Error, Something went wrong!");
                    }
                    else
                    {
                        int num3 = (int)MessageBox.Show("Error, Something went wrong!");
                    }
                    adbCommandRunner.Dispose();
                    Environment.Exit(-1);
                }
            }
            adbCommandRunner.Dispose();
            Thread.Sleep(2000);
            BlueStacks.GuestCommandRunner.GuestCommandRunner.StopZygote();
            BlueStacks.GuestCommandRunner.GuestCommandRunner.StartZygote();
            if (!flag)
            {
                return;
            }
            BlueStacks.GuestCommandRunner.GuestCommandRunner.ExitBlueStacks();
        }
        private bool FreeDiskSpace(string vm)
        {
            Logger.Info("In FreeDiskSpace");
            AdbCommandRunner runner = new AdbCommandRunner(vm);

            try
            {
                if (!runner.Connect(vm))
                {
                    Logger.Warning("Cannot connect to guest");
                    return(false);
                }
                if (!runner.RunShellPrivileged("stop"))
                {
                    return(false);
                }
                runner.RunShellPrivileged("swapoff /data/swap_space");
                Thread.Sleep(2000);
                if (!runner.RunShellPrivileged("mount -o remount,ro /data"))
                {
                    return(false);
                }
                this.ParentWindow.UpdateProgress(30.0);
                this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                {
                    this.progressTimer = new System.Windows.Forms.Timer();
                    this.progressTimer.Tick += new EventHandler(this.ProgressTimer_Tick);
                    this.progressTimer.Interval = 6000;
                    this.progressTimer.Start();
                }));
                if (!this.RunZeroFreeAndroid(runner))
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Error in freeing disk space err:" + ex.ToString());
                return(false);
            }
            finally
            {
                runner.Dispose();
            }
            return(true);
        }
Esempio n. 3
0
        private static void ResetProxy()
        {
            Console.WriteLine("Resetting proxy configuration.");
            BlueStacks.ConfigHttpProxy.ConfigHttpProxy.CheckIfGuestReady();
            AdbCommandRunner runner = new AdbCommandRunner("Android");

            BlueStacks.ConfigHttpProxy.ConfigHttpProxy.ConnectToAdb(runner);
            BlueStacks.ConfigHttpProxy.ConfigHttpProxy.CopyXMLToSDCard(runner);
            runner.Pull(BlueStacks.ConfigHttpProxy.ConfigHttpProxy.SDCARD_FILE_PATH, BlueStacks.ConfigHttpProxy.ConfigHttpProxy.TEMP_XML_FILE_PATH);
            XMLManipulation.DeleteFromXMLFile("global_http_proxy_host");
            XMLManipulation.DeleteFromXMLFile("global_http_proxy_port");
            XMLManipulation.DeleteFromXMLFile("global_http_proxy_exclusion_list");
            runner.Push(BlueStacks.ConfigHttpProxy.ConfigHttpProxy.TEMP_XML_FILE_PATH, BlueStacks.ConfigHttpProxy.ConfigHttpProxy.SDCARD_FILE_PATH);
            BlueStacks.ConfigHttpProxy.ConfigHttpProxy.MoveXMLToOrigLocationAndFixPermissions(runner);
            Console.WriteLine("Please wait while BlueStacks restarts.");
            runner.Dispose();
            BlueStacks.ConfigHttpProxy.ConfigHttpProxy.RestartBlueStacks();
            Console.WriteLine("HTTP proxy server was successfully removed.");
            Environment.Exit(0);
        }
Esempio n. 4
0
        private static void SetProxy(string host, string port)
        {
            Console.WriteLine("Setting proxy configuration: host = {0}, port = {1}", (object)host, (object)port);
            BlueStacks.ConfigHttpProxy.ConfigHttpProxy.CheckIfGuestReady();
            AdbCommandRunner runner = new AdbCommandRunner("Android");

            BlueStacks.ConfigHttpProxy.ConfigHttpProxy.ConnectToAdb(runner);
            BlueStacks.ConfigHttpProxy.ConfigHttpProxy.CopyXMLToSDCard(runner);
            runner.Pull(BlueStacks.ConfigHttpProxy.ConfigHttpProxy.SDCARD_FILE_PATH, BlueStacks.ConfigHttpProxy.ConfigHttpProxy.TEMP_XML_FILE_PATH);
            XMLManipulation.AppendToXMLFile("global_http_proxy_host", "91", host);
            XMLManipulation.AppendToXMLFile("global_http_proxy_port", "92", port);
            XMLManipulation.AppendToXMLFile("global_http_proxy_exclusion_list", "93", "127.0.0.1,10.0.2.2,10.0.2.15");
            runner.Push(BlueStacks.ConfigHttpProxy.ConfigHttpProxy.TEMP_XML_FILE_PATH, BlueStacks.ConfigHttpProxy.ConfigHttpProxy.SDCARD_FILE_PATH);
            BlueStacks.ConfigHttpProxy.ConfigHttpProxy.MoveXMLToOrigLocationAndFixPermissions(runner);
            Console.WriteLine("Process completed, please wait while BlueStacks restarts.");
            runner.Dispose();
            BlueStacks.ConfigHttpProxy.ConfigHttpProxy.RestartBlueStacks();
            Console.WriteLine("New HTTP proxy server was successfully configured.");
            Environment.Exit(0);
        }