public string GenerateVersionInfoFrom(VersionGenerationContext context) { if (context == null) { throw new ArgumentNullException("context"); } String customFormat = context.VersionGenerationArgument; if (String.IsNullOrEmpty(customFormat)) { throw new ArgumentException("Custom format requested but no format was provided in VersionGenerationArgument.", "context"); } var model = new CustomizedVersionModel(context); SyntaxSettings settings = new SyntaxSettings() { BeginTag = "{", EndTag = "}", }; var templateEngine = new TemplateProcessingEngine(settings); String result = templateEngine.Process(customFormat, model); return result; }
public TemplateProcessingEngine(SyntaxSettings settings) : this() { if (settings == null) { throw new ArgumentNullException("settings"); } this.Patterns = new RegexProvider(settings); }
internal RegexProvider(SyntaxSettings settings) { this.Settings = settings ?? new SyntaxSettings(); if (this.Settings.BeginTag == this.Settings.EndTag) { throw new ArgumentException("BeginTag and EndTag must be different.", "settings"); } InitializePatterns(); }