コード例 #1
0
        protected override async Task PerformInternal(CommandParametersModel parameters)
        {
            string replacementText = await this.ReplaceStringWithSpecialModifiers(this.ReplacementText, parameters);

            replacementText = await this.ProcessStringFunction(replacementText, "removespaces", (text) => { return(Task.FromResult(text.Replace(" ", string.Empty))); });

            replacementText = await this.ProcessStringFunction(replacementText, "removecommas", (text) => { return(Task.FromResult(text.Replace(",", string.Empty))); });

            replacementText = await this.ProcessStringFunction(replacementText, "tolower", (text) => { return(Task.FromResult(text.ToLower())); });

            replacementText = await this.ProcessStringFunction(replacementText, "toupper", (text) => { return(Task.FromResult(text.ToUpper())); });

            replacementText = await this.ProcessStringFunction(replacementText, "length", (text) => { return(Task.FromResult(text.Length.ToString())); });

            if (this.ShouldProcessMath)
            {
                replacementText = MathHelper.ProcessMathEquation(replacementText).ToString();
            }

            if (this.MakeGloballyUsable)
            {
                SpecialIdentifierStringBuilder.AddGlobalSpecialIdentifier(this.SpecialIdentifierName, replacementText);
            }
            else
            {
                parameters.SpecialIdentifiers[this.SpecialIdentifierName] = replacementText;
            }
        }