private static IPinDataType CreateTargetPinDataType(ConvertTypeCode typeCode) { switch (typeCode) { case ConvertTypeCode.Any: return(PinDataTypeFactory.CreateAny());; case ConvertTypeCode.Boolean: return(PinDataTypeFactory.CreateBoolean()); case ConvertTypeCode.Byte: return(PinDataTypeFactory.FromType(typeof(byte))); case ConvertTypeCode.Int16: return(PinDataTypeFactory.FromType(typeof(short))); case ConvertTypeCode.Int32: return(PinDataTypeFactory.CreateInt32()); case ConvertTypeCode.Int64: return(PinDataTypeFactory.FromType(typeof(long))); case ConvertTypeCode.Float32: return(PinDataTypeFactory.FromType(typeof(float))); case ConvertTypeCode.Float64: return(PinDataTypeFactory.FromType(typeof(double))); case ConvertTypeCode.String: return(PinDataTypeFactory.CreateString()); } return(PinDataTypeFactory.Create <object>()); }
public SequenceEqual(IGraphRuntime runtime) : base(runtime) { this.firstInputPin = AddInputPin("First", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.secondInputPin = AddInputPin("Second", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.outputPin = AddOutputPin("Result", PinDataTypeFactory.CreateBoolean()); this.firstInputPin.WhenNodeEvent.Subscribe(HandleInputPinEvent); this.secondInputPin.WhenNodeEvent.Subscribe(HandleInputPinEvent); }
public WriteFile(IGraphRuntime runtime) : base(runtime) { pathPin = this.AddInputPin("fileName", PinDataTypeFactory.Create <string>(string.Empty, WellKnownEditors.FileSelector), PropertyMode.Default, flags: PinFlags.ResolvePath); modePin = this.AddInputPin("mode", PinDataTypeFactory.CreateEnum(WriteFileMode.OverwriteOrCreate, WellKnownEditors.DropDown), PropertyMode.Default); writablePin = this.AddInputPin("writable", PinDataTypeFactory.Create <IWritable>(), PropertyMode.Never); appendGuidPin = this.AddInputPin("appendGuid", PinDataTypeFactory.CreateBoolean(false), PropertyMode.Default); createDirectoryPin = this.AddInputPin("createDirectory", PinDataTypeFactory.CreateBoolean(false), PropertyMode.Default); EnableVirtualOutputPin(); }
public Any(IGraphRuntime runtime) : base(runtime, false, PinDataTypeFactory.Create <bool>(), SUBGRAPH_SOURCE_PIN_ID) { this.input = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.output = AddOutputPin("Output", PinDataTypeFactory.CreateBoolean()); this.subGraphInput = ((GenericOutputPin)this.subGraphInputModule.Outputs[SUBGRAPH_SOURCE_PIN_ID]); this.input.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault() ?? typeof(object); subGraphInput.ChangeType(PinDataTypeFactory.FromType(genericType)); BuildGenericDelegate(); }); }); }