public override void RunCommand() { EmulatorStatus status = EmulatorInstance.CommonInstance.Status; Console.WriteLine("IsRunning: {0}", status.IsRunning); Console.WriteLine("BlobEndpoint: {0}", status.BlobEndpoint); Console.WriteLine("QueueEndpoint: {0}", status.QueueEndpoint); Console.WriteLine("TableEndpoint: {0}", status.TableEndpoint); }
/* API */ private void OnBootRequest(WebRequest req) { //If we're already booted, ignore this. Else, start a new session. if (status != EmulatorStatus.Waiting) { return; } //We're creating a new session. Get the platform. if (!req.data.ContainsKey("platform")) { //No platform sent. OnFatalError("Error Launching Emulator: No Platform", "The required key 'platform' wasn't sent."); return; } string platform = (string)req.data["platform"]; if (!Program.config.flash_bins.ContainsKey(platform)) { //Platform invalid. OnFatalError("Error Launching Emulator: Bad Platform", "The platform '" + platform + "' wasn't a valid platform on this system."); return; } //Check to see if there is an open ID. sessionId = -1; for (int i = 1; i < Program.open_ids.Length; i++) { if (Program.open_ids[i] == false) { //Found an open session. Program.open_ids[i] = true; sessionId = i; break; } } if (sessionId == -1) { //No sessions! OnFatalError("Error Launching Emulator: Server Overloaded", "The server is at maximum capacity! Wait a few minutes and try again."); return; } //We're good to go. Let the client know that we're starting. ChangeState(EmulatorStatus.Booting); session = null; try { session = QemuSession.SpawnSession(sessionId, platform); } catch (Exception ex) { OnFatalError("Error Launching Emulator: Unexpected Error", ex); } //The emulator has started. Let the client know and provide some extra data. status = EmulatorStatus.Idle; OnEmulatorBoot b = new OnEmulatorBoot(); b.vnc_addr = Program.config.local_name + ":" + session.websockify_port.ToString(); SendData(b, WebReplyType.OnEmulatorBoot); }
/* Inner commands */ private void ChangeState(EmulatorStatus s) { //Notify client of this change. OnStageChange e = new OnStageChange { old_status = status, new_status = s }; SendData(e, WebReplyType.OnStatusChange); status = s; }
private void OnFatalError(string description, string more) { //Uh oh. Shut down everything. try { session.EndSession(); } catch { } status = EmulatorStatus.Crashed; //Tell the clients something went wrong. OnFatalError e = new OnFatalError { error_text = description, error_text_more = more }; SendData(e, WebReplyType.OnFatalError); }
private void EmulationStatusChanged(EmulatorStatus status) { _loadButton.Enabled = _saveButton.Enabled = status != EmulatorStatus.Stopped; }
private void ThreadSafeEmulationStatusChanged(EmulatorStatus status) { BeginInvoke(new Action <EmulatorStatus>(EmulationStatusChanged), status); }