I18NCommander/I18N Commander/Processor/Generators/Generator.cs
Thorsten Sommer 630f014c1a
Implemented the .NET generator
- Added .NET generator setting for the namespace to use
- Added .NET generator setting to choose the default culture
- Added get child section method to section processor
- Added util to convert any string to a verbatim string literal
- Removed redundant variables on exceptions
2022-10-30 15:49:22 +01:00

26 lines
882 B
C#

namespace Processor.Generators;
public static class Generator
{
private static readonly Dictionary<Type, IGenerator> GENERATORS = new();
private static readonly IGenerator VOID_GENERATOR = new VoidGenerator();
public static IGenerator Get(Type genType) => genType switch
{
Type.DOTNET => GENERATORS.ContainsKey(genType) ? GENERATORS[genType] : GENERATORS[genType] = new DotnetBigFile(),
_ => VOID_GENERATOR,
};
public static async Task TriggerAllAsync()
{
var dotnetEnabled = await AppSettings.GetGeneratorDotnetEnabled();
var godotEnabled = await AppSettings.GetGeneratorGodotEnabled();
if (dotnetEnabled)
await Generator.Get(Type.DOTNET).GenerateAsync();
if(godotEnabled)
await Generator.Get(Type.GODOT).GenerateAsync();
}
}