public Object Invoke(params Object[] operandList)
        {
            if (_operatorDeclaringTypeInstance == null)
            {
                Type declaringType = _operatorEvaluateMethod.DeclaringType;
                _operatorDeclaringTypeInstance = NuGenActivator.CreateObject(declaringType);
            }

            Object[] parameters = new Object[_inputParameterCount];

            for (Int32 i = 0; i < parameters.Length; i++)
            {
                parameters[i] = operandList[i];
            }

            return(_operatorEvaluateMethod.Invoke(_operatorDeclaringTypeInstance, parameters));
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Operator"/> class.
        /// </summary>
        /// <param name="descriptor">Can be <see langword="null"/>.</param>
        /// <param name="inputCount"></param>
        /// <param name="outputCount"></param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="descriptor"/> is <see langword="null"/>.</para>
        /// </exception>
        public Operator(OperatorDescriptor descriptor)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException("descriptor");
            }

            _descriptor = descriptor;
            Name        = Header = _descriptor.Name;

            CreateOutputs(descriptor.OutputParameterCount);
            Object defaultOutputValue = NuGenActivator.CreateObject(descriptor.GetOutputParameter().ParameterType);

            SetOutput(0, "Result", defaultOutputValue);

            CreateInputs(descriptor.InputParameterCount);
            ParameterInfo[] inputParameters = descriptor.GetInputParameters();

            for (int i = 0; i < descriptor.InputParameterCount; i++)
            {
                Object defaultInputValue = NuGenActivator.CreateObject(inputParameters[i].ParameterType);
                SetInput(i, inputParameters[i].Name, defaultInputValue);
            }
        }
Exemple #3
0
		public NodeBase CreateNode(Canvas canvas)
		{
			return (NodeBase)NuGenActivator.CreateObject(ParamType);
		}
Exemple #4
0
 public NodeBase CreateNode(Canvas canvas)
 {
     return((NodeBase)NuGenActivator.CreateObject(ProgramType, new Object[] { canvas.SelectedProgram }));
 }