mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
include mo2 splash screen if present
This commit is contained in:
parent
5e5465396e
commit
fe3da01687
47
Wabbajack.Lib/CompilationSteps/IncludeSplashScreen.cs
Normal file
47
Wabbajack.Lib/CompilationSteps/IncludeSplashScreen.cs
Normal file
@ -0,0 +1,47 @@
|
||||
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;
|
||||
private readonly bool _splashExists;
|
||||
|
||||
public IncludeSplashScreen(ACompiler compiler) : base(compiler)
|
||||
{
|
||||
_splash = "splash.png";
|
||||
_sourcePath = compiler.SourcePath;
|
||||
string rootDirectory = (string)_sourcePath;
|
||||
_splashExists = File.Exists(((String)Directory.EnumerateFiles(rootDirectory, _splash).ToList().First())) ? true : false;
|
||||
|
||||
_splashPath = Directory.EnumerateFiles(rootDirectory, _splash).Select(str => (AbsolutePath)str)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
||||
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,6 +451,7 @@ 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(
|
||||
|
Loading…
Reference in New Issue
Block a user