Exemplo n.º 1
0
        public override void Edit()
        {
            string expression = _sumUpList.Replace(SourceData, "${top}+${bottom}");

            expression = _sumUpList.Replace(expression, "${top}+${bottom}");
            try
            {
                string answer = EvaluateExpression(expression);

                if (ParameterList[0].GetValueOrDefault().Equals("answer", StringComparison.CurrentCultureIgnoreCase))
                {
                    SourceData = answer;
                }
                else if (SourceData.Contains("\n"))
                {
                    SourceData = String.Concat(SourceData, "\n", answer);
                }
                else if (SourceData.Contains("="))
                {
                    SourceData = String.Concat(SourceData, answer);
                }
                else
                {
                    SourceData = String.Concat(SourceData, "=", answer);
                }
            }
            catch (Exception mathErr)
            {
                RespondToExe("Error: " + mathErr.Message);
            }
        }