2019-10-31 02:24:42 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2019-10-30 12:29:06 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Lib.CompilationSteps
|
|
|
|
|
{
|
|
|
|
|
public class IgnoreEndsWith : ACompilationStep
|
|
|
|
|
{
|
|
|
|
|
private readonly string _postfix;
|
2019-10-31 02:24:42 +00:00
|
|
|
|
private readonly string _reason;
|
2019-10-30 12:29:06 +00:00
|
|
|
|
|
2019-11-03 16:45:49 +00:00
|
|
|
|
public IgnoreEndsWith(ACompiler compiler, string postfix) : base(compiler)
|
2019-10-30 12:29:06 +00:00
|
|
|
|
{
|
|
|
|
|
_postfix = postfix;
|
|
|
|
|
_reason = $"Ignored because path ends with {postfix}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Directive Run(RawSourceFile source)
|
|
|
|
|
{
|
|
|
|
|
if (!source.Path.EndsWith(_postfix)) return null;
|
|
|
|
|
var result = source.EvolveTo<IgnoredDirectly>();
|
|
|
|
|
result.Reason = _reason;
|
|
|
|
|
return result;
|
2019-10-31 02:24:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override IState GetState()
|
|
|
|
|
{
|
|
|
|
|
return new State(_postfix);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[JsonObject("IgnoreEndsWith")]
|
|
|
|
|
public class State : IState
|
|
|
|
|
{
|
|
|
|
|
public State(string postfix)
|
|
|
|
|
{
|
|
|
|
|
Postfix = postfix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public State()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Postfix { get; set; }
|
2019-10-30 12:29:06 +00:00
|
|
|
|
|
2019-11-03 16:45:49 +00:00
|
|
|
|
public ICompilationStep CreateStep(ACompiler compiler)
|
2019-10-31 02:24:42 +00:00
|
|
|
|
{
|
|
|
|
|
return new IgnoreEndsWith(compiler, Postfix);
|
|
|
|
|
}
|
2019-10-30 12:29:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-31 02:24:42 +00:00
|
|
|
|
}
|