mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Use IncludeRegex("splash.png") instead of a new class
This commit is contained in:
parent
db2494649e
commit
fd6426a2f8
@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public class IncludeSplashScreen : MO2CompilationStep
|
||||
{
|
||||
private readonly string _splash;
|
||||
|
||||
private readonly AbsolutePath _sourcePath;
|
||||
private List<AbsolutePath> _splashPath = new List<AbsolutePath>();
|
||||
private readonly bool _splashExists;
|
||||
|
||||
public IncludeSplashScreen(ACompiler compiler) : base(compiler)
|
||||
{
|
||||
_splash = "splash.png";
|
||||
_sourcePath = compiler.SourcePath;
|
||||
string rootDirectory = (string)_sourcePath;
|
||||
try
|
||||
{
|
||||
_splashExists = File.Exists(((String)Directory.EnumerateFiles(rootDirectory, _splash).ToList().First()));
|
||||
|
||||
_splashPath.Concat(Directory.EnumerateFiles(rootDirectory, _splash)
|
||||
.Select(str => (AbsolutePath)str)
|
||||
.ToList());
|
||||
}
|
||||
catch
|
||||
{
|
||||
_splashExists = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (_splashExists)
|
||||
{
|
||||
foreach (var folderpath in _splashPath)
|
||||
{
|
||||
if (!source.AbsolutePath.InFolder(folderpath)) continue;
|
||||
var result = source.EvolveTo<InlineFile>();
|
||||
result.SourceDataID = await _compiler.IncludeFile(source.AbsolutePath);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -451,7 +451,6 @@ namespace Wabbajack.Lib
|
||||
new DirectMatch(this),
|
||||
new IncludeTaggedMods(this, Consts.WABBAJACK_INCLUDE),
|
||||
new IncludeTaggedFolders(this, Consts.WABBAJACK_INCLUDE),
|
||||
new IncludeSplashScreen(this),
|
||||
new IgnoreEndsWith(this, ".pyc"),
|
||||
new IgnoreEndsWith(this, ".log"),
|
||||
new DeconstructBSAs(
|
||||
@ -467,7 +466,7 @@ namespace Wabbajack.Lib
|
||||
// Don't know why, but this seems to get copied around a bit
|
||||
new IgnoreEndsWith(this, "HavokBehaviorPostProcess.exe"),
|
||||
// Theme file MO2 downloads somehow
|
||||
new IgnoreEndsWith(this, "splash.png"),
|
||||
new IncludeRegex(this, "splash.png"),
|
||||
// File to force MO2 into portable mode
|
||||
new IgnoreEndsWith(this, "portable.txt"),
|
||||
new IgnoreEndsWith(this, ".bin"),
|
||||
|
Loading…
Reference in New Issue
Block a user