/// <summary>
 /// Evaluates the response.
 /// </summary>
 /// <param name="response">The response to parse.</param>
 /// <param name="options">The options to consider.</param>
 public void Evaluate(IResponse response, ScriptOptions options)
 {
     var reader = new StreamReader(response.Content, options.Encoding ?? Encoding.UTF8, true);
     var content = reader.ReadToEnd();
     reader.Close();
     Evaluate(content, options);
 }
 public void Evaluate(IResponse response, ScriptOptions options)
 {
     using (var sr = new StreamReader(response.Content, options.Encoding))
     {
         var source = sr.ReadToEnd();
         Evaluate(source, options);
     }
 }
        /// <summary>
        /// Evaluates the given source.
        /// </summary>
        /// <param name="source">The source code to evaluate.</param>
        /// <param name="options">The options to consider.</param>
        public void Evaluate(String source, ScriptOptions options)
        {
            var objectContext = options.Context;
            var instance = default(EngineInstance);

            if (_contexts.TryGetValue(objectContext, out instance) == false)
                _contexts.Add(objectContext, instance = new EngineInstance(objectContext, _external));

            instance.RunScript(source);
        }
Esempio n. 4
0
        public Task EvaluateScriptAsync(IResponse response, ScriptOptions options, CancellationToken cancel)
        {
            using (var sr = new StreamReader(response.Content, options.Encoding))
            {
                var source = sr.ReadToEnd();
                _requests.Add(Tuple.Create(source, options));
            }

            return Task.FromResult(false);
        }
 public void Evaluate(IResponse response, ScriptOptions options)
 {
     if (Callback != null)
         Callback(options);
 }
 public void Evaluate(String source, ScriptOptions options)
 {
     if (Callback != null)
         Callback(options);
 }
Esempio n. 7
0
        public Task EvaluateScriptAsync(IResponse response, ScriptOptions options, CancellationToken cancel)
        {
            Callback?.Invoke(options);

            return Task.FromResult(true);
        }
 public void Evaluate(String source, ScriptOptions options)
 {
     _requests.Add(Tuple.Create(source, options));
 }