mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Removed Vortex/MO2 compiler reference in ACompiler in favor of casting
This commit is contained in:
parent
3f58803b4d
commit
f7ee563095
@ -12,8 +12,6 @@ namespace Wabbajack.Lib
|
||||
public abstract class ACompiler
|
||||
{
|
||||
public ModManager ModManager;
|
||||
public Compiler _mo2Compiler;
|
||||
public VortexCompiler _vortexCompiler;
|
||||
|
||||
public string GamePath;
|
||||
|
||||
|
@ -13,10 +13,12 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
private readonly IEnumerable<string> _include_directly;
|
||||
private readonly List<ICompilationStep> _microstack;
|
||||
private readonly List<ICompilationStep> _microstackWithInclude;
|
||||
private readonly Compiler _mo2Compiler;
|
||||
|
||||
public DeconstructBSAs(ACompiler compiler) : base(compiler)
|
||||
{
|
||||
_include_directly = _compiler._mo2Compiler.ModInis.Where(kv =>
|
||||
_mo2Compiler = (Compiler) compiler;
|
||||
_include_directly = _mo2Compiler.ModInis.Where(kv =>
|
||||
{
|
||||
var general = kv.Value.General;
|
||||
if (general.notes != null && general.notes.Contains(Consts.WABBAJACK_INCLUDE)) return true;
|
||||
@ -28,16 +30,16 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
_microstack = new List<ICompilationStep>
|
||||
{
|
||||
new DirectMatch(_compiler._mo2Compiler),
|
||||
new IncludePatches(_compiler._mo2Compiler),
|
||||
new DropAll(_compiler._mo2Compiler)
|
||||
new DirectMatch(_mo2Compiler),
|
||||
new IncludePatches(_mo2Compiler),
|
||||
new DropAll(_mo2Compiler)
|
||||
};
|
||||
|
||||
_microstackWithInclude = new List<ICompilationStep>
|
||||
{
|
||||
new DirectMatch(_compiler._mo2Compiler),
|
||||
new IncludePatches(_compiler._mo2Compiler),
|
||||
new IncludeAll(_compiler._mo2Compiler)
|
||||
new DirectMatch(_mo2Compiler),
|
||||
new IncludePatches(_mo2Compiler),
|
||||
new IncludeAll(_mo2Compiler)
|
||||
};
|
||||
}
|
||||
|
||||
@ -61,7 +63,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
var id = Guid.NewGuid().ToString();
|
||||
|
||||
var matches = source_files.PMap(e => _compiler._mo2Compiler.RunStack(stack, new RawSourceFile(e)
|
||||
var matches = source_files.PMap(e => _mo2Compiler.RunStack(stack, new RawSourceFile(e)
|
||||
{
|
||||
Path = Path.Combine(Consts.BSACreationDir, id, e.Paths.Last())
|
||||
}));
|
||||
@ -71,7 +73,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
if (match is IgnoredDirectly)
|
||||
Utils.Error($"File required for BSA {source.Path} creation doesn't exist: {match.To}");
|
||||
_compiler._mo2Compiler.ExtraFiles.Add(match);
|
||||
_mo2Compiler.ExtraFiles.Add(match);
|
||||
}
|
||||
|
||||
CreateBSA directive;
|
||||
|
@ -9,13 +9,15 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
public class IgnoreDisabledMods : ACompilationStep
|
||||
{
|
||||
private readonly IEnumerable<string> _allEnabledMods;
|
||||
private readonly Compiler _mo2Compiler;
|
||||
|
||||
public IgnoreDisabledMods(ACompiler compiler) : base(compiler)
|
||||
{
|
||||
var alwaysEnabled = _compiler._mo2Compiler.ModInis.Where(f => IsAlwaysEnabled(f.Value)).Select(f => f.Key).ToHashSet();
|
||||
_mo2Compiler = (Compiler) compiler;
|
||||
var alwaysEnabled = _mo2Compiler.ModInis.Where(f => IsAlwaysEnabled(f.Value)).Select(f => f.Key).ToHashSet();
|
||||
|
||||
_allEnabledMods = _compiler._mo2Compiler.SelectedProfiles
|
||||
.SelectMany(p => File.ReadAllLines(Path.Combine(_compiler._mo2Compiler.MO2Folder, "profiles", p, "modlist.txt")))
|
||||
_allEnabledMods = _mo2Compiler.SelectedProfiles
|
||||
.SelectMany(p => File.ReadAllLines(Path.Combine(_mo2Compiler.MO2Folder, "profiles", p, "modlist.txt")))
|
||||
.Where(line => line.StartsWith("+") || line.EndsWith("_separator"))
|
||||
.Select(line => line.Substring(1))
|
||||
.Concat(alwaysEnabled)
|
||||
|
@ -11,7 +11,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
public IgnoreVortex(ACompiler compiler) : base(compiler)
|
||||
{
|
||||
_vortex = compiler._vortexCompiler;
|
||||
_vortex = (VortexCompiler) compiler;
|
||||
}
|
||||
|
||||
public override Directive Run(RawSourceFile source)
|
||||
|
@ -8,10 +8,13 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
public class IgnoreOtherProfiles : ACompilationStep
|
||||
{
|
||||
private readonly IEnumerable<string> _profiles;
|
||||
private readonly Compiler _mo2Compiler;
|
||||
|
||||
public IgnoreOtherProfiles(ACompiler compiler) : base(compiler)
|
||||
{
|
||||
_profiles = compiler._mo2Compiler.SelectedProfiles
|
||||
_mo2Compiler = (Compiler) compiler;
|
||||
|
||||
_profiles = _mo2Compiler.SelectedProfiles
|
||||
.Select(p => Path.Combine("profiles", p) + "\\")
|
||||
.ToList();
|
||||
}
|
||||
|
@ -7,8 +7,11 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public class IncludeStubbedConfigFiles : ACompilationStep
|
||||
{
|
||||
private readonly Compiler _mo2Compiler;
|
||||
|
||||
public IncludeStubbedConfigFiles(ACompiler compiler) : base(compiler)
|
||||
{
|
||||
_mo2Compiler = (Compiler) compiler;
|
||||
}
|
||||
|
||||
public override Directive Run(RawSourceFile source)
|
||||
@ -26,18 +29,18 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var data = File.ReadAllText(source.AbsolutePath);
|
||||
var originalData = data;
|
||||
|
||||
data = data.Replace(_compiler._mo2Compiler.GamePath, Consts.GAME_PATH_MAGIC_BACK);
|
||||
data = data.Replace(_compiler._mo2Compiler.GamePath.Replace("\\", "\\\\"), Consts.GAME_PATH_MAGIC_DOUBLE_BACK);
|
||||
data = data.Replace(_compiler._mo2Compiler.GamePath.Replace("\\", "/"), Consts.GAME_PATH_MAGIC_FORWARD);
|
||||
data = data.Replace(_mo2Compiler.GamePath, Consts.GAME_PATH_MAGIC_BACK);
|
||||
data = data.Replace(_mo2Compiler.GamePath.Replace("\\", "\\\\"), Consts.GAME_PATH_MAGIC_DOUBLE_BACK);
|
||||
data = data.Replace(_mo2Compiler.GamePath.Replace("\\", "/"), Consts.GAME_PATH_MAGIC_FORWARD);
|
||||
|
||||
data = data.Replace(_compiler._mo2Compiler.MO2Folder, Consts.MO2_PATH_MAGIC_BACK);
|
||||
data = data.Replace(_compiler._mo2Compiler.MO2Folder.Replace("\\", "\\\\"), Consts.MO2_PATH_MAGIC_DOUBLE_BACK);
|
||||
data = data.Replace(_compiler._mo2Compiler.MO2Folder.Replace("\\", "/"), Consts.MO2_PATH_MAGIC_FORWARD);
|
||||
data = data.Replace(_mo2Compiler.MO2Folder, Consts.MO2_PATH_MAGIC_BACK);
|
||||
data = data.Replace(_mo2Compiler.MO2Folder.Replace("\\", "\\\\"), Consts.MO2_PATH_MAGIC_DOUBLE_BACK);
|
||||
data = data.Replace(_mo2Compiler.MO2Folder.Replace("\\", "/"), Consts.MO2_PATH_MAGIC_FORWARD);
|
||||
|
||||
data = data.Replace(_compiler._mo2Compiler.MO2DownloadsFolder, Consts.DOWNLOAD_PATH_MAGIC_BACK);
|
||||
data = data.Replace(_compiler._mo2Compiler.MO2DownloadsFolder.Replace("\\", "\\\\"),
|
||||
data = data.Replace(_mo2Compiler.MO2DownloadsFolder, Consts.DOWNLOAD_PATH_MAGIC_BACK);
|
||||
data = data.Replace(_mo2Compiler.MO2DownloadsFolder.Replace("\\", "\\\\"),
|
||||
Consts.DOWNLOAD_PATH_MAGIC_DOUBLE_BACK);
|
||||
data = data.Replace(_compiler._mo2Compiler.MO2DownloadsFolder.Replace("\\", "/"), Consts.DOWNLOAD_PATH_MAGIC_FORWARD);
|
||||
data = data.Replace(_mo2Compiler.MO2DownloadsFolder.Replace("\\", "/"), Consts.DOWNLOAD_PATH_MAGIC_FORWARD);
|
||||
|
||||
if (data == originalData)
|
||||
return null;
|
||||
|
@ -9,12 +9,13 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
private readonly IEnumerable<string> _includeDirectly;
|
||||
private readonly string _tag;
|
||||
|
||||
private readonly Compiler _mo2Compiler;
|
||||
|
||||
public IncludeTaggedMods(ACompiler compiler, string tag) : base(compiler)
|
||||
{
|
||||
_mo2Compiler = (Compiler) compiler;
|
||||
_tag = tag;
|
||||
_includeDirectly = _compiler._mo2Compiler.ModInis.Where(kv =>
|
||||
_includeDirectly = _mo2Compiler.ModInis.Where(kv =>
|
||||
{
|
||||
var general = kv.Value.General;
|
||||
if (general.notes != null && general.notes.Contains(_tag))
|
||||
|
@ -9,10 +9,12 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
public class IncludeThisProfile : ACompilationStep
|
||||
{
|
||||
private readonly IEnumerable<string> _correctProfiles;
|
||||
private readonly Compiler _mo2Compiler;
|
||||
|
||||
public IncludeThisProfile(ACompiler compiler) : base(compiler)
|
||||
{
|
||||
_correctProfiles = _compiler._mo2Compiler.SelectedProfiles.Select(p => Path.Combine("profiles", p) + "\\").ToList();
|
||||
_mo2Compiler = (Compiler) compiler;
|
||||
_correctProfiles = _mo2Compiler.SelectedProfiles.Select(p => Path.Combine("profiles", p) + "\\").ToList();
|
||||
}
|
||||
|
||||
public override Directive Run(RawSourceFile source)
|
||||
|
@ -8,14 +8,17 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public class PatchStockESMs : ACompilationStep
|
||||
{
|
||||
private readonly Compiler _mo2Compiler;
|
||||
|
||||
public PatchStockESMs(ACompiler compiler) : base(compiler)
|
||||
{
|
||||
_mo2Compiler = (Compiler) compiler;
|
||||
}
|
||||
|
||||
public override Directive Run(RawSourceFile source)
|
||||
{
|
||||
var filename = Path.GetFileName(source.Path);
|
||||
var gameFile = Path.Combine(_compiler._mo2Compiler.GamePath, "Data", filename);
|
||||
var gameFile = Path.Combine(_mo2Compiler.GamePath, "Data", filename);
|
||||
if (!Consts.GameESMs.Contains(filename) || !source.Path.StartsWith("mods\\") ||
|
||||
!File.Exists(gameFile)) return null;
|
||||
|
||||
|
@ -42,8 +42,6 @@ namespace Wabbajack.Lib
|
||||
|
||||
public Compiler(string mo2_folder)
|
||||
{
|
||||
_vortexCompiler = null;
|
||||
_mo2Compiler = this;
|
||||
ModManager = ModManager.MO2;
|
||||
|
||||
MO2Folder = mo2_folder;
|
||||
|
@ -29,9 +29,6 @@ namespace Wabbajack.Lib
|
||||
|
||||
public VortexCompiler(string gameName, string gamePath)
|
||||
{
|
||||
|
||||
_vortexCompiler = this;
|
||||
_mo2Compiler = null;
|
||||
ModManager = ModManager.Vortex;
|
||||
|
||||
// TODO: only for testing
|
||||
|
Loading…
x
Reference in New Issue
Block a user