Example #1
0
        /// <summary>
        /// Starts the REPL engine.
        /// </summary>
        /// <param name="script">The script to run at startup.</param>
        /// <returns>Returns the REPL engine.</returns>
        public IReplEngine Start(string script = null)
        {
            var state = _stateStream.First();

            if (state != Core.State.Stopped && state != Core.State.Unknown && state != Core.State.Faulted)
            {
                return(this);
            }

            _stateStream.OnNext(Core.State.Starting);

            _startupScript = script;
            _replProcess   = StartProcess();

            return(this);
        }
Example #2
0
        /// <summary>
        /// Reset the REPL engine, if it has already been started.
        /// </summary>
        /// <returns>Returns the REPL engine.</returns>
        public IReplEngine Reset()
        {
            var state = _stateStream.First();

            if (state == Core.State.Stopping || state == Core.State.Stopped)
            {
                return(this);
            }

            _stateStream.OnNext(Core.State.Stopping);

            _replProcess.Dispose();

            _stateStream.OnNext(Core.State.Stopped);
            _stateStream.OnNext(Core.State.Starting);

            _replProcess = StartProcess();

            return(this);
        }
Example #3
0
        /// <summary>
        /// Stops the REPL engine.
        /// </summary>
        /// <returns>Returns the REPL engine.</returns>
        public IReplEngine Stop()
        {
            var state = _stateStream.First();

            if (state == Core.State.Stopping || state == Core.State.Stopped)
            {
                return(this);
            }

            _stateStream.OnNext(Core.State.Stopping);

            _replProcess.Dispose();

            _replProcess   = null;
            _startupScript = null;

            _stateStream.OnNext(Core.State.Stopped);

            return(this);
        }
        /// <summary>
        /// Reset the REPL engine, if it has already been started.
        /// </summary>
        /// <returns>Returns the REPL engine.</returns>
        public IReplEngine Reset()
        {
            var state = _stateStream.First();
            if (state == Core.State.Stopping || state == Core.State.Stopped)
            {
                return this;
            }

            _stateStream.OnNext(Core.State.Stopping);

            _replProcess.Dispose();

            _stateStream.OnNext(Core.State.Stopped);
            _stateStream.OnNext(Core.State.Starting);

            _replProcess = StartProcess();

            return this;
        }
        /// <summary>
        /// Stops the REPL engine.
        /// </summary>
        /// <returns>Returns the REPL engine.</returns>
        public IReplEngine Stop()
        {
            var state = _stateStream.First();
            if (state == Core.State.Stopping || state == Core.State.Stopped)
            {
                return this;
            }

            _stateStream.OnNext(Core.State.Stopping);

            _replProcess.Dispose();

            _replProcess = null;
            _startupScript = null;

            _stateStream.OnNext(Core.State.Stopped);
            
            return this;
        }
        /// <summary>
        /// Starts the REPL engine.
        /// </summary>
        /// <param name="script">The script to run at startup.</param>
        /// <returns>Returns the REPL engine.</returns>
        public IReplEngine Start(string script = null)
        {
            var state = _stateStream.First();
            if (state != Core.State.Stopped && state != Core.State.Unknown && state != Core.State.Faulted)
            {
                return this;
            }

            _stateStream.OnNext(Core.State.Starting);

            _startupScript = script;
            _replProcess = StartProcess();

            return this;
        }