void IEcsRunSystem.Run() { foreach (var index in _filter) { var disableEvent = _filter.Get1(index); var systems = _systemNamesContainer.Systems; if (systems.TryGetValue(disableEvent.SystemsType, out var systemNames)) { foreach (var systemName in systemNames) { _systems.SetRunSystemState(_systems.GetNamedRunSystem(systemName), false); } } } }
void IEcsPreInitSystem.PreInit() { _boardSystemsIndex = _rootSystems.GetNamedRunSystem(_boardSystemsName); }
private static void Run(bool debug, bool whatIf, string directory, double holeDrillTime, double fastenersDrillTime, double endPositionX, double startPointXOffset) // Argument names are important for arguments mapping { ConfigureLogging(debug, whatIf); var logger = LogManager.GetCurrentClassLogger(); logger.Info(Logging.ProgramStarted); if (debug) { logger.Info(Logging.DebugModeActivated); } var world = new EcsWorld(); var systems = new EcsSystems(world); var configurationService = new ConfigurationService(debug, whatIf, directory, new netDxf.Vector2(endPositionX, 0), holeDrillTime, fastenersDrillTime, startPointXOffset); var fileSystemService = new FileSystemService(); var dxfService = new DxfService(); var consoleStayOpenForce = false; systems.Add(new DxfSearchProcessing(() => consoleStayOpenForce = true)) .Add(new DxfLoadProcessing()) .Add(new DxfValidationProcessing(e => consoleStayOpenForce = true)) .Add(new DxfParseProcessing()) .Add(new NcBuildProcessing()) .Add(new NcSaveProcessing(), nameof(NcSaveProcessing)) .Inject(configurationService) .Inject(fileSystemService) .Inject(dxfService); if (whatIf) { logger.Info(Logging.WhatIfModeActivated); var idx = systems.GetNamedRunSystem(nameof(NcSaveProcessing)); systems.SetRunSystemState(idx, false); } try { systems.Init(); systems.Run(); } catch (Exception e) { consoleStayOpenForce = true; logger.Fatal(e); throw; } finally { systems.Destroy(); world.Destroy(); logger.Info(Logging.ProgramFinished); if (consoleStayOpenForce || debug || whatIf) { Console.WriteLine(Logging.PressAnyKeyToExit); Console.Read(); } } }