Пример #1
0
            public override string TransformRange(string stringToTransform, string commandContent, Dictionary <string, string> variables)
            {
                int numCyclesLeft = 0;

                if (commandContent != null && commandContent != "")
                {
                    numCyclesLeft = Int32.Parse(commandContent);
                }
                // When there is exactly 1 cycle left, we unencode the command block. The result of this is that the contents will not be evaluated
                // until the last cycle.
                if (numCyclesLeft == 1)
                {
                    stringToTransform = StringTemplate.EncodeCommandBlock(stringToTransform, unencode: true);
                }
                if (numCyclesLeft > 0)
                {
                    return(StringTemplate.CreateReprocessBlock(stringToTransform, numCyclesLeft - 1)); // we are going to delay processing; this allows external variables to be set
                }
                return(StringTemplate.Process(stringToTransform, variables));
            }