Settings of the MSIE JS engine
        /// <summary>
        /// Constructs an instance of adapter for the MSIE JS engine
        /// </summary>
        /// <param name="settings">Settings of the MSIE JS engine</param>
        public MsieJsEngine(MsieSettings settings)
        {
            MsieSettings msieSettings = settings ?? new MsieSettings();

            try
            {
                _jsEngine = new OriginalEngine(new OriginalEngineSettings
                {
                    EnableDebugging = msieSettings.EnableDebugging,
                    EngineMode      = Utils.GetEnumFromOtherEnum <JsEngineMode, OriginalEngineMode>(
                        msieSettings.EngineMode),
#if !NETSTANDARD1_3
                    MaxStackSize = msieSettings.MaxStackSize,
#endif
                    UseEcmaScript5Polyfill = msieSettings.UseEcmaScript5Polyfill,
                    UseJson2Library        = msieSettings.UseJson2Library
                });
                _engineVersion = _jsEngine.Mode;
            }
            catch (OriginalUsageException e)
            {
                throw JsErrorHelpers.WrapEngineLoadException(e, EngineName, _engineVersion);
            }
            catch (OriginalException e)
            {
                throw WrapJsException(e);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs a instance of adapter for the MSIE JS engine
        /// </summary>
        /// <param name="settings">Settings of the MSIE JS engine</param>
        public MsieJsEngine(MsieSettings settings)
        {
            MsieSettings msieSettings = settings ?? new MsieSettings();

            try
            {
                _jsEngine = new OriginalJsEngine(new OriginalJsEngineSettings
                {
                    EnableDebugging = msieSettings.EnableDebugging,
                    EngineMode      = Utils.GetEnumFromOtherEnum <JsEngineMode, OriginalJsEngineMode>(
                        msieSettings.EngineMode),
                    UseEcmaScript5Polyfill = msieSettings.UseEcmaScript5Polyfill,
                    UseJson2Library        = msieSettings.UseJson2Library
                });
                _engineVersion = _jsEngine.Mode;
            }
            catch (OriginalJsEngineLoadException e)
            {
                throw new JsEngineLoadException(
                          string.Format(CoreStrings.Runtime_JsEngineNotLoaded,
                                        EngineName, e.Message), EngineName, e.EngineMode, e);
            }
            catch (Exception e)
            {
                throw new JsEngineLoadException(
                          string.Format(CoreStrings.Runtime_JsEngineNotLoaded,
                                        EngineName, e.Message), EngineName, _engineVersion, e);
            }
        }
        /// <summary>
        /// Adds a instance of <see cref="MsieJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <param name="settings">Settings of the MSIE JS engine</param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddMsie(this JsEngineFactoryCollection source,
                                                        MsieSettings settings)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            source.Add(new MsieJsEngineFactory(settings));

            return(source);
        }
		/// <summary>
		/// Adds a instance of <see cref="MsieJsEngineFactory"/> to
		/// the specified <see cref="JsEngineFactoryCollection" />
		/// </summary>
		/// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
		/// <param name="settings">Settings of the MSIE JS engine</param>
		/// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
		public static JsEngineFactoryCollection AddMsie(this JsEngineFactoryCollection source,
			MsieSettings settings)
		{
			if (source == null)
			{
				throw new ArgumentNullException("source");
			}

			if (settings == null)
			{
				throw new ArgumentNullException("settings");
			}

			source.Add(new MsieJsEngineFactory(settings));

			return source;
		}
		/// <summary>
		/// Adds a instance of <see cref="MsieJsEngineFactory"/> to
		/// the specified <see cref="JsEngineFactoryCollection" />
		/// </summary>
		/// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
		/// <param name="configure">The delegate to configure the provided <see cref="MsieSettings"/></param>
		/// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
		public static JsEngineFactoryCollection AddMsie(this JsEngineFactoryCollection source,
			Action<MsieSettings> configure)
		{
			if (source == null)
			{
				throw new ArgumentNullException("source");
			}

			if (configure == null)
			{
				throw new ArgumentNullException("configure");
			}

			var settings = new MsieSettings();
			configure(settings);

			return source.AddMsie(settings);
		}
        /// <summary>
        /// Adds a instance of <see cref="MsieJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <param name="configure">The delegate to configure the provided <see cref="MsieSettings"/></param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddMsie(this JsEngineFactoryCollection source,
                                                        Action <MsieSettings> configure)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (configure == null)
            {
                throw new ArgumentNullException("configure");
            }

            var settings = new MsieSettings();

            configure(settings);

            return(source.AddMsie(settings));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Constructs an instance of the MSIE JS engine factory
 /// </summary>
 /// <param name="settings">Settings of the MSIE JS engine</param>
 public MsieJsEngineFactory(MsieSettings settings)
 {
     _settings = settings;
 }
		/// <summary>
		/// Constructs an instance of the MSIE JS engine factory
		/// </summary>
		/// <param name="settings">Settings of the MSIE JS engine</param>
		public MsieJsEngineFactory(MsieSettings settings)
		{
			_settings = settings;
		}