public FrontendServices(
     IFrontendContextAccessor frontendContextAccessor,
     IEngineManager engineManager)
 {
     _frontendContextAccessor = frontendContextAccessor;
     _engineManager = engineManager;
 }
 public Routes(
     RouteCollection routeCollection,
     IEngineManager engineManager)
 {
     _routeCollection = routeCollection;
     _engineManager = engineManager;
 }
Example #3
0
 public Connector()
 {
     _updater       = Locator.Current.GetService <Updater>();
     _cfg           = Locator.Current.GetService <DataManager>();
     _loginManager  = Locator.Current.GetService <LoginManager>();
     _engineManager = Locator.Current.GetService <IEngineManager>();
     _http          = Locator.Current.GetService <HttpClient>();
 }
Example #4
0
        public TestingModuleManager(IEngineManager engineManager)
        {
            _engineManager = engineManager;

            Console.WriteLine(Directory.GetCurrentDirectory());
            using (var archive = new LGPArchive())
            {
                if (!archive.Open("../../../../Data/menu/menu_us.lgp"))
                {
                    Console.WriteLine("Failed to open menu_us");
                }
                else
                {
                    Console.WriteLine("Opened lgp");

                    var file = archive.Find("pcloud.tex");
                    if (file == null)
                    {
                        Console.WriteLine("Failed to find pcloud.text");
                    }
                    else
                    {
                        if (file.GetType() == typeof(TexFile))
                        {
                            Console.WriteLine("Instance of texfile");
                            var _texFile = (TexFile)file;
                            _image = _engineManager.CreateImage(_texFile.GetTextureFormat(), _texFile.GetTextureBuffer());
                        }
                    }
                }
            }
            using (var archive = new LGPArchive())
            {
                if (!archive.Open("../../../../Data/midi/ygm.lgp"))
                {
                    Console.WriteLine("Failed to open ygm midi lgp");
                }
                else
                {
                    var file = archive.Find("lb2.mid");
                    if (file == null)
                    {
                        Console.WriteLine("Failed to find chu.mid");
                    }
                    else
                    {
                        if (file.GetType() == typeof(MidiFile))
                        {
                            Console.WriteLine("Instance of midi");
                            var _midiFile = (MidiFile)file;
                            _audioMgr = new AudioManager();
                            _audioMgr.SetSoundFont("MuseScore_General.sf2");
                            _audioMgr.PlayMidi(_midiFile.GetBuffer());
                        }
                    }
                }
            }
        }
Example #5
0
 public SandboxSystem(IAssetStore assetStore, IEngineManager engineManager, ISceneLoader sceneLoader, ISceneManager sceneManager,
                      IAudioBackend audioBackend)
 {
     _assetStore    = assetStore;
     _engineManager = engineManager;
     _sceneLoader   = sceneLoader;
     _sceneManager  = sceneManager;
     _audioPlayer   = audioBackend.AudioPlayer;
 }
Example #6
0
        public Engine(
            Configuration configuration,
            IAudioBackend audioBackend,
            IInputBackend inputBackend,
            IRenderingBackend renderingBackend,
            IGame game)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (audioBackend == null)
            {
                throw new ArgumentNullException(nameof(audioBackend));
            }
            if (inputBackend == null)
            {
                throw new ArgumentNullException(nameof(inputBackend));
            }
            if (renderingBackend == null)
            {
                throw new ArgumentNullException(nameof(renderingBackend));
            }
            if (game == null)
            {
                throw new ArgumentNullException(nameof(game));
            }

            Log.Info("Initializing engine components.");
            var containerBuilder = new ContainerBuilder();

            CommonModules.RegisterAll(containerBuilder);
            EngineModules.RegisterAll(containerBuilder);

            containerBuilder.RegisterInstance(configuration.Core).As <CoreConfiguration>().SingleInstance();
            containerBuilder.RegisterInstance(configuration.Physics).As <PhysicsConfiguration>().SingleInstance();
            containerBuilder.RegisterInstance(configuration.Rendering).As <RenderingConfiguration>().SingleInstance();

            containerBuilder.RegisterInstance(audioBackend).As <IAudioBackend>().SingleInstance();
            containerBuilder.RegisterInstance(inputBackend).As <IInputBackend>().SingleInstance();
            containerBuilder.RegisterInstance(renderingBackend).As <IRenderingBackend>().SingleInstance();

            var componentsRegistry = new ComponentsRegistry(containerBuilder);

            game.RegisterComponents(componentsRegistry);

            _container     = containerBuilder.Build();
            _lifetimeScope = _container.BeginLifetimeScope();

            RunStartUpTasks();

            _gameLoop      = _lifetimeScope.Resolve <IGameLoop>();
            _engineManager = _lifetimeScope.Resolve <IEngineManager>();
            Log.Info("Engine components initialized.");
        }
Example #7
0
 protected override async Task <int> ExecuteEngineAsync(
     CommandContext commandContext,
     TSettings commandSettings,
     IEngineManager engineManager)
 {
     using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource())
     {
         return(await engineManager.ExecuteAsync(cancellationTokenSource)
             ? (int)ExitCode.Normal
             : (int)ExitCode.ExecutionError);
     }
 }
        protected virtual void SetPipelines(
            CommandContext commandContext,
            TSettings commandSettings,
            IEngineManager engineManager)
        {
            PipelinesCommandSettings buildSettings = commandSettings as PipelinesCommandSettings ?? commandContext.Data as PipelinesCommandSettings;

            if (buildSettings != null)
            {
                engineManager.Pipelines       = buildSettings.Pipelines;
                engineManager.NormalPipelines = buildSettings.Pipelines == null || buildSettings.Pipelines.Length == 0 || buildSettings.NormalPipelines;
            }
        }
        public BenchmarkSystem(IEngineManager engineManager, ISceneManager sceneManager)
        {
            _engineManager    = engineManager;
            _sceneManager     = sceneManager;
            _benchmarkResults = new BenchmarkResults();

            AddBenchmark("Empty scene", "EmptyScene");
            AddBenchmark("10K entities with no components", "EntitiesWithNoComponents");
            AddBenchmark("1000 static sprites", "StaticSprites");
            AddBenchmark("1000 moving sprites", "MovingSprites");
            AddBenchmark("1000 animated sprites", "AnimatedSprites");
            AddBenchmark("200 moving colliders", "MovingColliders");
            AddBenchmark("4000 entities spawned/removed per second", "EntitiesThroughput");
        }
Example #10
0
        protected override async Task <int> ExecuteEngineAsync(CommandContext commandContext, NewPostSettings settings,
                                                               IEngineManager engineManager)
        {
            var fileSystem     = engineManager.Engine.FileSystem;
            var dateTime       = DateTime.Now;
            var optimizedTitle = NormalizedPath.OptimizeFileName(settings.Title);
            var rootPath       = fileSystem.GetRootPath();

            if (settings.CreateBranch)
            {
                CreateBranch(rootPath, optimizedTitle, engineManager);
            }

            var filePath = rootPath
                           .Combine($"input/posts/{dateTime:yyyy/MM/}")
                           .GetFilePath($"{optimizedTitle}.md");
            var file = fileSystem.GetFile(filePath);

            var frontMatter = FrontMatter
                              .FromSettings(settings, dateTime)
                              .ToYaml();

            await file.WriteAllTextAsync(frontMatter);


            if (settings.LaunchEditor)
            {
                var args = $"\"{rootPath.FullPath}\" -g \"{filePath}:0\"";
                await Command.RunAsync(
                    "code",
                    args,
                    windowsName : "cmd",
                    windowsArgs : "/c code " + args,
                    noEcho : true);
            }

            engineManager.Engine.Logger.Log(LogLevel.Information, "Wrote new markdown file at {File}", filePath);
            return(0);
        }
Example #11
0
 public Updater()
 {
     _cfg           = Locator.Current.GetService <DataManager>();
     _engineManager = Locator.Current.GetService <IEngineManager>();
     _http          = Locator.Current.GetService <HttpClient>();
 }
 public EngineRunner(IEngineManager engineManager, ILogger logger)
 {
     _engineManager = engineManager;
     _logger = logger;
 }
Example #13
0
        private static void CreateBranch(NormalizedPath rootPath, string optimizedTitle, IEngineManager engineManager)
        {
            using var repo = new Repository(rootPath.FullPath);

            if (repo.Head.FriendlyName != "main" && repo.Head.FriendlyName != "master")
            {
                throw new Exception($"Only branching from main or master is support");
            }

            if (repo.Branches.Any(i => i.FriendlyName == optimizedTitle))
            {
                throw new Exception($"Branch with name \"{optimizedTitle}\" already exists");
            }

            var branchName = $"posts/{optimizedTitle}";

            repo.CreateBranch(branchName);
            engineManager.Engine.Logger.Log(LogLevel.Information, "Created new git branch {Branch}", branchName);
            Commands.Checkout(repo, repo.Branches[branchName]);
            engineManager.Engine.Logger.Log(LogLevel.Information, "Set current git branch to {Branch}", branchName);
        }
Example #14
0
 public WorldModuleManager(IEngineManager engineManager, IMenuModuleManager menuModule, IBattleModuleManager battleModule)
 {
     _engineManager = engineManager;
     _menuModule    = menuModule;
     _battleModule  = battleModule;
 }
Example #15
0
        protected override async Task <int> ExecuteEngineAsync(
            CommandContext commandContext,
            PreviewCommandSettings commandSettings,
            IEngineManager engineManager)
        {
            ExitCode exitCode = ExitCode.Normal;
            ILogger  logger   = engineManager.Engine.Services.GetRequiredService <ILogger <Bootstrapper> >();

            // Execute the engine for the first time
            using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource())
            {
                if (!await engineManager.ExecuteAsync(cancellationTokenSource))
                {
                    return((int)ExitCode.ExecutionError);
                }
            }

            // Start the preview server
            Dictionary <string, string> contentTypes = commandSettings.ContentTypes?.Length > 0
                ? GetContentTypes(commandSettings.ContentTypes)
                : new Dictionary <string, string>();
            ILoggerProvider loggerProvider  = engineManager.Engine.Services.GetRequiredService <ILoggerProvider>();
            IDirectory      outputDirectory = engineManager.Engine.FileSystem.GetOutputDirectory();
            Server          previewServer   = null;

            if (outputDirectory.Exists)
            {
                previewServer = await StartPreviewServerAsync(
                    outputDirectory.Path,
                    commandSettings.Port,
                    commandSettings.ForceExt,
                    commandSettings.VirtualDirectory,
                    !commandSettings.NoReload,
                    contentTypes,
                    loggerProvider,
                    logger);
            }

            // Start the watchers
            ActionFileSystemWatcher inputFolderWatcher = null;

            if (!commandSettings.NoWatch)
            {
                logger.LogInformation("Watching paths(s) {0}", string.Join(", ", engineManager.Engine.FileSystem.InputPaths));
                inputFolderWatcher = new ActionFileSystemWatcher(
                    outputDirectory.Path,
                    engineManager.Engine.FileSystem.GetInputDirectories().Select(x => x.Path),
                    true,
                    "*.*",
                    path =>
                {
                    _changedFiles.Enqueue(path);
                    _messageEvent.Set();
                });
            }

            // Start the message pump

            // Only wait for a key if console input has not been redirected, otherwise it's on the caller to exit
            if (!Console.IsInputRedirected)
            {
                // Start the key listening thread
                Thread thread = new Thread(() =>
                {
                    logger.LogInformation("Hit Ctrl-C to exit");
                    Console.TreatControlCAsInput = true;
                    while (true)
                    {
                        // Would have preferred to use Console.CancelKeyPress, but that bubbles up to calling batch files
                        // The (ConsoleKey)3 check is to support a bug in VS Code: https://github.com/Microsoft/vscode/issues/9347
                        ConsoleKeyInfo consoleKey = Console.ReadKey(true);
                        if (consoleKey.Key == (ConsoleKey)3 || (consoleKey.Key == ConsoleKey.C && (consoleKey.Modifiers & ConsoleModifiers.Control) != 0))
                        {
                            _exit.Set();
                            _messageEvent.Set();
                            break;
                        }
                    }
                })
                {
                    IsBackground = true
                };
                thread.Start();
            }

            // Wait for activity
            while (true)
            {
                _messageEvent.WaitOne(); // Blocks the current thread until a signal
                if (_exit)
                {
                    break;
                }

                // Execute if files have changed
                HashSet <string> changedFiles = new HashSet <string>();
                while (_changedFiles.TryDequeue(out string changedFile))
                {
                    if (changedFiles.Add(changedFile))
                    {
                        logger.LogDebug($"{changedFile} has changed");
                    }
                }
                if (changedFiles.Count > 0)
                {
                    logger.LogInformation($"{changedFiles.Count} files have changed, re-executing");

                    // Reset caches when an error occurs during the previous preview
                    string existingResetCacheSetting = null;
                    bool   setResetCacheSetting      = false;
                    if (exitCode == ExitCode.ExecutionError)
                    {
                        existingResetCacheSetting = engineManager.Engine.Settings.GetString(Keys.ResetCache);
                        setResetCacheSetting      = true;
                        ConfigurationSettings[Keys.ResetCache] = "true";
                    }

                    // If there was an execution error due to reload, keep previewing but clear the cache
                    using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource())
                    {
                        exitCode = await engineManager.ExecuteAsync(cancellationTokenSource)
                            ? ExitCode.Normal
                            : ExitCode.ExecutionError;
                    }

                    // Reset the reset cache setting after removing it
                    if (setResetCacheSetting)
                    {
                        if (existingResetCacheSetting == null)
                        {
                            ConfigurationSettings.Remove(Keys.ResetCache);
                        }
                        {
                            ConfigurationSettings[Keys.ResetCache] = existingResetCacheSetting;
                        }
                    }

                    if (previewServer == null)
                    {
                        if (outputDirectory.Exists)
                        {
                            previewServer = await StartPreviewServerAsync(
                                outputDirectory.Path,
                                commandSettings.Port,
                                commandSettings.ForceExt,
                                commandSettings.VirtualDirectory,
                                !commandSettings.NoReload,
                                contentTypes,
                                loggerProvider,
                                logger);
                        }
                    }
                    else
                    {
                        await previewServer.TriggerReloadAsync();
                    }
                }

                // Check one more time for exit
                if (_exit)
                {
                    break;
                }
                logger.LogInformation("Hit Ctrl-C to exit");
                _messageEvent.Reset();
            }

            // Shutdown
            logger.LogInformation("Shutting down");
            inputFolderWatcher?.Dispose();
            previewServer?.Dispose();

            return((int)exitCode);
        }
Example #16
0
 public BattleModuleManager(IEngineManager engineManager)
 {
     _engineManager = engineManager;
 }
Example #17
0
        protected override async Task <int> ExecuteEngineAsync(
            CommandContext commandContext,
            ServeCommandSettings commandSettings,
            IEngineManager engineManager)
        {
            ExitCode exitCode = ExitCode.Normal;
            ILogger  logger   = engineManager.Engine.Services.GetRequiredService <ILogger <Bootstrapper> >();

            // Set folders
            IFileSystem    fileSystem       = engineManager.Engine.FileSystem;
            NormalizedPath currentDirectory = Environment.CurrentDirectory;
            IDirectory     serveDirectory;

            if (string.IsNullOrEmpty(commandSettings.RootPath))
            {
                fileSystem.RootPath = currentDirectory;
                serveDirectory      = fileSystem.GetOutputDirectory();
            }
            else
            {
                fileSystem.RootPath = currentDirectory.Combine(commandSettings.RootPath);
                serveDirectory      = fileSystem.GetRootDirectory();
            }

            Dictionary <string, string> contentTypes = commandSettings.ContentTypes?.Length > 0
                ? PreviewCommand.GetContentTypes(commandSettings.ContentTypes)
                : new Dictionary <string, string>();
            ILoggerProvider loggerProvider = engineManager.Engine.Services.GetRequiredService <ILoggerProvider>();

            Server            previewServer      = null;
            FileSystemWatcher serveFolderWatcher = null;

            if (serveDirectory.Exists)
            {
                // Starts Preview server
                previewServer = await PreviewCommand.StartPreviewServerAsync(
                    serveDirectory.Path,
                    commandSettings.Port,
                    commandSettings.ForceExt,
                    commandSettings.VirtualDirectory,
                    !commandSettings.NoReload,
                    contentTypes,
                    loggerProvider,
                    logger);

                // Start the watchers
                if (!commandSettings.NoReload)
                {
                    logger.LogInformation("Watching path {0}", serveDirectory.Path);
                    serveFolderWatcher = new FileSystemWatcher(serveDirectory.Path.FullPath, "*.*")
                    {
                        IncludeSubdirectories = true,
                        EnableRaisingEvents   = true
                    };

                    serveFolderWatcher.Changed += OnFileChanged;
                    serveFolderWatcher.Created += OnFileChanged;
                }

                // Start the message pump
                CommandUtilities.WaitForControlC(
                    () =>
                {
                    _exit.Set();
                    _messageEvent.Set();
                },
                    logger);

                // Wait for activity
                while (true)
                {
                    _messageEvent.WaitOne(); // Blocks the current thread until a signal
                    if (_exit)
                    {
                        break;
                    }

                    // Execute if files have changed
                    HashSet <string> changedFiles = new HashSet <string>();
                    while (_changedFiles.TryDequeue(out string changedFile))
                    {
                        if (changedFiles.Add(changedFile))
                        {
                            logger.LogDebug($"{changedFile} has changed");
                        }
                    }

                    if (changedFiles.Count > 0)
                    {
                        logger.LogInformation($"{changedFiles.Count} files have changed, re-loading");
                        await previewServer.TriggerReloadAsync();
                    }

                    // Check one more time for exit
                    if (_exit)
                    {
                        break;
                    }
                    logger.LogInformation("Hit Ctrl-C to exit");
                    _messageEvent.Reset();
                }
            }
            else
            {
                logger.LogError($"Directory {serveDirectory.Path} does not exist.");
            }

            // Shutdown
            logger.LogInformation("Shutting down");

            if (serveFolderWatcher != null)
            {
                serveFolderWatcher.EnableRaisingEvents = false;
                serveFolderWatcher.Changed            -= OnFileChanged;
                serveFolderWatcher.Created            -= OnFileChanged;
                serveFolderWatcher.Dispose();
            }

            previewServer?.Dispose();

            return((int)exitCode);
        }
 public MenuModuleManager(IEngineManager engineManager)
 {
     _engineManager = engineManager;
 }
 public BackupJob(IEngineManager engineManager, string version = null)
 {
     this.EngineManager = engineManager;
     this.version = version;
 }
Example #20
0
 public LiturgieDatabase(IEngineManager database)
 {
     _databases = database;
 }
 public AssociativyGraphLinksTypePartSettingsHooks(IEngineManager engineManager)
 {
     _engineManager = engineManager;
 }
 public LiturgieDatabase(IEngineManager<FileEngineSetSettings> database)
 {
     _databases = database;
 }
Example #23
0
        protected override async Task <int> ExecuteEngineAsync(CommandContext commandContext,
                                                               PngCompressSettings commandSettings,
                                                               IEngineManager engineManager)
        {
            var tinyPngKey = Environment.GetEnvironmentVariable("TinyPngKey") ??
                             throw new Exception(
                                       "TinyPng key not found. Expected value for environment variable \"TinyPngKey\"");

            var rootPath = engineManager.Engine.FileSystem.RootPath.FullPath;

            using var repo = new Repository(rootPath);
            var status = repo.RetrieveStatus();

            var modifiedPngs = status
                               .Where(_ => Path.HasExtension(".png"))
                               .Select(i => new NormalizedPath(Path.Combine(rootPath, i.FilePath)))
                               .ToImmutableList();

            var pngCompressor = new TinyPngClient(tinyPngKey);

            var pngs = engineManager.Engine.FileSystem
                       .GetInputFiles("**/*.png")
                       .Select(i => i.Path)
                       .Where(i => commandSettings.AllFiles || modifiedPngs.Contains(i))
                       .ToImmutableList();

            var totalPre  = 0L;
            var totalPost = 0L;

            var message = commandSettings.AllFiles ? "all files" : "checked out files";

            engineManager.Engine.Logger.Log(LogLevel.Information, "Beginning compression on {FileTypes}", message);

            foreach (var png in pngs)
            {
                var preSize = engineManager.Engine.FileSystem.GetFile(png.FullPath).Length;
                totalPre += preSize;

                await pngCompressor
                .Compress(png.FullPath)
                .Download()
                .SaveImageToDisk(png.FullPath);

                var postSize = engineManager.Engine.FileSystem.GetFile(png.FullPath).Length;
                totalPost += postSize;

                var percentCompressed = 1 - postSize / (decimal)preSize;
                engineManager.Engine.Logger.Log(LogLevel.Information,
                                                "Compressed {Path}. Reduced from {PreSize} to {PostSize} ({PercentCompressed:P})",
                                                png.Name,
                                                ByteSize.FromBytes(preSize).ToString(),
                                                ByteSize.FromBytes(postSize).ToString(),
                                                percentCompressed);
            }

            engineManager.Engine.Logger.Log(LogLevel.Information,
                                            "Compression complete. Reduced from {PreSize} to {PostSize}",
                                            ByteSize.FromBytes(totalPre).ToString(),
                                            ByteSize.FromBytes(totalPost).ToString());

            return(0);
        }
        protected override async Task <int> ExecuteEngineAsync(
            CommandContext commandContext,
            PreviewCommandSettings commandSettings,
            IEngineManager engineManager)
        {
            SetPipelines(commandContext, commandSettings, engineManager);

            ExitCode exitCode = ExitCode.Normal;
            ILogger  logger   = engineManager.Engine.Services.GetRequiredService <ILogger <Bootstrapper> >();

            // Execute the engine for the first time
            using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource())
            {
                if (!await engineManager.ExecuteAsync(cancellationTokenSource))
                {
                    return((int)ExitCode.ExecutionError);
                }
            }

            // Start the preview server
            Dictionary <string, string> contentTypes = commandSettings.ContentTypes?.Length > 0
                ? GetContentTypes(commandSettings.ContentTypes)
                : new Dictionary <string, string>();
            ILoggerProvider loggerProvider  = engineManager.Engine.Services.GetRequiredService <ILoggerProvider>();
            IDirectory      outputDirectory = engineManager.Engine.FileSystem.GetOutputDirectory();
            Server          previewServer   = null;

            if (outputDirectory.Exists)
            {
                previewServer = await StartPreviewServerAsync(
                    outputDirectory.Path,
                    commandSettings.Port,
                    commandSettings.ForceExt,
                    commandSettings.VirtualDirectory,
                    !commandSettings.NoReload,
                    contentTypes,
                    loggerProvider,
                    logger);
            }

            // Start the watchers
            ActionFileSystemWatcher inputFolderWatcher = null;

            if (!commandSettings.NoWatch)
            {
                logger.LogInformation("Watching paths(s) {0}", string.Join(", ", engineManager.Engine.FileSystem.InputPaths));
                inputFolderWatcher = new ActionFileSystemWatcher(
                    outputDirectory.Path,
                    engineManager.Engine.FileSystem.GetInputDirectories().Select(x => x.Path),
                    true,
                    "*.*",
                    path =>
                {
                    _changedFiles.Enqueue(path);
                    _messageEvent.Set();
                });
            }

            // Start the message pump
            CommandUtilities.WaitForControlC(
                () =>
            {
                _exit.Set();
                _messageEvent.Set();
            },
                logger);

            // Wait for activity
            while (true)
            {
                _messageEvent.WaitOne(); // Blocks the current thread until a signal
                if (_exit)
                {
                    break;
                }

                // Execute if files have changed
                HashSet <string> changedFiles = new HashSet <string>();
                while (_changedFiles.TryDequeue(out string changedFile))
                {
                    if (changedFiles.Add(changedFile))
                    {
                        logger.LogDebug($"{changedFile} has changed");
                    }
                }
                if (changedFiles.Count > 0)
                {
                    logger.LogInformation($"{changedFiles.Count} files have changed, re-executing");

                    // Reset caches when an error occurs during the previous preview
                    string existingResetCacheSetting = null;
                    bool   setResetCacheSetting      = false;
                    if (exitCode == ExitCode.ExecutionError)
                    {
                        existingResetCacheSetting = engineManager.Engine.Settings.GetString(Keys.ResetCache);
                        setResetCacheSetting      = true;
                        ConfigurationSettings[Keys.ResetCache] = "true";
                    }

                    // If there was an execution error due to reload, keep previewing but clear the cache
                    using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource())
                    {
                        exitCode = await engineManager.ExecuteAsync(cancellationTokenSource)
                            ? ExitCode.Normal
                            : ExitCode.ExecutionError;
                    }

                    // Reset the reset cache setting after removing it
                    if (setResetCacheSetting)
                    {
                        if (existingResetCacheSetting == null)
                        {
                            ConfigurationSettings.Remove(Keys.ResetCache);
                        }
                        {
                            ConfigurationSettings[Keys.ResetCache] = existingResetCacheSetting;
                        }
                    }

                    if (previewServer == null)
                    {
                        if (outputDirectory.Exists)
                        {
                            previewServer = await StartPreviewServerAsync(
                                outputDirectory.Path,
                                commandSettings.Port,
                                commandSettings.ForceExt,
                                commandSettings.VirtualDirectory,
                                !commandSettings.NoReload,
                                contentTypes,
                                loggerProvider,
                                logger);
                        }
                    }
                    else
                    {
                        await previewServer.TriggerReloadAsync();
                    }
                }

                // Check one more time for exit
                if (_exit)
                {
                    break;
                }
                logger.LogInformation("Hit Ctrl-C to exit");
                _messageEvent.Reset();
            }

            // Shutdown
            logger.LogInformation("Shutting down");
            inputFolderWatcher?.Dispose();
            previewServer?.Dispose();

            return((int)exitCode);
        }
Example #25
0
 protected override void SetPipelines(CommandContext commandContext, DeployCommandSettings commandSettings, IEngineManager engineManager)
 {
     engineManager.Pipelines       = engineManager.Engine.Pipelines.Where(x => x.Value.Deployment).Select(x => x.Key).ToArray();
     engineManager.NormalPipelines = !commandSettings.OnlyDeploy;
 }
 protected abstract Task <int> ExecuteEngineAsync(CommandContext commandContext, TSettings commandSettings, IEngineManager engineManager);
Example #27
0
 public OptionsTabViewModel()
 {
     Cfg            = Locator.Current.GetService <DataManager>();
     _engineManager = Locator.Current.GetService <IEngineManager>();
 }
 public MiniGameModuleManager(IEngineManager engineManager)
 {
     _engineManager = engineManager;
 }