public void StartApplication(string file, string args) { AutoTestService.SetupRemoting(); if (file.ToLower().EndsWith(".exe") && Path.DirectorySeparatorChar != '\\') { args = "\"" + file + "\" " + args; file = "mono"; } BinaryFormatter bf = new BinaryFormatter(); ObjRef oref = RemotingServices.Marshal(this); MemoryStream ms = new MemoryStream(); bf.Serialize(ms, oref); string sref = Convert.ToBase64String(ms.ToArray()); ProcessStartInfo pi = new ProcessStartInfo(file, args); pi.UseShellExecute = false; pi.EnvironmentVariables ["MONO_AUTOTEST_CLIENT"] = sref; process = Process.Start(pi); if (!waitEvent.WaitOne(15000)) { try { process.Kill(); } catch { } throw new Exception("Could not connect to application"); } }
public void Flash(AppResult result) { try { ExecuteOnIdle(() => result.Flash(() => AutoTestService.NotifyEvent("FlashCompleted"))); } catch (TimeoutException e) { ThrowOperationTimeoutException("Flash", result.SourceQuery, result, e); } }
public void AttachApplication() { AutoTestService.SetupRemoting(); string sref = File.ReadAllText(AutoTestService.SessionReferenceFile); byte[] data = Convert.FromBase64String(sref); MemoryStream ms = new MemoryStream(data); BinaryFormatter bf = new BinaryFormatter(); service = (IAutoTestService)bf.Deserialize(ms); session = service.AttachClient(this); }