Exemple #1
0
        public SamplesTestServer() : base($"/service/Stride.SamplesTestServer/{StrideVersion.NuGetVersion}/Stride.SamplesTestServer.exe")
        {
            GameTestingSystem.Initialized = true;

            //start logging the iOS device if we have the proper tools avail
            if (IosTracker.CanProxy())
            {
                var loggerProcess = Process.Start(new ProcessStartInfo($"idevicesyslog.exe", "-d")
                {
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    RedirectStandardError  = true,
                    RedirectStandardOutput = true,
                });

                if (loggerProcess != null)
                {
                    loggerProcess.OutputDataReceived += (sender, args) =>
                    {
                        try
                        {
                            lock (loggerLock)
                            {
                                currentTester?.Send(new LogRequest {
                                    Message = $"STDIO: {args.Data}"
                                }).Wait();
                            }
                        }
                        catch
                        {
                        }
                    };

                    loggerProcess.ErrorDataReceived += (sender, args) =>
                    {
                        try
                        {
                            lock (loggerLock)
                            {
                                currentTester?.Send(new LogRequest {
                                    Message = $"STDERR: {args.Data}"
                                }).Wait();
                            }
                        }
                        catch
                        {
                        }
                    };

                    loggerProcess.BeginOutputReadLine();
                    loggerProcess.BeginErrorReadLine();

                    new AttachedChildProcessJob(loggerProcess);
                }
            }

            //Start also adb in case of android device
            var adbPath = AndroidDeviceEnumerator.GetAdbPath();

            if (!string.IsNullOrEmpty(adbPath) && AndroidDeviceEnumerator.ListAndroidDevices().Length > 0)
            {
                //clear the log first
                ShellHelper.RunProcessAndGetOutput("cmd.exe", $"/C {adbPath} logcat -c");

                //start logger
                var loggerProcess = Process.Start(new ProcessStartInfo("cmd.exe", $"/C {adbPath} logcat")
                {
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    RedirectStandardError  = true,
                    RedirectStandardOutput = true,
                });

                if (loggerProcess != null)
                {
                    loggerProcess.OutputDataReceived += (sender, args) =>
                    {
                        try
                        {
                            currentTester?.Send(new LogRequest {
                                Message = $"STDIO: {args.Data}"
                            }).Wait();
                        }
                        catch
                        {
                        }
                    };

                    loggerProcess.ErrorDataReceived += (sender, args) =>
                    {
                        try
                        {
                            currentTester?.Send(new LogRequest {
                                Message = $"STDERR: {args.Data}"
                            }).Wait();
                        }
                        catch
                        {
                        }
                    };

                    loggerProcess.BeginOutputReadLine();
                    loggerProcess.BeginErrorReadLine();

                    new AttachedChildProcessJob(loggerProcess);
                }
            }
        }
Exemple #2
0
        public SamplesTestServer() : base($"/service/{XenkoVersion.CurrentAsText}/SiliconStudio.Xenko.SamplesTestServer.exe")
        {
            //start logging the iOS device if we have the proper tools avail
            if (IosTracker.CanProxy())
            {
                var loggerProcess = Process.Start(new ProcessStartInfo($"{ Environment.GetEnvironmentVariable("SiliconStudioXenkoDir") }\\Bin\\Windows-Direct3D11\\idevicesyslog.exe", "-d")
                {
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    RedirectStandardError  = true,
                    RedirectStandardOutput = true,
                });

                if (loggerProcess != null)
                {
                    loggerProcess.OutputDataReceived += (sender, args) =>
                    {
                        try
                        {
                            lock (loggerLock)
                            {
                                currentTester?.Send(new LogRequest {
                                    Message = $"STDIO: {args.Data}"
                                }).Wait();
                            }
                        }
                        catch
                        {
                        }
                    };

                    loggerProcess.ErrorDataReceived += (sender, args) =>
                    {
                        try
                        {
                            lock (loggerLock)
                            {
                                currentTester?.Send(new LogRequest {
                                    Message = $"STDERR: {args.Data}"
                                }).Wait();
                            }
                        }
                        catch
                        {
                        }
                    };

                    loggerProcess.BeginOutputReadLine();
                    loggerProcess.BeginErrorReadLine();

                    new AttachedChildProcessJob(loggerProcess);
                }
            }

            //Start also adb in case of android device
            {
                //clear the log first
                ShellHelper.RunProcessAndGetOutput("cmd.exe", "/C adb logcat -c");

                //start logger
                var loggerProcess = Process.Start(new ProcessStartInfo("cmd.exe", "/C adb logcat")
                {
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    RedirectStandardError  = true,
                    RedirectStandardOutput = true,
                });

                if (loggerProcess != null)
                {
                    loggerProcess.OutputDataReceived += (sender, args) =>
                    {
                        try
                        {
                            currentTester?.Send(new LogRequest {
                                Message = $"STDIO: {args.Data}"
                            }).Wait();
                        }
                        catch
                        {
                        }
                    };

                    loggerProcess.ErrorDataReceived += (sender, args) =>
                    {
                        try
                        {
                            currentTester?.Send(new LogRequest {
                                Message = $"STDERR: {args.Data}"
                            }).Wait();
                        }
                        catch
                        {
                        }
                    };

                    loggerProcess.BeginOutputReadLine();
                    loggerProcess.BeginErrorReadLine();

                    new AttachedChildProcessJob(loggerProcess);
                }
            }
        }