Example #1
0
        static IList <HclElement> GetVariables(string template)
        {
            if (template == null)
            {
                return(new List <HclElement>());
            }

            return(HclParser.HclTemplate.Parse(HclParser.NormalizeLineEndings(template))
                   .Children
                   .Where(child => child.Name == "variable")
                   .ToList());
        }
Example #2
0
 public static bool IsHcl(string template)
 {
     return(!string.IsNullOrWhiteSpace(template) && HclParser.HclTemplate.TryParse(HclParser.NormalizeLineEndings(template)).WasSuccessful);
 }
Example #3
0
        protected string LoadFile(string fileName, string directory = "Cases")
        {
            var templatesPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, directory);

            return(HclParser.NormalizeLineEndings(File.ReadAllText(Path.Combine(templatesPath, fileName))).Trim());
        }