public string Liquidize(string template) { Context["schema"] = new JSchemaDrop(CurrentSchema); Context.GetTracer().Info("[WHEGNJHKOQPA] Liquidizing template: " + template); if (RenderParameters == null) { RenderParameters = new RenderParameters { Context = Context, Filters = new[] { typeof(ClassNameFilters), typeof(CollectionFilters), typeof(TextFilters), }, LocalVariables = Hash.FromAnonymousObject(new { schema = new JSchemaDrop(CurrentSchema), }), RethrowErrors = true, }; } if (template.EndsWith(".dlq") && template.IndexOfAny(Path.GetInvalidPathChars()) < 0) { Context.GetTracer().Info("[WHGNJFIUQYU] Loading template contents from: " + template); template = TemplateResolver.GetTemplateContents(template) ?? $"[XQLGFTZHTD] Template not found: {template}"; } if (template != null) { // tags that sit alone on a line are moved to the line above to avoid excessive whitespace template = Regex.Replace(template, @"(?m)^\s+({%[^{%]+%})\s*$", "$1"); } var parsedTemplate = Template.Parse(template); return(parsedTemplate.Render(RenderParameters)); }
public override void Render(Context context, TextWriter result) { var hash = context[FileAndFolderOutputHash] as Hash; try { object parentFolder = null; if (hash == null || !hash.TryGetValue(FolderTag.CurrentFolderVariableName, out parentFolder)) { parentFolder = Directory.GetCurrentDirectory(); } string unpackDirectory = parentFolder.ToString(); Stream zipStream; if (!Path.IsPathRooted(ZipFileName)) { zipStream = TemplateResolver.GetTemplateStream(ZipFileName); } else { zipStream = File.OpenRead(ZipFileName); } using (ZipFile zip = ZipFile.Read(zipStream)) { foreach (ZipEntry file in zip) { file.Extract(unpackDirectory, ExtractExistingFileAction.Throw); } } } catch (Exception x) { throw new WhamException("[JFHBNMQWOPTQW] Unzip error: " + ZipFileName, x); } }