Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace PandoraBox
- {
- public class IncPlugin : IPluginMacro
- {
- Regex _block = new Regex(@"\{INC\((\-?\d+)\)\}(.*?){/INC}", RegexOptions.Compiled | RegexOptions.Singleline);
- public string Execute(string template, PluginMacroArgs args)
- {
- template = _block.Replace(template, delegate(Match match)
- {
- int ch = int.Parse(match.Groups[1].Value);
- int num = int.Parse(match.Groups[2].Value);
- return (num + ch).ToString();
- });
- return template;
- }
- public ushort Level
- {
- get { return 3; }
- }
- public String Name
- {
- get { return "Макрос, изменяющий внутреннее число"; }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment