public async Task <WingmanPatchService> GetPatchService(IEnumerable <WingmanMod> modCollection, string ctxName = null) { var mods = modCollection.ToList(); var ctx = _ctxFactory.CreateContext(ctxName); return(new WingmanPatchService(_assetPatcher, _filePatcher, _fileService, ctx, _modBuilder, mods, _tgtLogger)); }
public async Task <FileInfo> RunBuild(string objName, string rootPath, params BuildInstruction[] contextTargets) { var targets = contextTargets.ToList(); using (var ctx = _contextFactory.CreateContext(objName)) { foreach (var target in targets) { var linked = ctx.AddFromInstruction(target); if (!linked) { _logger.LogError("[bold red]Failed to add folders to context directory![/]"); // Console.ReadLine(); return(null); } } // var buildResult = _runner.RunBuild(null, "packed-files.pak"); (bool Success, FileInfo Output)buildResult = (false, null); // var buildResult = ctx.RunBuild(_runner, "packed-files.pak"); if (buildResult.Success) { _logger.LogInformation($"[bold green]Success![/] Files for {objName.GetFriendlyName()} successfully packed from {targets.Sum(t => t.SourceFiles.Count)} files (in {targets.Count} targets)"); var tempFile = Path.GetTempFileName(); buildResult.Output.CopyTo(tempFile, true); return(new FileInfo(tempFile)); } else { _logger.LogInformation($"[bold white on red]Failed![/] Files from {Directory.GetParent(contextTargets.First().SourceGroup)} not packed successfully. Continuing..."); return(null); } } }
public async Task <IBuildService> GetBuild(string?buildId) { return(new PackBuildService(_buildContextFactory.CreateContext(buildId), _buildLogger, _pakFileProvider)); }