예제 #1
0
 public override CodeExpression GCode_CodeDom_GetSelfRefrence(LinkPinControl element, GenerateCodeContext_Method context, GenerateCodeContext_PreNode preNodeContext = null)
 {
     return(new CodeVariableReferenceExpression(ValidName));
 }
예제 #2
0
 public override CodeExpression GCode_CodeDom_GetValue(LinkPinControl element, GenerateCodeContext_Method context, GenerateCodeContext_PreNode preNodeContext = null)
 {
     return(new System.CodeDom.CodeBaseReferenceExpression());
 }
예제 #3
0
        public override CodeExpression GCode_CodeDom_GetValue(LinkPinControl element, GenerateCodeContext_Method context, GenerateCodeContext_PreNode preNodeContext = null)
        {
            var param = CSParam as MethodInvoke_DelegateControlConstructionParams;

            var lambdaExp = new CodeGenerateSystem.CodeDom.CodeLambdaExpression();

            lambdaExp.LambdaFieldName = "lambda_" + MethodName;

            var method          = param.ParamInfo.ParameterType.GetMethod("Invoke");
            var methodInvokeExp = new CodeGenerateSystem.CodeDom.CodeMethodInvokeExpression();

            methodInvokeExp.Method = new CodeMethodReferenceExpression(new CodeThisReferenceExpression(), MethodName);
            foreach (var methodParam in method.GetParameters())
            {
                var lambdaParam = new CodeGenerateSystem.CodeDom.CodeLambdaExpression.LambdaParam();
                if (methodParam.IsOut)
                {
                    lambdaParam.Dir  = FieldDirection.Out;
                    lambdaParam.Name = "__" + methodParam.Name;
                    lambdaExp.LambdaParams.Add(lambdaParam);
                }
                else if (methodParam.ParameterType.IsByRef)
                {
                    lambdaParam.Dir  = FieldDirection.Ref;
                    lambdaParam.Name = "__" + methodParam.Name;
                    lambdaExp.LambdaParams.Add(lambdaParam);
                }
                else
                {
                    lambdaParam.Dir  = FieldDirection.In;
                    lambdaParam.Name = "__" + methodParam.Name;
                    lambdaExp.LambdaParams.Add(lambdaParam);
                }
                methodInvokeExp.Parameters.Add(new CodeDirectionExpression(lambdaParam.Dir, new CodeVariableReferenceExpression(lambdaParam.Name)));
            }

            foreach (var child in mChildNodes)
            {
                // 获取连线参数的数值
                var paramNode = child as MethodInvokeParameterControl;
                var linkOI    = paramNode.ParamPin;
                var fromNode  = linkOI.GetLinkedObject(0, true);
                var exp       = fromNode.GCode_CodeDom_GetValue(linkOI.GetLinkedPinControl(0, true), context);
                methodInvokeExp.Parameters.Add(exp);
            }

            lambdaExp.MethodInvoke = methodInvokeExp;

            if (method.ReturnType != typeof(void))
            {
                lambdaExp.NeedReturn = true;
            }

            return(lambdaExp);
        }
예제 #4
0
 public override CodeExpression GCode_CodeDom_GetSelfRefrence(LinkPinControl element, GenerateCodeContext_Method context, GenerateCodeContext_PreNode preNodeContext = null)
 {
     //var validName = StringRegex.GetValidName(NodeName);
     return(null);//new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(new CodeThisReferenceExpression(), "GetCachedAnimPose"), new CodePrimitiveExpression(NodeName));
 }
예제 #5
0
        public override CodeExpression GCode_CodeDom_GetValue(LinkPinControl element, GenerateCodeContext_Method context, GenerateCodeContext_PreNode preNodeContext = null)
        {
            var param = CSParam as TypeofConstructionParams;

            return(new System.CodeDom.CodeTypeOfExpression(param.ValueType));
        }
예제 #6
0
 public override CodeExpression GCode_CodeDom_GetValue(LinkPinControl element, GenerateCodeContext_Method context, GenerateCodeContext_PreNode preNodeContext = null)
 {
     if (element == null || element == mCtrlTarget || element == mCtrlTargetOut)
     {
         return(mCtrlTarget.GetLinkedObject(0).GCode_CodeDom_GetValue(mCtrlTarget.GetLinkedPinControl(0), context, null));
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
예제 #7
0
        public override CodeExpression GCode_CodeDom_GetSelfRefrence(LinkPinControl element, GenerateCodeContext_Method context, GenerateCodeContext_PreNode preNodeContext = null)
        {
            var validName = Regex.Replace(NodeName, "[ \\[ \\] \\^ \\*×――(^)$%~!@#$…&%¥+=<>《》!!???::•`·、。,;,.;\"‘’“”-]", "");

            return(new CodeVariableReferenceExpression(validName));
        }
예제 #8
0
        public override CodeExpression GCode_CodeDom_GetValue(LinkPinControl element, GenerateCodeContext_Method context, GenerateCodeContext_PreNode preNodeContext = null)
        {
            var param   = CSParam as ExpandNodeChildConstructionParams;
            var expNode = ParentNode as ExpandNode;
            var tagExp  = expNode.GCode_CodeDom_GetValue(null, context, null);

            return(new CodePropertyReferenceExpression(tagExp, param.ParamName));
        }
예제 #9
0
 public override CodeExpression GCode_CodeDom_GetSelfRefrence(LinkPinControl element, GenerateCodeContext_Method context, GenerateCodeContext_PreNode preNodeContext = null)
 {
     //var validName = System.Text.RegularExpressions.Regex.Replace(NodeName, "[ \\[ \\] \\^ \\*×――(^)$%~!@#$…&%¥+=<>《》!!???::•`·、。,;,.;\"‘’“”-]", "");
     return(null);//new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(new CodeThisReferenceExpression(), "GetCachedAnimPose"), new CodePrimitiveExpression(NodeName));
 }
예제 #10
0
 public override CodeExpression GCode_CodeDom_GetValue(LinkPinControl element, GenerateCodeContext_Method context, GenerateCodeContext_PreNode preNodeContext = null)
 {
     if (element == null || element == mCountOutPin)
     {
         var arrayValue = mArrayInPin.GetLinkedObject(0, true).GCode_CodeDom_GetValue(mArrayInPin.GetLinkedPinControl(0, true), context);
         return(new CodePropertyReferenceExpression(arrayValue, "Count"));
     }
     else
     {
         throw new InvalidOperationException();
     }
 }