Summary description for AspStringBlock.
Пример #1
0
        public static string ParceAsp(string inAsp)
        {
            var outputStrings = new ArrayList();

            var codeSegmentRegex = new Regex(@"<%([^=][\s\S]*?[^\\]|[^=])%>");
            var codeSegments     = codeSegmentRegex.Matches(inAsp);
            var currentPosition  = 0;

            foreach (Match codeSegment in codeSegments)
            {
                var stringBlock = new AspStringBlock(inAsp.Substring(currentPosition, codeSegment.Index - currentPosition), false);
                var codeBlock   = new AspStringBlock(codeSegment.Groups[1].Value, true);
                outputStrings.Add(stringBlock);
                outputStrings.Add(codeBlock);
                currentPosition = codeSegment.Index + codeSegment.Length;
            }
            var lastBlock = new AspStringBlock(inAsp.Substring(currentPosition, inAsp.Length - currentPosition), false);

            outputStrings.Add(lastBlock);

            var output = new StringBuilder();

            foreach (AspStringBlock outputStringBlock in outputStrings)
            {
                output.Append(outputStringBlock.GetOutput());
            }


            return(output.ToString());
        }
        public static string ParceAsp(string inAsp)
        {
            var outputStrings = new ArrayList();

            var codeSegmentRegex = new Regex(@"<%([^=][\s\S]*?[^\\]|[^=])%>");
            var codeSegments = codeSegmentRegex.Matches(inAsp);
            var currentPosition = 0;
            foreach (Match codeSegment in codeSegments)
            {
                var stringBlock = new AspStringBlock(inAsp.Substring(currentPosition, codeSegment.Index - currentPosition), false);
                var codeBlock = new AspStringBlock(codeSegment.Groups[1].Value, true);
                outputStrings.Add(stringBlock);
                outputStrings.Add(codeBlock);
                currentPosition = codeSegment.Index + codeSegment.Length;
            }
            var lastBlock = new AspStringBlock(inAsp.Substring(currentPosition, inAsp.Length - currentPosition), false);
            outputStrings.Add(lastBlock);

            var output = new StringBuilder();
            foreach (AspStringBlock outputStringBlock in outputStrings)
            {
                output.Append(outputStringBlock.GetOutput());
            }

            return output.ToString();
        }