protected bool Init() { Logger.Info("In VboxUtilsBase init"); try { if (this.VirtualBox != null) { return(true); } VboxUtilsBase.VirtualBoxClient = (IVirtualBoxClient) new VirtualBoxClientClass(); this.VirtualBox = (IVirtualBox)VboxUtilsBase.VirtualBoxClient.VirtualBox; } catch (Exception ex1) { Logger.Warning("Virtual box init failed, error : {0}", (object)ex1.ToString()); try { ComRegistration.Register(); Logger.Info("Retrying to init VBox"); if (this.VirtualBox != null) { return(true); } VboxUtilsBase.VirtualBoxClient = (IVirtualBoxClient) new VirtualBoxClientClass(); this.VirtualBox = (IVirtualBox)VboxUtilsBase.VirtualBoxClient.VirtualBox; } catch (Exception ex2) { Logger.Error("Virtual box init failed, error : {0}", (object)ex2.ToString()); return(false); } } return(true); }
private void EnterStateStarting() { Logger.Info("{0}", (object)MethodBase.GetCurrentMethod().Name); this.SerialQueueCheck(); this.mState = StateMachine.State.Starting; try { VBoxBridgeService.Instance.Connect(); } catch (Exception ex1) { Logger.Info("Cannot connect VBoxBridge"); Logger.Info(ex1.ToString()); try { ComRegistration.Register(); Logger.Info("Reconnecting to VBoxBridge"); VBoxBridgeService.Instance.Connect(); } catch (Exception ex2) { Logger.Info("Got exception {0} while re-registering COM", (object)ex2.ToString()); AndroidBootUp.HandleBootError(); } } if (VBoxBridgeService.Instance.StartMachineAsync(this.mVmName, (VBoxBridgeService.BooleanCallback)(success => this.mWorkQueue.DispatchAsync((SerialWorkQueue.Work)(() => this.StartMachineCompletion(success)))), (VBoxBridgeService.BooleanCallback)(success => this.mWorkQueue.DispatchAsync((SerialWorkQueue.Work)(() => this.StopMachineCompletion(success)))))) { return; } Logger.Info("Cannot begin starting guest"); this.EnterStateError(); AndroidBootUp.HandleBootError(); }
public static int Main(string[] args) { Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); Logger.InitUserLog(); BlueStacks.QuitMultiInstall.QuitMultiInstall.InitExceptionHandlers(); ServiceController runningSvc = (ServiceController)null; if (ProcessUtils.CheckAlreadyRunningAndTakeLock("Global\\BlueStacks_HDQuitMultiInstall_Lockbgp", out BlueStacks.QuitMultiInstall.QuitMultiInstall.s_HDQuitMultiInstaceLock)) { Logger.Info("QuitMultiInstall already running, returning"); return(0); } if (args.Length != 0 && args[0] == "-in") { Logger.Info("quit multi install started with arg : -in...checking for another running version of parent proccess"); string[] strArray = new string[9] { "HD-Agent", "HD-ApkHandler", "HD-Adb", "HD-RunApp", "HD-Updater", "HD-Player", "BlueStacks", "BstkSVC", "HD-XapkHandler" }; bool flag = false; foreach (string procName in strArray) { if (Utils.IsRunningInstanceClashWithAnotherInstance(procName)) { flag = true; break; } } if (Utils.IsRunningInstanceClashWithService(BlueStacks.QuitMultiInstall.QuitMultiInstall.BlueStacksServicePlusPrefixes, out runningSvc)) { flag = true; } if (!flag) { return(0); } string str1 = LocaleStrings.GetLocalizedString("STRING_ANOTHER_BLUESTACKS_INSTANCE_RUNNING_PROMPT_TEXT1", ""); string str2 = LocaleStrings.GetLocalizedString("STRING_ANOTHER_BLUESTACKS_INSTANCE_RUNNING_PROMPT_TEXT2", ""); if ("bgp".Equals("dmm") && RegistryManager.Instance.UserSelectedLocale.Equals("ja-JP", StringComparison.InvariantCultureIgnoreCase)) { str1 = "同時に起動できないプログラムが既に動いています。"; str2 = "既に動いているプログラムを閉じて続行しますか?"; } if (MessageBox.Show(str1 + Environment.NewLine + str2, string.Format("{0} Warning", (object)Strings.ProductDisplayName), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.Cancel) { return(-1); } } BlueStacks.QuitMultiInstall.QuitMultiInstall.QuitPreviousInstance(); if (runningSvc != null) { BlueStacks.QuitMultiInstall.QuitMultiInstall.StopService(runningSvc); } ComRegistration.Register(); return(0); }