An adapter to convert .Net objects to script objects.
示例#1
0
 /// <summary>
 /// Creates a <see cref="Prototype"/> from a .net <see cref="Type"/> and adds it to the context.
 /// </summary>
 /// <param name="processor">Reference to a processor instance.</param>
 /// <param name="t">The type from which to create the prototype. The name of the type will be used for the Prototype's name.</param>
 public static void AddPrototype(ScriptProcessor processor, Type t)
 {
     processor.Context.AddPrototype(ScriptInAdapter.TranslatePrototype(processor, t));
 }
示例#2
0
        /// <summary>
        /// Sets a member of the original script object.
        /// </summary>
        public void SetMember(string identifier, object value)
        {
            SObject data = ScriptInAdapter.Translate(_processor, value);

            _objReference.SetMember(_processor, _processor.CreateString(identifier), false, data);
        }
示例#3
0
 /// <summary>
 /// Adds a new variable or overwrites one with the same name.
 /// </summary>
 public static void AddVariable(ScriptProcessor processor, string identifier, object data)
 {
     AddVariable(processor, identifier, ScriptInAdapter.Translate(processor, data));
 }