public ParamInfoInput Clone() { ParamInfoInput p = new ParamInfoInput() { InputFieldName = InputFieldName, Desc = Desc, InputType = InputType, Input = Input, SrcInputStr = SrcInputStr }; return(p); }
/// <summary> /// 初始化客户端节点 /// </summary> public static void InitClient() { Type[] types = typeof(Node).Assembly.GetTypes(); foreach (Type type in types) { object[] objs = type.GetCustomAttributes(typeof(NodeAttribute), false); foreach (NodeAttribute attr in objs) { NodeParam p = new NodeParam() { NodeType = type, TypeDesc = attr.Desc, NodeClassType = attr.ClassifytType }; FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic); foreach (FieldInfo field in fields) { NodeFieldAttribute fieldAttr = field.GetCustomAttribute <NodeFieldAttribute>(); if (fieldAttr != null) { Type envKeyType = fieldAttr.envKeyType == null ? field.FieldType : fieldAttr.envKeyType; ParamInfo pInfo = new ParamInfo(field.Name, fieldAttr.Desc, envKeyType, fieldAttr.DefaultValue); p.Fields.Add(pInfo); continue; } NodeInputAttribute inputAttr = field.GetCustomAttribute <NodeInputAttribute>(); if (inputAttr != null) { ParamInfoInput pInput = new ParamInfoInput() { InputFieldName = field.Name, Desc = inputAttr.Desc, InputType = inputAttr.envKeyType, SrcInputStr = inputAttr.DefaultValue as string }; p.Inputs.Add(pInput); continue; } NodeOutputAttribute outputAttr = field.GetCustomAttribute <NodeOutputAttribute>(); if (outputAttr != null) { ParamInfoOutput pInfo = new ParamInfoOutput() { OutputFieldName = field.Name, Desc = outputAttr.Desc, OutputType = outputAttr.envKeyType, OutputName = outputAttr.DefaultValue as string }; p.Outputs.Add(pInfo); } } if (attr.ClassifytType == NodeClassifyType.Error) { _errorNode = p; } else { _clientNodes.Add(type, p); } } } }