View difference between Paste ID: 0uU6xdDX and bKA0YrmA
SHOW: | | - or go back to the newest paste.
1
using System;
2
using System.Linq;
3
using System.Text.RegularExpressions;
4
5
namespace PandoraBox
6
{    
7
    public class IncPlugin : IPluginMacro
8
    {
9
        Regex _block = new Regex(@"\{INC\((\-?\d+)\)\}(.*?){/INC}", RegexOptions.Compiled | RegexOptions.Singleline);
10
11
        public string Execute(string template, PluginMacroArgs args)
12
        {
13
            template = _block.Replace(template, delegate(Match match)
14
            {
15
                int ch = int.Parse(match.Groups[1].Value);                
16-
				int num = int.Parse(match.Groups[2].Value);                
16+
		int num = int.Parse(match.Groups[2].Value);                
17
                return (num + ch).ToString();
18
            });
19
20
            return template;
21
        }
22
23
        public ushort Level
24
        {
25
            get { return 3; }
26
        }
27
28
        public String Name
29
        {
30
            get { return "Макрос, изменяющий внутреннее число"; }
31
        }
32
    }
33
}