예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicNode"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public InputSelector(INodeContext context)
            : base(context, INPUT_PREFIX)
        {
            context.ThrowIfNull("context");
            mTypeService = context.GetService <ITypeService>();

            // Initialize the input count, allowing range 2..99.
            mInputCount          = mTypeService.CreateInt(PortTypes.Integer, "InputCount", 2);
            mInputCount.MinValue = 2;
            mInputCount.MaxValue = 50;

            // Initialize inputs using a helper function that grows/shrinks the list of inputs
            // whenever the input count is changed
            mInputs = new List <AnyValueObject>();
            ListHelpers.ConnectListToCounter(mInputs, mInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Any, INPUT_PREFIX),
                                             updateOutputValues);

            // Initialize the input for the index of the input to select.
            mSelectIndexInput           = mTypeService.CreateInt(PortTypes.Integer, "InputSelectIndex");
            mSelectIndexInput.MinValue  = 0;
            mSelectIndexInput.MaxValue  = mInputCount.MaxValue - 1;
            mSelectIndexInput.ValueSet += updateOutputValues;

            // Initialize the selector for "send-on-select".
            mSelectAction = mTypeService.CreateEnum("ESelectAction2",
                                                    "SelectAction2", mSelectActionValues, "ResendCurrent");

            // Initialize the output
            mOutput = mTypeService.CreateAny(PortTypes.Any, "Output");
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="context">The node context.</param>
        public XmlJsonParser(INodeContext context)
            : base(context, OUTPUT_PREFIX)
        {
            context.ThrowIfNull("context");
            mTypeService = context.GetService <ITypeService>();

            // Initialize the input.
            mInput = mTypeService.CreateString(PortTypes.String, INPUT_NAME);

            // Initialize the selector for "XML" or "JSON".
            mSelectInput = mTypeService.CreateEnum("ESelectCode", "SelectCode", mSelectInputValues, "XML");

            // Initialize the output etc. parameter count.
            mCount           = mTypeService.CreateInt(PortTypes.Integer, "OutputCount", 1);
            mCount.MinValue  = 1;
            mCount.MaxValue  = 50;
            mCount.ValueSet += updateSelectOperationCount;

            // Initialize operation selector parameters
            mSelectOperation = new List <EnumValueObject>();
            updateSelectOperationCount();

            // Initialize operation parameters using a helper function that grows/shrinks
            // the list whenever the count is changed
            mSelectParam = new List <StringValueObject>();
            ListHelpers.ConnectListToCounter(mSelectParam, mCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.String, SEL_OP_PARAM_PREFIX),
                                             null, updateSelectParamDefault);
            updateSelectParamDefault();

            // Initialize path parameters using a helper function that grows/shrinks the
            // list whenever the count is changed
            mPath = new List <StringValueObject>();
            ListHelpers.ConnectListToCounter(mPath, mCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.String, PATH_PREFIX), null);

            // Initialize outputs using a helper function that grows/shrinks the list of
            // outputs whenever the output count is changed
            mOutput = new List <AnyValueObject>();
            ListHelpers.ConnectListToCounter(mOutput, mCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Any, OUTPUT_PREFIX), null);

            // Initialize error text output
            mError = mTypeService.CreateString(PortTypes.String, "RuntimeError");

            mCommaCulture = new CultureInfo("de");
            mPointCulture = new CultureInfo("en");
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlaceholderNodeBase"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public PlaceholderNodeBase(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");
            mTypeService = context.GetService <ITypeService>();

            // Initialize one template parameter, but allow more of them
            mTemplateCount          = mTypeService.CreateInt(PortTypes.Integer, TEMPLATE_PREFIX + "Count", 1);
            mTemplateCount.MinValue = 1;
            mTemplateCount.MaxValue = 10;
            mTemplates = new List <StringValueObject>();
            ListHelpers.ConnectListToCounter(mTemplates, mTemplateCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.String, TEMPLATE_PREFIX + " "),
                                             updateTemplate);

            // Initialize token object storage and output per template parameter
            mTokensPerTemplate = new List <List <TokenBase> >();
            mOutputs           = new List <IValueObject>();
            updateTemplateCount();
            mTemplateCount.ValueSet += updateTemplateCount;

            // Initialize the input counts
            mBinInputCount = mTypeService.CreateInt(PortTypes.Integer, INPUT_BIN_PREFIX + "Count", 0);
            mIntInputCount = mTypeService.CreateInt(PortTypes.Integer, INPUT_INT_PREFIX + "Count", 0);
            mNumInputCount = mTypeService.CreateInt(PortTypes.Integer, INPUT_NUM_PREFIX + "Count", 0);
            mStrInputCount = mTypeService.CreateInt(PortTypes.Integer, INPUT_STR_PREFIX + "Count", 0);

            // Initialize inputs using helper functions that grow/shrink the list of
            // inputs whenever the input count is changed
            mBinInputs = new List <BoolValueObject>();
            ListHelpers.ConnectListToCounter(mBinInputs, mBinInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Bool, INPUT_BIN_PREFIX),
                                             updateOutputValues);
            mIntInputs = new List <IntValueObject>();
            ListHelpers.ConnectListToCounter(mIntInputs, mIntInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Integer, INPUT_INT_PREFIX),
                                             updateOutputValues);
            mNumInputs = new List <DoubleValueObject>();
            ListHelpers.ConnectListToCounter(mNumInputs, mNumInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Number, INPUT_NUM_PREFIX),
                                             updateOutputValues);
            mStrInputs = new List <StringValueObject>();
            ListHelpers.ConnectListToCounter(mStrInputs, mStrInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.String, INPUT_STR_PREFIX),
                                             updateOutputValues);
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicNode"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public OutputSelector(INodeContext context)
            : base(context, OUTPUT_PREFIX)
        {
            context.ThrowIfNull("context");
            mTypeService = context.GetService <ITypeService>();

            // Initialize the input.
            mInput           = mTypeService.CreateAny(PortTypes.Any, "Input");
            mInput.ValueSet += updateOutputValues;

            // Initialize the output count.
            mOutputCount          = mTypeService.CreateInt(PortTypes.Integer, "OutputCount", 2);
            mOutputCount.MinValue = 1; // for use as Lock-out+ (Sperre+)
            mOutputCount.MaxValue = 50;

            // Initialize the input for the index of the output to select.
            mSelectIndexInput           = mTypeService.CreateInt(PortTypes.Integer, "OutputSelectIndex");
            mSelectIndexInput.MinValue  = -1;                    //  -1 selects no output
            mSelectIndexInput.MaxValue  = mOutputCount.MaxValue; // max selects no output
            mSelectIndexInput.ValueSet += updateOutputValues;

            // Initialize the selector for "send-on-select".
            mSelectAction = mTypeService.CreateEnum("ESelectAction3",
                                                    "SelectAction3", mSelectActionValues, "ResendCurrent");

            // Initialize outputs using a helper function that grows/shrinks the list of outputs
            // whenever the output count is changed
            mOutputs = new List <AnyValueObject>();
            ListHelpers.ConnectListToCounter(mOutputs, mOutputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Any, OUTPUT_PREFIX), null);

            // Initialize outputs using a helper function that grows/shrinks the
            // list of outputs whenever the output count is changed
            mPrevOutputs = new List <AnyValueObject>();
            ListHelpers.ConnectListToCounter(mPrevOutputs, mOutputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Any, ""), null, null);

            // Initialize the value to send upon "de-select".
            mIdleValueType = mTypeService.CreateEnum("EValueType",
                                                     "IdleValueType", mValueTypes, "none");
            updateIdleValueType();
            mIdleValueType.ValueSet += updateIdleValueType;
        }
예제 #5
0
        public NotificationNode(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");

            this.SetupIgnoreSSLTrust();

            var typeService = context.GetService<ITypeService>();

            this.Trigger = typeService.CreateBool(PortTypes.Binary, "Trigger");
            this.Token = typeService.CreateString(PortTypes.String, "Token");
            this.UserKey = typeService.CreateString(PortTypes.String, "UserKey");
            this.Message = typeService.CreateString(PortTypes.String, "Message");

            this.Variables = new List<StringValueObject>();

            this.VariableCount = typeService.CreateInt(PortTypes.Integer, "VariableCount", 0);
            this.VariableCount.MinValue = 0;
            this.VariableCount.MaxValue = 99;

            ListHelpers.ConnectListToCounter(this.Variables, this.VariableCount, typeService.GetValueObjectCreator(PortTypes.String, "Variable"), null, null);
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicNode"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public Statistics(INodeContext context)
            : base(context, INPUT_PREFIX)
        {
            context.ThrowIfNull("context");
            mTypeService = context.GetService <ITypeService>();

            // Initialize the input count.
            mInputCount          = mTypeService.CreateInt(PortTypes.Integer, "InputCount", 2);
            mInputCount.MinValue = 2;
            mInputCount.MaxValue = 50;

            // Initialize inputs using a helper function that grows/shrinks the list of inputs
            // whenever the input count is changed
            mInputs = new List <DoubleValueObject>();
            ListHelpers.ConnectListToCounter(mInputs, mInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Number, INPUT_PREFIX),
                                             updateOutputValues);

            // Initialize the selector for the aggregate function that shall be calculated.
            mSelectedFunction = mTypeService.CreateEnum("ESelectedFunction",
                                                        "SelectedFunction", mPriAllowedValues, /* defaultValue = */ "Avg");

            // Initialize the primary output
            mOutput1 = mTypeService.CreateDouble(PortTypes.Number, "Output1");

            // Initialize the selector for the secondary function (none by default) that shall
            // be calculated.
            string[] secAllowedValues = mAddAllowedValues.Concat(mPriAllowedValues).ToArray();
            mSecondaryFunction = mTypeService.CreateEnum("ESecondaryFunction",
                                                         "SecondaryFunction", secAllowedValues, /* defaultValue = */ "none");

            // Update output properties now, and whenever the function selections change
            updatePrimaryOutputProperties();
            updateSecondaryOutputProperties();
            mSelectedFunction.ValueSet  += updatePrimaryOutputProperties;
            mSecondaryFunction.ValueSet += updateSecondaryOutputProperties;
        }