For generating a list of additional files included in project ( see https://github.com/helluvamatt/SvgIconGenerator ) I need to generated the list of them – and maybe an enum .
So RSCG_Templating improve with a new attribute ,
[IGenerateDataFromAdditionalFiles(“FileInTemplating”)]
partial class FileInTemplating
{
}
What it does is to send to the template the list of additional files in a variable named pathFiles
See the SCRIBAN example:
//autogenerated by RSCG_Templating from file {{ fileName }} z
namespace {{data.nameSpace}} {
partial class {{data.className}} {
//{{ "test" | string.capitalize }}
public static string GetName(string name){
{{ for file in pathFiles}}
//{{file}}
//first folder: {{file.pathArr[0]}}
if(name == "{{file.name}}"){
return File_{{file.nameNoExt}};
}
if(name == "{{file.nameNoExt}}"){
return File_{{file.nameNoExt}};
}
if(name == "{{file.namePascal}}"){
return File_{{file.nameNoExt}};
}
{{ end }}
throw new System.Exception($"File with name {name} not found");
}
{{ for file in pathFiles}}
//{{file}}
public static string File_{{file.nameNoExt}} => "{{file.name}}";
{{ end }}
}
}
And this is it – you now can have access to the additional files