Example #1
0
        /// <inheritdoc/>
        public override string[] GetExpressions()
        {
            List <string> expressions = new List <string>();

            string[] baseExpressions = base.GetExpressions();
            if (baseExpressions != null)
            {
                expressions.AddRange(baseExpressions);
            }

            if (!String.IsNullOrEmpty(VisibleExpression))
            {
                if (VisibleExpression.StartsWith("[") && VisibleExpression.EndsWith("]"))
                {
                    expressions.Add(VisibleExpression.Substring(1, VisibleExpression.Length - 2));
                }
                else
                {
                    expressions.Add(VisibleExpression);
                }
            }

            if (!String.IsNullOrEmpty(PrintableExpression))
            {
                if (PrintableExpression.StartsWith("[") && PrintableExpression.EndsWith("]"))
                {
                    expressions.Add(PrintableExpression.Substring(1, PrintableExpression.Length - 2));
                }
                else
                {
                    expressions.Add(PrintableExpression);
                }
            }

            return(expressions.ToArray());
        }
Example #2
0
        /// <inheritdoc/>
        public override string[] GetExpressions()
        {
            List <string> expressions = new List <string>();

            string[] baseExpressions = base.GetExpressions();
            if (baseExpressions != null)
            {
                expressions.AddRange(baseExpressions);
            }

            if (!String.IsNullOrEmpty(VisibleExpression))
            {
                if (VisibleExpression.StartsWith("[") && VisibleExpression.EndsWith("]"))
                {
                    string tempExpression = VisibleExpression.Substring(1, VisibleExpression.Length - 2);
                    int    firstOpen      = tempExpression.IndexOf("[");
                    int    firstClose     = tempExpression.IndexOf("]");
                    int    lastOpen       = tempExpression.LastIndexOf("[");
                    int    lastClose      = tempExpression.LastIndexOf("]");
                    if ((firstOpen < 0 && firstClose >= 0) || (lastOpen >= 0 && lastClose < 0) ||
                        (firstOpen >= 0 && firstClose >= 0 && firstClose < firstOpen) ||
                        (lastOpen >= 0 && lastClose >= 0 && lastOpen > lastClose))
                    {
                        expressions.Add(VisibleExpression);
                    }
                    else
                    {
                        expressions.Add(tempExpression);
                    }
                }
                else
                {
                    expressions.Add(VisibleExpression);
                }
            }

            if (!String.IsNullOrEmpty(PrintableExpression))
            {
                if (PrintableExpression.StartsWith("[") && PrintableExpression.EndsWith("]"))
                {
                    string tempExpression = PrintableExpression.Substring(1, PrintableExpression.Length - 2);
                    int    firstOpen      = tempExpression.IndexOf("[");
                    int    firstClose     = tempExpression.IndexOf("]");
                    int    lastOpen       = tempExpression.LastIndexOf("[");
                    int    lastClose      = tempExpression.LastIndexOf("]");
                    if ((firstOpen < 0 && firstClose >= 0) || (lastOpen >= 0 && lastClose < 0) ||
                        (firstOpen >= 0 && firstClose >= 0 && firstClose < firstOpen) ||
                        (lastOpen >= 0 && lastClose >= 0 && lastOpen > lastClose))
                    {
                        expressions.Add(PrintableExpression);
                    }
                    else
                    {
                        expressions.Add(tempExpression);
                    }
                }
                else
                {
                    expressions.Add(PrintableExpression);
                }
            }

            return(expressions.ToArray());
        }