Exemple #1
0
        public Process Start(ISikuliVersion version)
        {
            var javaPath = GuessJavaPath();

#if (DEBUG)
            Debug.WriteLine("Launching Sikuli: \"" + javaPath + "\" " + version.Arguments);
#endif

            var process = new Process
            {
                StartInfo =
                {
                    FileName               = javaPath,
                    Arguments              = version.Arguments,
                    CreateNoWindow         = true,
                    WindowStyle            = ProcessWindowStyle.Hidden,
                    UseShellExecute        = false,
                    RedirectStandardInput  = true,
                    RedirectStandardError  = true,
                    RedirectStandardOutput = true
                }
            };

            process.Start();

            return(process);
        }
Exemple #2
0
        public void Start()
        {
            if (_process != null)
            {
                throw new InvalidOperationException("This Sikuli session has already been started");
            }

            _version = _sikuliScriptProcessFactory.GetSikuliVersion();
            _process = _sikuliScriptProcessFactory.Start(_version);

            _asyncTwoWayStreamsHandler = _asyncDuplexStreamsHandlerFactory.Create(_process.StandardOutput, _process.StandardError, _process.StandardInput);
            if (_version.ReadyMarker != null)
            {
                _asyncTwoWayStreamsHandler.ReadUntil(SikuliReadyTimeoutSeconds, _version.ReadyMarker);
            }
            foreach (var command in _version.InitialCommands ?? new string[0])
            {
                _asyncTwoWayStreamsHandler.WriteLine(command);
            }
        }