Import from internal git
This commit is contained in:
30
Generator/Controllers/GenerationController.cs
Normal file
30
Generator/Controllers/GenerationController.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Core.Events;
|
||||
using Core.Interfaces;
|
||||
using Core.Process;
|
||||
using Generator.Services;
|
||||
|
||||
namespace Generator.Controllers;
|
||||
|
||||
public class GenerationController : IController
|
||||
{
|
||||
private readonly GenerationService _genService;
|
||||
public DisplayEmitter Emitter { get; set; }
|
||||
|
||||
public GenerationController(DisplayEmitter emitter, GenerationService service)
|
||||
{
|
||||
_genService = service;
|
||||
Emitter = emitter;
|
||||
}
|
||||
|
||||
public async Task Launch(GenerationProcess process)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var task in process) await _genService.Launch(task);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Emitter.Warn(this, $"{e.Message} \n Cause : {e.Source} \n Full stacktrace : \n {e.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user