Removed RunIfGame Step in favor of inline conditional statements

This commit is contained in:
erri120 2019-11-09 19:57:29 +01:00 committed by Timothy Baldridge
parent 791438eea6
commit 9feed217ef
3 changed files with 4 additions and 49 deletions

View File

@ -1,46 +0,0 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Wabbajack.Common;
namespace Wabbajack.Lib.CompilationSteps
{
public class RunIfGame : ACompilationStep
{
private readonly Game _game;
private readonly List<ICompilationStep> _microStack;
public RunIfGame(ACompiler compiler, Game game, List<ICompilationStep> microStack) : base(compiler)
{
_game = game;
_microStack = microStack;
}
public override Directive Run(RawSourceFile source)
{
return _compiler._vortexCompiler?.Game != _game ? null : _compiler._vortexCompiler.RunStack(_microStack, source);
}
public override IState GetState()
{
return new State(_game, _microStack);
}
[JsonArray("RunIfGame")]
public class State : IState
{
public State(Game game, List<ICompilationStep> microStack)
{
Game = game;
MicroStack = microStack;
}
public Game Game { get; set; }
public List<ICompilationStep> MicroStack { get; set; }
public ICompilationStep CreateStep(ACompiler compiler)
{
return new RunIfGame(compiler, Game, MicroStack);
}
}
}
}

View File

@ -176,7 +176,7 @@ namespace Wabbajack.Lib
IEnumerable<ICompilationStep> stack = MakeStack();
Info("Running Compilation Stack");
List<Directive> results = AllFiles.PMap(f => RunStack(stack, f)).ToList();
List<Directive> results = AllFiles.PMap(f => RunStack(stack.Where(s => s != null), f)).ToList();
IEnumerable<NoMatch> noMatch = results.OfType<NoMatch>().ToList();
Info($"No match for {noMatch.Count()} files");
@ -410,9 +410,11 @@ namespace Wabbajack.Lib
//new IncludePropertyFiles(this),
new IncludeVortexDeployment(this),
new IncludeRegex(this, "^*\\.meta"),
Game == Game.DarkestDungeon ? new IncludeRegex(this, "project\\.xml$") : null,
new IgnoreStartsWith(this, " __vortex_staging_folder"),
new IgnoreEndsWith(this, "__vortex_staging_folder"),
new IgnoreEndsWith(this, "project.xml"), // darkest dungeon specific
new IgnoreGameFiles(this),

View File

@ -93,7 +93,6 @@
<Compile Include="CompilationSteps\IncludeAll.cs" />
<Compile Include="CompilationSteps\IncludeAllConfigs.cs" />
<Compile Include="CompilationSteps\IncludeDummyESPs.cs" />
<Compile Include="CompilationSteps\RunIfGame.cs" />
<Compile Include="CompilationSteps\IncludeLootFiles.cs" />
<Compile Include="CompilationSteps\IncludeModIniData.cs" />
<Compile Include="CompilationSteps\IncludeOtherProfiles.cs" />