Пример #1
0
        private IDataStreamParser CreateConverter()
        {
            if (_convert == null)
            {
                ScriptContainer container = new ScriptContainer(_engine, Guid.Empty, _script, _enableDebug, _referencedAssemblies.Select(a => a.GetName()));
                _convert = (IDataStreamParser)ScriptUtils.GetInstance(container, _classname);
                if (_state != null)
                {
                    IPersistDynamicNode persist = _convert as IPersistDynamicNode;
                    if (persist != null)
                    {
                        persist.SetState(_state, GetLogger());
                    }
                }
            }

            return(_convert);
        }
Пример #2
0
 /// <summary>
 /// Invoke a static method on the script
 /// </summary>
 /// <param name="classname">The classname to use</param>
 /// <param name="methodname">The method name</param>
 /// <param name="args">The arguments</param>
 /// <returns>The return value of the method</returns>
 public object Invoke(string classname, string methodname, params object[] args)
 {
     return(ScriptUtils.Invoke(this, classname, methodname, args));
 }
Пример #3
0
 /// <summary>
 /// Get class names from the script
 /// </summary>
 /// <param name="types">Optional list of types</param>
 /// <returns>Get list of classes for this container</returns>
 public string[] GetClassNames(params Type[] types)
 {
     return(ScriptUtils.GetTypes(this, types));
 }
Пример #4
0
 /// <summary>
 /// Get an instance of a class from the script
 /// </summary>
 /// <param name="classname">The classname to get</param>
 /// <param name="args">The arguments for the constructor</param>
 /// <returns>An instance of the object</returns>
 public object GetInstance(string classname, params object[] args)
 {
     return(ScriptUtils.GetInstance(this, classname, args));
 }
Пример #5
0
 /// <summary>
 /// Get an instance of a class from the script
 /// </summary>
 /// <param name="classname">The classname to get</param>
 /// <returns>An instance of the object</returns>
 public object GetInstance(string classname)
 {
     return(ScriptUtils.GetInstance(this, classname));
 }
Пример #6
0
 /// <summary>
 /// Get an instance of a class from the script using internal classname
 /// </summary>
 /// <param name="args">The arguments for the constructor</param>
 /// <returns>An instance of the object</returns>
 public object GetInstance(params object[] args)
 {
     return(ScriptUtils.GetInstance(_container, _classname, args));
 }
Пример #7
0
 /// <summary>
 /// Get an instance of a class from the script using internal classname
 /// </summary>
 /// <returns>An instance of the object</returns>
 public object GetInstance()
 {
     return(ScriptUtils.GetInstance(_container, _classname));
 }
Пример #8
0
 /// <summary>
 /// Invoke a static method on the script using internal classname
 /// </summary>
 /// <param name="methodname">The method name</param>
 /// <param name="args">The arguments</param>
 /// <returns>The return value of the method</returns>
 public object Invoke(string methodname, params object[] args)
 {
     return(ScriptUtils.Invoke(_container, _classname, methodname, args));
 }