wabbajack/Wabbajack.Compiler/CompilationSteps/IgnoreExtension.cs

29 lines
781 B
C#
Raw Normal View History

2021-09-27 12:42:46 +00:00
using System.Threading.Tasks;
using Wabbajack.DTOs;
using Wabbajack.DTOs.Directives;
using Wabbajack.Paths;
2021-02-09 05:17:11 +00:00
2021-09-27 12:42:46 +00:00
namespace Wabbajack.Compiler.CompilationSteps
2021-02-09 05:17:11 +00:00
{
public class IgnoreExtension : ACompilationStep
{
private readonly Extension _ext;
private readonly string _reason;
public IgnoreExtension(ACompiler compiler, Extension ext) : base(compiler)
{
_ext = ext;
_reason = $"Ignoring {_ext} files";
}
public override async ValueTask<Directive?> Run(RawSourceFile source)
{
if (source.Path.Extension != _ext)
return null;
var result = source.EvolveTo<IgnoredDirectly>();
result.Reason = _reason;
return result;
}
}
2021-09-27 12:42:46 +00:00
}