public Engine(string watchToken, string continuousTestsPath) { _watchToken = watchToken; _continuousTestsPath = continuousTestsPath; _handle = null; initialize(); }
private void ConnectToExistingVm() { VMHandle handle = null; while (handle == null) { handle = new VMConnectHandle().GetCurrent(); } client = new NetClient(new DebugClientFeedbackProvider()); client.MessageReceived += ClientMessageReceived; client.Connect(handle.IP, handle.Port); }
private bool canConnect(VMHandle handle) { try { var client = new NetClient(null); client.Connect(handle.IP, handle.Port); var isConnected = client.IsConnected; if (isConnected) { client.Disconnect(); } return(isConnected); } catch { } return(false); }
/// <summary> /// Get engines from token. Token can be solution file or watch folder /// </summary> /// <param name="token">The engine watch token to look for. The token is either the solution file or the watch folder</param> /// <param name="caseInsensitive">Wether to match the token ignoring case</param> /// <returns>Engine</returns> public IEngine GetEngine(string token, bool caseInsensitive) { VMHandle activeHandle = null; var connect = new VMConnectHandle(); var handles = connect.GetFromToken(token, caseInsensitive); var toDelete = new List <string>(); foreach (var handle in handles) { if (canConnect(handle)) { activeHandle = handle; break; } toDelete.Add(handle.File); } toDelete.ForEach(x => { try { File.Delete(x); } catch { } }); if (activeHandle == null) { return(null); } return(new Engine(activeHandle)); }
public Engine(VMHandle handle) { _handle = handle; _watchToken = null; initialize(); }