Esempio n. 1
0
        public void StartCapture()
        {
            streamEnds = new CountdownEvent(2);

            process = new Process();
            process.StartInfo.FileName = Harness.MlaunchPath;
            var sb = new List <string> ();

            sb.Add("--logdev");
            sb.Add("--sdkroot");
            sb.Add(Harness.XcodeRoot);
            AppRunner.AddDeviceName(sb, DeviceName);
            process.StartInfo.Arguments              = StringUtils.FormatArguments(sb);
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.RedirectStandardInput  = true;
            process.OutputDataReceived += (object sender, DataReceivedEventArgs e) => {
                if (e.Data == null)
                {
                    streamEnds.Signal();
                }
                else
                {
                    lock (Log) {
                        Log.WriteLine(e.Data);
                    }
                }
            };
            process.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => {
                if (e.Data == null)
                {
                    streamEnds.Signal();
                }
                else
                {
                    lock (Log) {
                        Log.WriteLine(e.Data);
                    }
                }
            };
            Log.WriteLine("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
            process.Start();
            process.BeginOutputReadLine();
            process.BeginErrorReadLine();
        }
Esempio n. 2
0
        public void StartCapture()
        {
            writer     = new StreamWriter(new FileStream(LogPath, FileMode.Create));
            streamEnds = new CountdownEvent(2);

            process = new Process();
            process.StartInfo.FileName = Harness.MlaunchPath;
            var sb = new StringBuilder();

            sb.Append("--logdev ");
            sb.Append("--sdkroot ").Append(Harness.Quote(Harness.XcodeRoot)).Append(' ');
            AppRunner.AddDeviceName(sb, DeviceName);
            process.StartInfo.Arguments              = sb.ToString();
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.OutputDataReceived += (object sender, DataReceivedEventArgs e) => {
                if (e.Data == null)
                {
                    streamEnds.Signal();
                }
                else
                {
                    lock (writer) {
                        writer.WriteLine(e.Data);
                    }
                }
            };
            process.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => {
                if (e.Data == null)
                {
                    streamEnds.Signal();
                }
                else
                {
                    lock (writer) {
                        writer.WriteLine(e.Data);
                    }
                }
            };
            Harness.Log(1, "{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
            process.Start();
            process.BeginOutputReadLine();
            process.BeginErrorReadLine();
        }