public static NodeAnalogOutput BuildWith(FieldIdentifier Code, FieldString Address, FieldSignalName OutputName) { //build fields Dictionary <FieldIdentifier, FieldBase> mutableFields = new Dictionary <FieldIdentifier, FieldBase>(); mutableFields.Add(new FieldIdentifier(m_CodeName), Code); mutableFields.Add(new FieldIdentifier(m_AddressName), Address); mutableFields.Add(new FieldIdentifier(m_ForcedName), new FieldBool(false)); mutableFields.Add(new FieldIdentifier(m_ForcedValueName), new FieldConstant(FieldDataType.DataTypeEnum.NUMBER, FieldDataType.DefaultValue(FieldDataType.DataTypeEnum.NUMBER))); mutableFields.Add(new FieldIdentifier(m_OutputNameName), OutputName); //Add Fields here: mutableFields.Add(new FieldIdentifier(m_CodeName), Code); //build children KeyedNodeCollection <NodeBase> mutableChildren = new KeyedNodeCollection <NodeBase>(); mutableChildren.Add(NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.NUMBER), new FieldConstant(FieldDataType.DataTypeEnum.NUMBER, FieldDataType.DefaultValue(FieldDataType.DataTypeEnum.NUMBER)))); //Add Children here: mutableChildren.Add(SomeChild); //build node NodeAnalogOutput Builder = new NodeAnalogOutput( new ReadOnlyDictionary <FieldIdentifier, FieldBase>(mutableFields), new ReadOnlyCollection <NodeBase>(mutableChildren)); return(Builder); }
public NodeInstruction SetSignalInToSignalId(int index, FieldGuid signalId) { var oldSignalIn = this.NodeSignalInChildren[index]; var newSignalIn = NodeSignalIn.BuildWith(oldSignalIn.DataType, signalId); var newInstruction = this.NodeSignalInChildren.Replace(oldSignalIn, newSignalIn); return(newInstruction); }