static void Main(string[] args) { Trace.Listeners.Add(new ConsoleTraceListener()); var sessionName = "LUVAL-RECORDING"; Console.WriteLine("Enter the message to send to file session {0}", sessionName); var message = Console.ReadLine(); var fileShareSend = new ProcessShare(sessionName); var result = fileShareSend.WriteMessage(message); if (!result) { Console.WriteLine("Failed to send message {0} on session file {1}", message, sessionName); return; } Console.WriteLine("Message succesful"); Console.WriteLine("Waiting for completed signal"); var fileShareRec = new ProcessShare(sessionName + "_BACK"); fileShareRec.WaitForText(ValidateMessage, TimeSpan.FromMinutes(2), 1000); Console.WriteLine("Process completed"); }
private static void WaitForComplete() { var messageShare = new ProcessShare(Utils.GetSessionName() + "_BACK"); Trace.TraceInformation("Waiting on session {0} for message", messageShare.SessionName); messageShare.WaitForText("complete", TimeSpan.FromMinutes(10)); }
private void WaitForCompleteSignal(CodeActivityContext context) { var session = Utils.GetSessionName() + "_BACK"; var fileShareRec = new ProcessShare(session); Trace.TraceInformation("Waiting for complete signal on session {0}", session); var st = DateTime.UtcNow; fileShareRec.WaitForText("complete", TimeSpan.FromMinutes(TimeoutInMinutes.Get(context))); Trace.TraceInformation("Finished wait on session {0} after {1}", session, DateTime.UtcNow.Subtract(st)); }
/// <summary> /// Waits for a named piped signal to finish the recording /// </summary> private static void WaitForFileSignal() { var fileShare = new ProcessShare(_info.SessionName, TimeSpan.FromMinutes(1)); try { fileShare.WaitForText("stop", TimeSpan.FromMinutes(_info.MaxRecordingMinutes)); } catch (TimeoutException ex) { Trace.TraceError("Unable to capture stop signal after waiting {0} mins. Exception: {1}", _info.MaxRecordingMinutes, ex); } }
/// <summary> /// Executes an action on the application /// </summary> /// <param name="args"></param> static void DoAction(ConsoleSwitches args) { Console.WriteLine("Type STOP to end recording on session {0}", args.SessionName); var message = Console.ReadLine(); var fileShareSend = new ProcessShare(args.SessionName); var result = fileShareSend.WriteMessage(message); if (!result) { Console.WriteLine("Failed to send message {0} on recording session {1}", message, args.SessionName); return; } Console.WriteLine("Message succesful"); Console.WriteLine("Waiting for completed signal"); var fileShareRec = new ProcessShare(args.SessionName + "_BACK"); fileShareRec.WaitForText(ValidateMessage, TimeSpan.FromMinutes(2), 1000); Console.WriteLine("Process completed"); }