I18NCommander/I18N Commander/Processor/Generators/Generator.cs

26 lines
882 B
C#
Raw Normal View History

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();
}
}