public override void Interprent(InterpreterContext context)
        {
            string regx = "[A-Z]";
            if (context != null && string.IsNullOrEmpty(context.Output) == false)
            {
                context.Output = Regex.Replace(context.Output, regx, new MatchEvaluator((match) =>
                  {
                      var value = match.Value;
                      return _dict[value];
                  }));
            }

        }
Beispiel #2
0
        static void Main(string[] args)
        {
            List<AbstractExpression> expressions = new List<AbstractExpression>();
            expressions.Add(new ConcreteExpressionA());
            expressions.Add(new ConcreteExpressionB());
            var context = new InterpreterContext() { Input = "AAjdu7H6&834 dfGjddf@8fD ;d" };
            foreach (var item in expressions)
            {
                item.Interprent(context);
            }

            Console.WriteLine(context.Input);
            Console.WriteLine(context.Output);

            Console.ReadLine();
        }
 public abstract void Interprent(InterpreterContext context);
Beispiel #4
0
 public abstract void Interprent(InterpreterContext context);