Exemplo n.º 1
0
        public Double execInt64()
        {
            if (ExpressType == LCExpressType.Expression)
            {
                string tempExipression = Exipression;
                //Debug.WriteLine(tempExipression);
                foreach (CParameter node in ListParam)
                {
                    tempExipression = tempExipression.Replace(node.Name, node.Value);
                }
                tempExipression = tempExipression.Replace("==", "=");
                ExpressionParser.ExpressionParse res = new ExpressionParser.ExpressionParse();
                //Debug.WriteLine(tempExipression);
                res.Expression = tempExipression;
                string mes = res.ExecuteToString();

                try
                {
                    return(Convert.ToDouble(mes));
                }
                catch (Exception ex)
                {
                    return(0);
                }
            }
            else if (ExpressType == LCExpressType.Var)
            {
                if (cVar != null)
                {
                    try
                    {
                        return(Convert.ToDouble(cVar.GetInt64Value()));
                    }
                    catch (Exception ex)
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            else if (ExpressType == LCExpressType.StaticText)
            {
                try
                {
                    return(Convert.ToDouble(sText));
                }
                catch (Exception ex)
                {
                    return(0);
                }
            }
            return(0);
        }
Exemplo n.º 2
0
        public String execStr()
        {
            if (ExpressType == LCExpressType.Expression)
            {
                string tempExipression = Exipression;
                //Debug.WriteLine(tempExipression);
                foreach (CParameter node in ListParam)
                {
                    tempExipression = tempExipression.Replace(node.Name, node.Value);
                }
                tempExipression = tempExipression.Replace("==", "=");
                ExpressionParser.ExpressionParse res = new ExpressionParser.ExpressionParse();
                //Debug.WriteLine(tempExipression);
                res.Expression = tempExipression;
                string mes = res.ExecuteToString();

                if (IsShowUnit)
                {
                    return(mes + cVar.Unit);
                }
                else
                {
                    return(mes);
                }
            }
            else if (ExpressType == LCExpressType.Var)
            {
                if (cVar != null)
                {
                    if (IsShowUnit)
                    {
                        return(cVar.GetStringValue(sText) + cVar.Unit);
                    }

                    else
                    {
                        return(cVar.GetStringValue(sText));
                    }
                }
                else
                {
                    return("VarIsNull");
                }
            }
            else if (ExpressType == LCExpressType.StaticText)
            {
                return(sText);
            }
            return("0");
        }