Provides a middleware to callback the BaZicInterpreter from the BaZicInterpreterCore.
상속: MarshalByRefObject
예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaZicInterpreterCore"/> class.
        /// </summary>
        /// <param name="middleware">The middleware</param>
        /// <param name="assemblySandbox">The assembly sandbox.</param>
        /// <param name="program">The <see cref="BaZicProgram"/> to interpret.</param>
        private BaZicInterpreterCore(BaZicInterpreterMiddleware middleware, AssemblySandbox assemblySandbox, BaZicProgram program)
            : this(middleware, assemblySandbox)
        {
            Requires.NotNull(program, nameof(program));

            _stateChangedHistory = new List <BaZicInterpreterStateChangeEventArgs>();
            ChangeState(this, new BaZicInterpreterStateChangeEventArgs(BaZicInterpreterState.Ready));

            Program = program;
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaZicInterpreterCore"/> class.
        /// </summary>
        /// <param name="middleware">The middleware</param>
        /// <param name="assemblySandbox">The assembly sandbox.</param>
        /// <param name="inputCode">The BaZic code to interpret.</param>
        /// <param name="xamlCode">The XAML code to interpret that represents the user interface.</param>
        /// <param name="resourceFilePaths">Paths to the resources files (like PNG or JPG) required for the XAML code.</param>
        /// <param name="optimize">(optional) Defines whether the generated syntax tree must be optimized for the interpreter or not.</param>
        private BaZicInterpreterCore(BaZicInterpreterMiddleware middleware, AssemblySandbox assemblySandbox, string inputCode, string xamlCode, IEnumerable <string> resourceFilePaths, bool optimize = false)
            : this(middleware, assemblySandbox)
        {
            var parser        = new BaZicParser();
            var parsingResult = parser.Parse(inputCode, xamlCode, resourceFilePaths, optimize);

            if (parsingResult.Issues.InnerExceptions.OfType <BaZicParserException>().Count(issue => issue.Level == BaZicParserExceptionLevel.Error) != 0 || (!parsingResult.Issues.InnerExceptions.OfType <BaZicParserException>().Any() && parsingResult.Issues.InnerExceptions.Count > 0))
            {
                throw parsingResult.Issues;
            }

            Program = parsingResult.Program;
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaZicInterpreterCore"/> class.
        /// </summary>
        /// <param name="middleware">The middleware</param>
        /// <param name="assemblySandbox">The assembly sandbox.</param>
        private BaZicInterpreterCore(BaZicInterpreterMiddleware middleware, AssemblySandbox assemblySandbox)
        {
            Requires.NotNull(middleware, nameof(middleware));
            Requires.NotNull(assemblySandbox, nameof(assemblySandbox));

            _middleware          = middleware;
            _stateChangedHistory = new List <BaZicInterpreterStateChangeEventArgs>();
            ChangeState(this, new BaZicInterpreterStateChangeEventArgs(BaZicInterpreterState.Ready));

            RunningStateManager = new RunningStateManager(this);
            _assemblySandbox    = assemblySandbox;
            Reflection          = _assemblySandbox.Reflection;
        }