public static void Start(CommandManager commandManager, bool publishServer) { AutoTestService.commandManager = commandManager; string sref = Environment.GetEnvironmentVariable("MONO_AUTOTEST_CLIENT"); if (!string.IsNullOrEmpty(sref)) { Console.WriteLine("AutoTest service starting"); MonoDevelop.Core.Execution.RemotingService.RegisterRemotingChannel(); byte[] data = Convert.FromBase64String(sref); MemoryStream ms = new MemoryStream(data); BinaryFormatter bf = new BinaryFormatter(); IAutoTestClient client = (IAutoTestClient)bf.Deserialize(ms); client.Connect(manager.AttachClient(client)); } if (publishServer && !manager.IsClientConnected) { MonoDevelop.Core.Execution.RemotingService.RegisterRemotingChannel(); BinaryFormatter bf = new BinaryFormatter(); ObjRef oref = RemotingServices.Marshal(manager); MemoryStream ms = new MemoryStream(); bf.Serialize(ms, oref); sref = Convert.ToBase64String(ms.ToArray()); File.WriteAllText(SessionReferenceFile, sref); } }
public void NotifyEvent(string eventName) { try { client.NotifyEvent(eventName); } catch (Exception ex) { Console.WriteLine("Dropping autotest client: " + ex.Message); client = null; } }
public void DetachClient(IAutoTestClient client) { if (client == this.client) { this.client = null; } else { throw new InvalidOperationException("Not connected"); } }
public AutoTestSession AttachClient(IAutoTestClient client) { if (this.client != null) { // Make sure the current client is alive NotifyEvent("Ping"); if (this.client != null) { throw new InvalidOperationException("A client is already connected"); } } this.client = client; if (currentSession == null) { currentSession = new AutoTestSession(); } return(currentSession); }
public void DetachClient (IAutoTestClient client) { if (client == this.client) this.client = null; else throw new InvalidOperationException ("Not connected"); }
public AutoTestSession AttachClient (IAutoTestClient client) { if (this.client != null) { // Make sure the current client is alive NotifyEvent ("Ping"); if (this.client != null) throw new InvalidOperationException ("A client is already connected"); } this.client = client; if (currentSession == null) currentSession = new AutoTestSession (); return currentSession; }
public void NotifyEvent (string eventName) { try { client.NotifyEvent (eventName); } catch (Exception ex) { Console.WriteLine ("Dropping autotest client: " + ex.Message); client = null; } }