private void SpawnRocket() { GameObject rocket = Instantiate(RocketPref, transform.position, new Quaternion(0, 0, 0, 0)) as GameObject; Thrust thrust = rocket.GetComponent <Thrust>(); RocketsLaunched++; thrust.rigidBody.gravityScale = gravityStart + gravityGrow * RocketsLaunched + Random.value * gravitySpread; switch (launchMode) { case LaunchMode.City: thrust.SetImpulse(RocketImpulse(thrust, TargetPoint.transform.position, DistanceSpread, MinHeight, MaxHeight)); break; case LaunchMode.UFO: thrust.SetImpulse(RocketImpulse(thrust, UFO.transform.position)); var sprite = rocket.GetComponent <SpriteRenderer>(); sprite.color = new Color(1, 0.4f, 0.4f); break; default: break; } launchMode = LaunchMode.None; }
public void HumanModeSelected() { currentLaunchMode = LaunchMode.HumanMode; MissleButton.image.sprite = MissleNonSelected; HumanButton.image.sprite = HumanSelected; }
public override int GetHashCode() { int hash = 1; if (AppId.Length != 0) { hash ^= AppId.GetHashCode(); } if (LaunchParamsJson.Length != 0) { hash ^= LaunchParamsJson.GetHashCode(); } if (LaunchMode != global::Plexus.Interop.Testing.Generated.AppLaunchMode.SingleInstance) { hash ^= LaunchMode.GetHashCode(); } if (suggestedAppInstanceId_ != null) { hash ^= SuggestedAppInstanceId.GetHashCode(); } if (referrer_ != null) { hash ^= Referrer.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (AppId.Length != 0) { hash ^= AppId.GetHashCode(); } if (LaunchParamsJson.Length != 0) { hash ^= LaunchParamsJson.GetHashCode(); } if (LaunchMode != 0) { hash ^= LaunchMode.GetHashCode(); } if (suggestedAppInstanceId_ != null) { hash ^= SuggestedAppInstanceId.GetHashCode(); } if (referrer_ != null) { hash ^= Referrer.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public SilentOnlyUtilities(LaunchMode launchMode, string[] args) { processArgs(args); if (useStable || useCanary || usePTB) { paths = Utilities.GetLocalPaths(useStable, useCanary, usePTB); processNames = Utilities.GetExecutables(useStable, useCanary, usePTB); roamings = Utilities.GetRoamingPaths(useStable, useCanary, usePTB); if (paths.Length > 0) { progressChunk = 100 / paths.Length; } switch (launchMode) { case LaunchMode.Install: Install(); break; case LaunchMode.Repair: Repair(); break; case LaunchMode.Uninstall: Uninstall(); break; } } else { Console.WriteLine("No branch specified, please use -stable, -canary or -ptb"); } }
void Update() { rocketSpawnClock += Time.deltaTime; if (rocketSpawnClock > rocketSpawnCD) { SpawnRocket(); rocketSpawnClock = 0; preEffectShown = false; } if (rocketSpawnCD - rocketSpawnClock < Warning.GetComponent <Warning>().duration&& launchMode == LaunchMode.None) { launchMode = Random.value < UFOTargetProbability ? LaunchMode.UFO : LaunchMode.City; if (launchMode == LaunchMode.UFO) { Warning.GetComponent <Warning>().Activate(); } } if (rocketSpawnCD - rocketSpawnClock < PreRocketSpawnPref.GetComponent <ParticleSystem>().duration&& !preEffectShown) { preEffectShown = true; Instantiate(PreRocketSpawnPref, transform.position, transform.rotation); } }
/// <summary> /// Starting connect to report portal. Create launcher and start it. /// </summary> /// <param name="args"></param> protected virtual void TestAssemblyExecutionStarting(MessageHandlerArgs <ITestAssemblyStarting> args) { lock (Logger.LockObject) { try { LaunchMode launchMode = _config.GetValue(ConfigurationPath.LaunchDebugMode, false) ? LaunchMode.Debug : LaunchMode.Default; var startLaunchRequest = new StartLaunchRequest { Name = _config.GetValue(ConfigurationPath.LaunchName, args.Message.TestAssembly.Assembly.Name), StartTime = DateTime.UtcNow, Mode = launchMode, Attributes = _config.GetKeyValues("Launch:Attributes", new List <KeyValuePair <string, string> >()).Select(a => new ItemAttribute { Key = a.Key, Value = a.Value }).ToList(), Description = _config.GetValue(ConfigurationPath.LaunchDescription, "") }; Shared.Extensibility.Embedded.Analytics.AnalyticsReportEventsObserver.DefineConsumer("agent-dotnet-xunit"); _launchReporter = new LaunchReporter(_service, _config, null, Shared.Extensibility.ExtensionManager.Instance); _launchReporter.Start(startLaunchRequest); } catch (Exception exp) { Logger.LogError(exp.ToString()); } } }
/// <summary> /// Starting connect to report portal. Create launcher and start it. /// </summary> /// <param name="args"></param> protected virtual void TestAssemblyExecutionStarting(MessageHandlerArgs <ITestAssemblyStarting> args) { lock (Logger.LockObject) { try { LaunchMode launchMode = _config.GetValue(ConfigurationPath.LaunchDebugMode, false) ? LaunchMode.Debug : LaunchMode.Default; StartLaunchRequest startLaunchRequest = new StartLaunchRequest { Name = _config.GetValue(ConfigurationPath.LaunchName, "xUnit Demo Launch"), StartTime = DateTime.UtcNow, Mode = launchMode, Tags = _config.GetValues(ConfigurationPath.LaunchTags, new List <string>()).ToList(), Description = _config.GetValue(ConfigurationPath.LaunchDescription, "") }; Bridge.Context.LaunchReporter = new LaunchReporter(Bridge.Service, _config, null); Bridge.Context.LaunchReporter.Start(startLaunchRequest); } catch (Exception exp) { Logger.LogError(exp.ToString()); } } }
public static void Init(ConfigData configData) { launchMode = configData.launchMode; deviceId = string.IsNullOrEmpty(configData.deviceId) ? SystemInfo.deviceUniqueIdentifier : configData.deviceId; ruppeesPerGame = configData.ruppeesPerGame; maxLeaderboardEntries = configData.maxLeaderboardEntries; bestScorePrize = configData.bestScorePrize; }
/// <summary> /// Watches the process and reports when the DX window is created /// </summary> public WindowWatcher(Account account, Process p, bool watchBounds, LaunchMode mode, string args) { this.process = p; this.Account = account; this.watchBounds = watchBounds; this.watchAutologin = account.Settings.AutomaticLogin && account.Settings.HasCredentials && !Settings.DisableAutomaticLogins; this.Mode = mode; this.Args = args; canReadMemory = Environment.Is64BitProcess || !Environment.Is64BitOperatingSystem; }
private static ResolveMode ConvertToResolveMode(LaunchMode launchMode) { switch (launchMode) { case LaunchMode.SingleInstance: return(ResolveMode.SingleInstance); case LaunchMode.MultiInstance: return(ResolveMode.MultiInstance); default: throw new ArgumentOutOfRangeException(nameof(launchMode), launchMode, null); } }
private int InternalStart(LaunchMode launchMode) { switch (launchMode) { case LaunchMode.CommandLine: return(ShellRunner.Start(_args)); case LaunchMode.Gui: Application selfTesterApplication = new SelfTesterApplication(); selfTesterApplication.MainWindow.Show(); Unmanaged.FreeConsole(); return(selfTesterApplication.Run()); default: throw new InvalidEnumArgumentException("launchMode", (int)launchMode, typeof(LaunchMode)); } }
public Config() { Javaw = GetJavaDir() ?? "javaw.exe"; Username = "******"; Javaxmx = (GetMemory() / 4).ToString(); Passwd = new byte[0]; Login = "******"; Autostart = false; ExtraJvmArg = " -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true"; WindowTransparency = 1; Report = true; DownloadSource = 0; Lang = "zh-cn"; CheckUpdate = true; PluginConfig = new Dictionary <string, object>(); Height = -1; Width = -1; FullScreen = false; LaunchMode = LaunchMode.Normal; }
public static int Main(string[] args) { try { _launchMode = args != null && args.Length != 0 ? LaunchMode.CommandLine : LaunchMode.Gui; RuntimeHelpers.PrepareConstrainedRegions(); using (var stLauncher = new Launcher(_launchMode, args)) { return(stLauncher.Start()); } } catch (Exception commonEx) { var exceptionExpert = new ErrorHandler(commonEx); var errorMessage = exceptionExpert.GetErrorMessage(); switch (_launchMode) { case LaunchMode.CommandLine: Console.WriteLine(@"{0}: {1}", errorMessage.Item1, errorMessage.Item2); break; case LaunchMode.Gui: MessageBox.Show(string.Format("{1}: {0}", errorMessage.Item2, errorMessage.Item1), "Error", MessageBoxButton.OK, MessageBoxImage.Error); break; default: goto case LaunchMode.CommandLine; } } return(-1); }
private static bool Launch(Account account, LaunchMode mode) { FileInfo fi; try { if (Settings.GW2Path.HasValue) fi = new FileInfo(Settings.GW2Path.Value); else fi = null; } catch { fi = null; } if (fi == null || !fi.Exists) { throw new InvalidGW2PathException(); } return Launch(account, mode, fi); }
private static ProcessStartInfo GetProcessStartInfo(Settings.IAccount account, LaunchMode mode, FileInfo fi) { ProcessStartInfo startInfo = new ProcessStartInfo(fi.FullName, GetArguments(account, Settings.GW2Arguments.Value, mode)); startInfo.UseShellExecute = false; if (!Util.Users.IsCurrentUser(account.WindowsAccount)) { startInfo.UserName = account.WindowsAccount; var password = Security.Credentials.GetPassword(account.WindowsAccount); if (password == null) throw new BadUsernameOrPasswordException(); startInfo.Password = password; startInfo.LoadUserProfile = true; startInfo.WorkingDirectory = fi.DirectoryName; } return startInfo; }
private static bool IsUpdate(LaunchMode mode) { switch (mode) { case LaunchMode.Update: case LaunchMode.UpdateVisible: return true; } return false; }
public static void Launch(Settings.IAccount account, LaunchMode mode) { Account _account; lock(accounts) { _account = GetAccount(account); if (_account.State != AccountState.None) return; if (_account.InUse) return; else _account.InUse = true; } _account.SetState(AccountState.Waiting, true); lock (queue) { queue.Enqueue(new QueuedLaunch(_account, mode)); if (taskQueue == null || taskQueue.IsCompleted) { cancelQueue = new CancellationTokenSource(); var cancel = cancelQueue.Token; taskQueue = Task.Factory.StartNew( delegate { DoQueue(cancel); }, cancel); } } }
private static string GetArguments(Settings.IAccount account, string arguments, LaunchMode mode) { StringBuilder args = new StringBuilder(256); args.Append(ARGS_UID); args.Append(account.UID); if (mode == LaunchMode.Update) { args.Append(" -nopatchui -image"); } else if (mode == LaunchMode.UpdateVisible) { args.Append(" -image"); } else { if (!string.IsNullOrEmpty(arguments)) { args.Append(' '); args.Append(arguments); } if (mode == LaunchMode.Launch) args.Append(" -shareArchive"); if (IsWindowed(account)) args.Append(" -windowed"); if (!string.IsNullOrEmpty(account.Arguments)) { args.Append(' '); args.Append(account.Arguments); } if (!string.IsNullOrEmpty(account.AutomaticLoginEmail) && !string.IsNullOrEmpty(account.AutomaticLoginPassword)) { args.Append(" -nopatchui -email \""); args.Append(account.AutomaticLoginEmail); args.Append("\" -password \""); args.Append(account.AutomaticLoginPassword); args.Append('"'); } } return args.ToString(); }
public LaunchSession(LaunchMode mode, string args = null) { this.Mode = mode; this.Args = args; }
public QueuedLaunch(Account account, LaunchMode mode) { this.account = account; this.mode = mode; }
// ==== Resume tab ==== void bResume_Click( object sender, EventArgs e ) { Log( "[Resume]" ); launchMode = LaunchMode.Resume; loginCompleted = true; if( updateCheckCompleted ) { OnSignInAndUpdateCheckCompleted(); } else { State = FormState.WaitingForUpdater; } }
static void Main(string[] args) { LaunchMode launchMode = LaunchMode.GUI; // check first argument to check if it is a silent install switch if (args.Length > 0) { switch (args[0].ToLower()) { // Silent Install switches case "-install": case "-i": launchMode = LaunchMode.Install; break; case "-repair": case "-r": launchMode = LaunchMode.Repair; break; case "-uninstall": case "-u": launchMode = LaunchMode.Uninstall; break; case "-help": case "-h": launchMode = LaunchMode.None; AttachConsole(ATTACH_PARENT_PROCESS); Console.WriteLine("-install, -i Install BBD\n" + "-uninstall, -u Uninstall BBD\n" + " Optional switches for uninstall\n" + " -deleteuserdata deletes all user settings of betterdiscord\n" + "-repair, -r Repair BBD\n" + " Optional switches for repair, for the following issues\n" + " -repairupdateloop Discord update loop\n" + " -repairnotlaunching BandagedBD not launching with Discord\n" + " -repairloadingindefinitely BandagedBD loading indefinitely\n" + " -repairjavascripterror Fatal JavaScript error on launch\n" + "\nall require using one or more of the following\n" + " -stable [path], -canary [path], -ptb [path]\n" + "\n-norestart By default discord will be restarted, this disables restarting of processes" + ""); break; default: break; } } switch (launchMode) { case LaunchMode.GUI: Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); break; case LaunchMode.None: break; default: AttachConsole(ATTACH_PARENT_PROCESS); new SilentOnlyUtilities(launchMode, args); break; } }
// ==== Direct tab ==== void tDirectUrl_TextChanged( object sender, EventArgs e ) { // check the URL field Match match = PlayLinkDirect.Match( tDirectUrl.Text ); if( match.Success ) { // Acceptable "mc://" url tDirectServerIP.Text = match.Groups[1].Value; tDirectUsername.Text = match.Groups[7].Value; tDirectUrl.BackColor = ValidFieldColor; launchMode = LaunchMode.Direct; lDirectStatus.Text = ""; bDirectConnect.Enabled = true; } else { // Unacceptable or missing URL tDirectServerIP.Text = "?"; tDirectUsername.Text = "?"; tDirectUrl.BackColor = InvalidFieldColor; bDirectConnect.Enabled = false; if( PlayLinkHash.IsMatch( tDirectUrl.Text ) || PlayLinkIPPort.IsMatch( tDirectUrl.Text ) ) { // minecraft.net play link lDirectStatus.Text = "You must sign in to connect to servers via minecraft.net links."; } else if( tDirectUrl.Text.Length == 0 ) { // no URL given lDirectStatus.Text = "Provide a direct-connect (mc://) URL."; } else { // unrecognized URL given lDirectStatus.Text = "Unrecognized URL."; } } }
void bDirectConnect_Click( object sender, EventArgs e ) { Log( "[DirectConnect]" ); launchMode = LaunchMode.Direct; loginCompleted = true; if( updateCheckCompleted ) { OnSignInAndUpdateCheckCompleted(); } else { State = FormState.WaitingForUpdater; } }
public LaunchOptions(LaunchMode mode, object specialOptions) { Mode = mode; SpecialOptions = specialOptions; }
private static bool Launch(Account account, LaunchMode mode, FileInfo fi) { string username = Util.Users.GetUserName(account.Settings.WindowsAccount); Account _active = GetActiveAccount(username); if (_active != null) { //the user's account is already in use, however, if the same dat file is being used, it doesn't matter if (_active.Settings.DatFile != account.Settings.DatFile) throw new UserAlreadyActiveException(username); } switch (mode) { case LaunchMode.Update: account.SetState(AccountState.Updating, true); break; case LaunchMode.UpdateVisible: account.SetState(AccountState.UpdatingVisible, true); break; default: account.SetState(AccountState.Launching, true); break; } byte retries = 0; do { try { DatManager.Activate(account.Settings); break; } catch (DatManager.UserAccountNotInitializedException e) { if (retries++ > 0) { throw e; } var password = Security.Credentials.GetPassword(username); if (password == null) throw new BadUsernameOrPasswordException(); try { Util.ProcessUtil.InitializeAccount(username, password); } catch { } } } while (true); if (mode == LaunchMode.Launch && !account.Settings.DatFile.IsInitialized) { throw new DatFileNotInitialized(); } KillMutex(); var startInfo = GetProcessStartInfo(account.Settings, mode, fi); var isWindowed = IsWindowed(account.Settings); retries = 0; do { Process gw2 = account.Process.Launch(startInfo); lastLaunch = new QueuedLaunch(account, mode); if (AccountProcessChanged != null) AccountProcessChanged(account.Settings, gw2); if (!gw2.WaitForExit(2000)) { if (mode == LaunchMode.Launch || mode == LaunchMode.LaunchSingle) account.SetState(AccountState.Active, true, gw2); if (!gw2.HasExited) { lock (unknownProcesses) { activeProcesses++; OnActiveProcessCountChanged(); } if (mode == LaunchMode.LaunchSingle) { account.Settings.DatFile.IsInitialized = true; } if (!IsUpdate(mode)) { if (isWindowed) { WindowWatcher watcher = new WindowWatcher(account, gw2); watcher.WindowChanged += OnWatchedWindowChanged; } if (AccountLaunched != null) AccountLaunched(account.Settings); EventHandler<Account> onExit = null; onExit = delegate(object o, Account a) { a.Exited -= onExit; if (AccountExited != null) AccountExited(a.Settings); }; lock (queueExit) { if (account.State == AccountState.Active) account.Exited += onExit; } } } return true; } else { double duration = gw2.ExitTime.Subtract(gw2.StartTime).TotalSeconds; bool isUpdate = IsUpdate(mode); if (isUpdate || duration < 1) //(IsUpdate(mode) && duration < 0.5 || !IsUpdate(mode) && duration < 1) { //GW2 was likely closed due to another copy running, or the client is being updated Thread.Sleep(500); Task t = taskScan; if (t != null) { try { t.Wait(); } catch { } } if (isUpdate) { return true; } else if (account.Process.Process != null) { //was handled by taskScan //assuming GW2 closed itself, restarted and that process was attached return true; } else { //don't try to restart the process if the queue has been killed if (cancelQueue != null && cancelQueue.IsCancellationRequested) break; //assuming GW2 failed to open due to another instance running //try to kill any other accounts prior to trying administrative access if (!KillMutex()) { retries++; try { //try killing the mutex using admin rights if (retries == 1) { Util.ProcessUtil.KillMutexWindow(fi.FullName); } else if (retries == 2) { Util.ProcessUtil.KillMutexWindowByProcessName(fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length)); } } catch { //failed or cancelled break; } } } } else { //AccountStateChanged handled by process exit return true; } } } while (retries < 3); account.SetState(AccountState.None, true); return false; }
public void MissileModeSelected() { currentLaunchMode = LaunchMode.MissileMode; HumanButton.image.sprite = HumanNonSelected; MissleButton.image.sprite = MissleSelected; }
void Awake() { mInstance = this; currentLaunchMode = LaunchMode.HumanMode; }
public static void Launch(LaunchMode launchMode = LaunchMode.MicroFramework) { try { Comfort.Init(); IntegratedHeatingAndAirConditioning.Init(); _resetCause = GHI.Processor.Watchdog.LastResetCause; blueLed = new OutputPort(FEZPandaIII.Gpio.Led1, false); greenLed = new OutputPort(FEZPandaIII.Gpio.Led2, false); orangeLed = new OutputPort(FEZPandaIII.Gpio.Led3, _resetCause == GHI.Processor.Watchdog.ResetCause.Watchdog); redLed = new OutputPort(FEZPandaIII.Gpio.Led4, false); #if (NETMF && RELEASE) || (OnBoardMonitorEmulator && !DebugOnRealDeviceOverFTDI) _useWatchdog = true; #endif if (_useWatchdog) { GHI.Processor.Watchdog.Enable(watchDogTimeoutInMilliseconds); } settings = Settings.Instance; FileLogger.Create(); InitManagers(); InstrumentClusterElectronics.DateTimeChanged += DateTimeChanged; Logger.Debug("Watchdog.ResetCause: " + (_resetCause == GHI.Processor.Watchdog.ResetCause.Normal ? "Normal" : "Watchdog")); if (_useWatchdog) { Logger.Debug("Watchdog enabled with timeout: " + watchDogTimeoutInMilliseconds); } //SettingsScreen.Instance.Status = version.Length > 11 ? version.Replace(" ", "") : version; //Localization.SetCurrent(RussianLocalization.SystemName); //Localization.SetCurrent(settings.Language); //Comfort.AutoLockDoors = settings.AutoLockDoors; //Comfort.AutoUnlockDoors = settings.AutoUnlockDoors; //Comfort.AutoCloseWindows = settings.AutoCloseWindows; //Comfort.AutoCloseSunroof = settings.AutoCloseSunroof; #region MassStorage //Controller.DeviceConnectFailed += (sss, eee) => //{ // Logger.Error("DeviceConnectFailed!"); // LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(redLed, 1, 100)); // ControllerState = UsbMountState.DeviceConnectFailed; // _removableMediaInsertedSync.Set(); //}; //Controller.UnknownDeviceConnected += (ss, ee) => //{ // Logger.Error("UnknownDeviceConnected!"); // LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(redLed, 2, 100)); // ControllerState = UsbMountState.UnknownDeviceConnected; // _removableMediaInsertedSync.Set(); //}; //Controller.MassStorageConnected += (sender, massStorage) => //{ // Logger.Debug("Controller MassStorageConnected!"); // LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(orangeLed, 2, 100)); // ControllerState = UsbMountState.MassStorageConnected; RemovableMedia.Insert += (s, e) => { LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(orangeLed, 3, 100)); string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory; settings = Settings.Init(rootDirectory + "\\imBMW.ini"); FileLogger.Init(rootDirectory + "\\logs", () => VolumeInfo.GetVolumes()[0].FlushAll()); Logger.Debug("Logger initialized."); MassStorageMountState = MassStorageMountState.Mounted; _removableMediaInsertedSync.Set(); }; RemovableMedia.Eject += (s, e) => { FileLogger.Eject(); Logger.Print("RemovableMedia Ejected!"); LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(greenLed, 3, 100)); MassStorageMountState = MassStorageMountState.Unmounted; }; //_massStorage = massStorage; _massStorage = new SDCard(SDCard.SDInterface.SPI); _massStorage.Mount(); //}; #if RELEASE //Controller.Start(); #else #if NETMF // WARNING! Be aware, without this line you can get 'Controller -> DeviceConnectFailed' each time when you start debugging... if (Debugger.IsAttached) #endif { //Controller.Start(); } #endif #endregion LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(orangeLed, 1, 200)); bool isSignalled = _removableMediaInsertedSync.WaitOne(Debugger.IsAttached ? 10000 : 10000, true); if (!isSignalled) // No Storage inserted { InstrumentClusterElectronics.ShowNormalTextWithGong(MassStorageMountState.ToStringValue()); FrontDisplay.RefreshLEDs(LedType.RedBlinking, append: true); LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(redLed, 3, 100)); } else { if (MassStorageMountState == MassStorageMountState.DeviceConnectFailed || MassStorageMountState == MassStorageMountState.UnknownDeviceConnected) { InstrumentClusterElectronics.ShowNormalTextWithGong(MassStorageMountState.ToStringValue()); FrontDisplay.RefreshLEDs(LedType.Red, append: true); LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(redLed, 4, 100)); ResetBoard(); } } Logger.Debug("MassStorage state: " + MassStorageMountState.ToStringValue()); InstrumentClusterElectronics.RequestDateTime(); Init(); Logger.Debug("Started!"); BordmonitorMenu.MenuButtonHold += () => { FrontDisplay.RefreshLEDs(LedType.Empty); if (Emulator.IsEnabled) { Emulator.PlayerIsPlayingChanged += (s, isPlayingChangedValue) => { if (!isPlayingChangedValue) { ResetBoard(); } }; Radio.PressOnOffToggle(); //Emulator.IsEnabled = false; } else { ResetBoard(); } }; BordmonitorMenu.PhoneButtonHold += () => { VolumioRestApiPlayer.Reboot(); Logger.Warning("Reboot request sent."); }; BordmonitorMenu.EjectButtonHold += () => { UnmountMassStorage(); _massStorage = null; Logger.Warning("UNMOUNTED!"); }; Manager.Instance.AddMessageReceiverForSourceDevice(DeviceAddress.InstrumentClusterElectronics, m => { if (m.Data[0] == 0x11 && m.Data.Length == 2) // Ignition status { GHI.Processor.Watchdog.ResetCounter(); } }); requestIgnitionStateTimer = new Timer(RequestIgnitionStateTimerHandler, null, 0, requestIgnitionStateTimerPeriod); imBMWTest(); Logger.Debug("Actions inited!"); if (launchMode == LaunchMode.MicroFramework) { Thread.Sleep(Timeout.Infinite); } } catch (Exception ex) { LedBlinking(new LedBlinkingItem(redLed, 5, 200)); Thread.Sleep(200); redLed.Write(true); Logger.Error(ex, "while modules initialization"); ResetBoard(); } }
// ==== Sign-In tab ==== void SignInFieldChanged( object sender, EventArgs e ) { lSignInStatus.Text = ""; bool canSignIn = false; // check the username field if( UsernameRegex.IsMatch( cSignInUsername.Text ) || EmailRegex.IsMatch( cSignInUsername.Text ) ) { cSignInUsername.BackColor = ValidFieldColor; canSignIn = true; } else { cSignInUsername.BackColor = InvalidFieldColor; lSignInStatus.Text = "Invalid username/email."; } // check the password field if( tSignInPassword.Text.Length == 0 ) { canSignIn = false; tSignInPassword.BackColor = InvalidFieldColor; if( sender == tSignInPassword || lSignInStatus.Text.Length == 0 ) { lSignInStatus.Text = "Password is required."; } } else { tSignInPassword.BackColor = ValidFieldColor; } // check the URL field Match match = PlayLinkDirect.Match( tSignInUrl.Text ); if( match.Success ) { // "mc://" url if( match.Groups[7].Value.Equals( cSignInUsername.Text, StringComparison.OrdinalIgnoreCase ) ) { tSignInUrl.BackColor = ValidFieldColor; launchMode = LaunchMode.SignInWithUri; } else { canSignIn = false; tSignInUrl.BackColor = InvalidFieldColor; if( sender == tSignInUrl || lSignInStatus.Text.Length == 0 ) { lSignInStatus.Text = "Given sign-in username does not match username in direct-connect URL."; } } } else if( PlayLinkHash.IsMatch( tSignInUrl.Text ) || PlayLinkIPPort.IsMatch( tSignInUrl.Text ) ) { // minecraft.net play link launchMode = LaunchMode.SignInWithUri; tSignInUrl.BackColor = ValidFieldColor; } else if( tSignInUrl.Text.Length == 0 ) { // no URL given launchMode = LaunchMode.SignIn; tSignInUrl.BackColor = ValidFieldColor; } else { // unrecognized URL given tSignInUrl.BackColor = InvalidFieldColor; if( sender == tSignInUrl || lSignInStatus.Text.Length == 0 ) { lSignInStatus.Text = "Unrecognized URL"; } canSignIn = false; } bSignIn.Enabled = canSignIn; // let user know whether username/password will be remembered if( canSignIn && lSignInStatus.Text == "" ) { if( xRememberUsername.Checked ) { lSignInStatus.ForeColor = StatusNotifyColor; if( xRememberPassword.Checked ) { lSignInStatus.Text = "Username and password will be remembered."; } else { lSignInStatus.Text = "Username will be remembered."; } } else { lSignInStatus.ForeColor = StatusWarningColor; } } else { lSignInStatus.ForeColor = StatusWarningColor; } }
internal Launcher(LaunchMode launchMode, string[] args) { _launchMode = launchMode; _args = args; Init(); }