2019-10-30 12:29:06 +00:00
|
|
|
|
using Alphaleonis.Win32.Filesystem;
|
2019-10-31 02:24:42 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2019-10-30 12:29:06 +00:00
|
|
|
|
using Wabbajack.Common;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Lib.CompilationSteps
|
|
|
|
|
{
|
|
|
|
|
public class IncludeLootFiles : ACompilationStep
|
|
|
|
|
{
|
|
|
|
|
private readonly string _prefix;
|
|
|
|
|
|
|
|
|
|
public IncludeLootFiles(Compiler compiler) : base(compiler)
|
|
|
|
|
{
|
|
|
|
|
_prefix = Consts.LOOTFolderFilesDir + "\\";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Directive Run(RawSourceFile source)
|
|
|
|
|
{
|
|
|
|
|
if (!source.Path.StartsWith(_prefix)) return null;
|
|
|
|
|
var result = source.EvolveTo<InlineFile>();
|
|
|
|
|
result.SourceDataID = _compiler.IncludeFile(File.ReadAllBytes(source.AbsolutePath).ToBase64());
|
|
|
|
|
return result;
|
2019-10-31 02:24:42 +00:00
|
|
|
|
}
|
2019-10-30 12:29:06 +00:00
|
|
|
|
|
2019-10-31 02:24:42 +00:00
|
|
|
|
public override IState GetState()
|
|
|
|
|
{
|
|
|
|
|
return new State();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[JsonObject("IncludeLootFiles")]
|
|
|
|
|
public class State : IState
|
|
|
|
|
{
|
|
|
|
|
public ICompilationStep CreateStep(Compiler compiler)
|
|
|
|
|
{
|
|
|
|
|
return new IncludeLootFiles(compiler);
|
|
|
|
|
}
|
2019-10-30 12:29:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-31 02:24:42 +00:00
|
|
|
|
}
|