public string CreatePhpScript(object portSelection, StringCollection method) { string ce = CreatePhpScript(method); if (_castTo != null) { IProgramPort p = portSelection as IProgramPort; if (p != null) { ObjectRef prop = p.PortProperty; if (prop != null) { StringCollection props = new StringCollection(); while (true) { props.Add(prop.localName); prop = prop.Owner; if (prop == null) { break; } if (prop.IsSameType(_castTo.EntityType)) { break; } } for (int i = props.Count - 1; i >= 0; i--) { ce = string.Format(CultureInfo.InvariantCulture, "{0}->{1}", ce, props[i]); } } } } return(ce); }
/// <summary> /// implement IProgramEntity.ReturnCodeExpression /// if _castTo is null then this function returns the same as IMathExpression.ReturnCodeExpression /// </summary> /// <param name="portSelection"></param> /// <param name="method"></param> /// <returns></returns> public CodeExpression ReturnCodeExpression(object portSelection, IMethodCompile method) { CodeExpression ce = ReturnCodeExpression(method); if (_castTo != null) { IProgramPort p = portSelection as IProgramPort; if (p != null) { ObjectRef prop = p.PortProperty; if (prop != null) { StringCollection props = new StringCollection(); ce = new CodeCastExpression(_castTo.EntityType.TypeString, VPLUtil.GetCoreExpressionFromCast(ce)); while (true) { props.Add(prop.localName); prop = prop.Owner; if (prop == null) { break; } if (prop.IsSameType(_castTo.EntityType)) { break; } } for (int i = props.Count - 1; i >= 0; i--) { ce = new CodePropertyReferenceExpression(ce, props[i]); } } } } return(ce); }