mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Wabbajack.Lib Compilation steps nullable enabled
This commit is contained in:
parent
64f5531411
commit
86641d01df
@ -184,4 +184,10 @@ dotnet_diagnostic.CS8609.severity = error
|
||||
dotnet_diagnostic.CS8714.severity = error
|
||||
|
||||
# CS8605: Unboxing a possibly null value.
|
||||
dotnet_diagnostic.CS8605.severity = error
|
||||
dotnet_diagnostic.CS8605.severity = error
|
||||
|
||||
# CS8613: Nullability of reference types in return type doesn't match implicitly implemented member.
|
||||
dotnet_diagnostic.CS8613.severity = error
|
||||
|
||||
# CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
|
||||
dotnet_diagnostic.CS8632.severity = error
|
@ -22,7 +22,7 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
public async Task<long> EnqueueJob(string JobName)
|
||||
{
|
||||
var jobtype = AJobPayload.NameToType[JobName];
|
||||
var job = new Job{Priority = Job.JobPriority.High, Payload = (AJobPayload)jobtype.GetConstructor(new Type[0]).Invoke(new object?[0])};
|
||||
var job = new Job{Priority = Job.JobPriority.High, Payload = (AJobPayload)jobtype.GetConstructor(new Type[0]).Invoke(new object[0])};
|
||||
await SQL.EnqueueJob(job);
|
||||
return job.Id;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -11,7 +12,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_compiler = compiler;
|
||||
}
|
||||
|
||||
public abstract ValueTask<Directive> Run(RawSourceFile source);
|
||||
public abstract ValueTask<Directive?> Run(RawSourceFile source);
|
||||
public abstract IState GetState();
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Common.StatusFeed.Errors;
|
||||
using Wabbajack.VirtualFileSystem;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -51,7 +52,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
return new State();
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!Consts.SupportedBSAs.Contains(source.Path.Extension)) return null;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -11,7 +12,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!_compiler.IndexedFiles.TryGetValue(source.Hash, out var found)) return null;
|
||||
var result = source.EvolveTo<FromArchive>();
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -10,7 +11,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
var result = source.EvolveTo<NoMatch>();
|
||||
result.Reason = "No Match in Stack";
|
||||
|
@ -1,10 +1,11 @@
|
||||
using System.Threading.Tasks;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public interface ICompilationStep
|
||||
{
|
||||
ValueTask<Directive> Run(RawSourceFile source);
|
||||
ValueTask<Directive?> Run(RawSourceFile source);
|
||||
IState GetState();
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -25,7 +26,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!source.AbsolutePath.InFolder(_mo2Compiler.MO2ModsFolder)) return null;
|
||||
if (_allEnabledMods.Any(mod => source.AbsolutePath.InFolder(mod)))
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -14,7 +15,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_reason = $"Ignored because path ends with {postfix}";
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!((string)source.Path).EndsWith(_postfix)) return null;
|
||||
var result = source.EvolveTo<IgnoredDirectly>();
|
||||
@ -30,17 +31,13 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
[JsonObject("IgnoreEndsWith")]
|
||||
public class State : IState
|
||||
{
|
||||
public string Postfix { get; set; }
|
||||
|
||||
public State(string postfix)
|
||||
{
|
||||
Postfix = postfix;
|
||||
}
|
||||
|
||||
public State()
|
||||
{
|
||||
}
|
||||
|
||||
public string Postfix { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(ACompiler compiler)
|
||||
{
|
||||
return new IgnoreEndsWith(compiler, Postfix);
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -13,7 +14,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_startDir = Consts.GameFolderFilesDir + "\\";
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!((string)source.Path).StartsWith(_startDir)) return null;
|
||||
var i = source.EvolveTo<IgnoredDirectly>();
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -15,7 +16,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_gameFolder = compiler.GamePath;
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (_gameFolderFilesExists)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -14,7 +15,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_reason = $"Ignored because path contains {_pattern}";
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!((string)source.Path).Contains(_pattern)) return null;
|
||||
var result = source.EvolveTo<IgnoredDirectly>();
|
||||
@ -30,17 +31,13 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
[JsonObject("IgnorePathContains")]
|
||||
public class State : IState
|
||||
{
|
||||
public State()
|
||||
{
|
||||
}
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public State(string pattern)
|
||||
{
|
||||
Pattern = pattern;
|
||||
}
|
||||
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(ACompiler compiler)
|
||||
{
|
||||
return new IgnorePathContains(compiler, Pattern);
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -17,7 +18,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_regex = new Regex(pattern);
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!_regex.IsMatch((string)source.Path)) return null;
|
||||
var result = source.EvolveTo<IgnoredDirectly>();
|
||||
@ -33,17 +34,13 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
[JsonObject("IgnorePattern")]
|
||||
public class State : IState
|
||||
{
|
||||
public State()
|
||||
{
|
||||
}
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public State(string pattern)
|
||||
{
|
||||
Pattern = pattern;
|
||||
}
|
||||
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(ACompiler compiler)
|
||||
{
|
||||
return new IgnoreRegex(compiler, Pattern);
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -14,7 +15,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_reason = string.Format("Ignored because path starts with {0}", _prefix);
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!((string)source.Path).StartsWith(_prefix))
|
||||
{
|
||||
@ -35,17 +36,13 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
[JsonObject("IgnoreStartsWith")]
|
||||
public class State : IState
|
||||
{
|
||||
public State()
|
||||
{
|
||||
}
|
||||
public string Prefix { get; set; }
|
||||
|
||||
public State(string prefix)
|
||||
{
|
||||
Prefix = prefix;
|
||||
}
|
||||
|
||||
public string Prefix { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(ACompiler compiler)
|
||||
{
|
||||
return new IgnoreStartsWith(compiler, Prefix);
|
||||
|
@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -19,7 +20,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
};
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!_cruftFiles.Any(f => source.Path.StartsWith(f))) return null;
|
||||
var result = source.EvolveTo<IgnoredDirectly>();
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -10,7 +11,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
var inline = source.EvolveTo<InlineFile>();
|
||||
inline.SourceDataID = await _compiler.IncludeFile(await source.AbsolutePath.ReadAllBytesAsync());
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -11,7 +12,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!Consts.ConfigFileExtensions.Contains(source.Path.Extension)) return null;
|
||||
var result = source.EvolveTo<InlineFile>();
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -11,7 +12,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (source.AbsolutePath.Extension != Consts.ESP &&
|
||||
source.AbsolutePath.Extension != Consts.ESM) return null;
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -14,7 +15,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_prefix = Consts.LOOTFolderFilesDir + "\\";
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!source.Path.StartsWith(_prefix)) return null;
|
||||
var result = source.EvolveTo<InlineFile>();
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -11,7 +12,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!source.Path.StartsWith("mods\\") || source.Path.FileName != Consts.MetaIni) return null;
|
||||
var e = source.EvolveTo<InlineFile>();
|
||||
|
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -23,7 +24,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!source.AbsolutePath.InFolder(_modProfilesFolder)) return null;
|
||||
if (_profiles.Any(profile => source.AbsolutePath.InFolder(profile))) return null;
|
||||
|
@ -6,17 +6,18 @@ using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.VirtualFileSystem;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public class IncludePatches : ACompilationStep
|
||||
{
|
||||
private readonly Dictionary<RelativePath, IGrouping<RelativePath, VirtualFile>> _indexed;
|
||||
private VirtualFile _bsa;
|
||||
private VirtualFile? _bsa;
|
||||
private Dictionary<RelativePath, VirtualFile> _indexedByName;
|
||||
private MO2Compiler _mo2Compiler;
|
||||
|
||||
public IncludePatches(ACompiler compiler, VirtualFile constructingFromBSA = null) : base(compiler)
|
||||
public IncludePatches(ACompiler compiler, VirtualFile? constructingFromBSA = null) : base(compiler)
|
||||
{
|
||||
_bsa = constructingFromBSA;
|
||||
_mo2Compiler = (MO2Compiler)compiler;
|
||||
@ -30,9 +31,8 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
.ToDictionary(f => f.FullPath.FileName);
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
|
||||
var name = source.File.Name.FileName;
|
||||
RelativePath nameWithoutExt = name;
|
||||
if (name.Extension == Consts.MOHIDDEN)
|
||||
@ -41,7 +41,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
if (!_indexed.TryGetValue(name, out var choices))
|
||||
_indexed.TryGetValue(nameWithoutExt, out choices);
|
||||
|
||||
dynamic modIni = null;
|
||||
dynamic? modIni = null;
|
||||
if (source.AbsolutePath.InFolder(_mo2Compiler.MO2ModsFolder))
|
||||
{
|
||||
if (_bsa == null)
|
||||
@ -55,7 +55,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
var installationFile = (RelativePath)modIni?.General?.installationFile;
|
||||
|
||||
VirtualFile found = null;
|
||||
VirtualFile? found = null;
|
||||
|
||||
// Find based on exact file name + ext
|
||||
if (choices != null)
|
||||
|
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -14,7 +15,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
var files = new HashSet<AbsolutePath>
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -16,7 +17,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_regex = new Regex(pattern);
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!_regex.IsMatch((string)source.Path)) return null;
|
||||
|
||||
@ -33,17 +34,13 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
[JsonObject("IncludeRegex")]
|
||||
public class State : IState
|
||||
{
|
||||
public State()
|
||||
{
|
||||
}
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public State(string pattern)
|
||||
{
|
||||
Pattern = pattern;
|
||||
}
|
||||
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(ACompiler compiler)
|
||||
{
|
||||
return new IncludeRegex(compiler, Pattern);
|
||||
|
@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Common.StoreHandlers;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -18,7 +19,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_game = steamGame;
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!_regex.IsMatch((string)source.Path))
|
||||
return null;
|
||||
@ -31,7 +32,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
if (id == 0)
|
||||
return null;
|
||||
|
||||
SteamWorkshopItem item = null;
|
||||
SteamWorkshopItem? item = null;
|
||||
_game.WorkshopItems.Where(i => i.ItemID == id).Do(i => item = i);
|
||||
if (item == null)
|
||||
return null;
|
||||
|
@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -15,7 +16,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_mo2Compiler = (MO2Compiler) compiler;
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
return Consts.ConfigFileExtensions.Contains(source.Path.Extension) ? await RemapFile(source) : null;
|
||||
}
|
||||
@ -25,7 +26,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
return new State();
|
||||
}
|
||||
|
||||
private async Task<Directive> RemapFile(RawSourceFile source)
|
||||
private async Task<Directive?> RemapFile(RawSourceFile source)
|
||||
{
|
||||
var data = await source.AbsolutePath.ReadAllTextAsync();
|
||||
var originalData = data;
|
||||
|
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -26,7 +27,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
}).Select(kv => $"mods\\{kv.Key}\\");
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!source.Path.StartsWith(Consts.MO2ModFolderName)) return null;
|
||||
foreach (var modpath in _includeDirectly)
|
||||
@ -48,17 +49,13 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
[JsonObject("IncludeTaggedMods")]
|
||||
public class State : IState
|
||||
{
|
||||
public State()
|
||||
{
|
||||
}
|
||||
public string Tag { get; set; }
|
||||
|
||||
public State(string tag)
|
||||
{
|
||||
Tag = tag;
|
||||
}
|
||||
|
||||
public string Tag { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(ACompiler compiler)
|
||||
{
|
||||
return new IncludeTaggedMods(compiler, Tag);
|
||||
|
@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -19,7 +20,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_correctProfiles = _mo2Compiler.SelectedProfiles.Select(p => _mo2Compiler.MO2ProfileDir.Parent.Combine(p)).ToList();
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!_correctProfiles.Any(p => source.AbsolutePath.InFolder(p)))
|
||||
return null;
|
||||
|
@ -3,6 +3,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.Common;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -12,7 +13,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
// * TODO I don't know what this does
|
||||
/*
|
||||
|
@ -4,6 +4,7 @@ using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
using File = Alphaleonis.Win32.Filesystem.File;
|
||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -16,7 +17,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
_mo2Compiler = (MO2Compiler) compiler;
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
var filename = source.Path.FileName;
|
||||
var gameFile = _mo2Compiler.GamePath.Combine((RelativePath)"Data", filename);
|
||||
|
@ -9,40 +9,23 @@ using Directory = Alphaleonis.Win32.Filesystem.Directory;
|
||||
using File = Alphaleonis.Win32.Filesystem.File;
|
||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||
using System.Threading.Tasks;
|
||||
#nullable disable
|
||||
#nullable enable
|
||||
|
||||
namespace Wabbajack.Lib
|
||||
{
|
||||
public class zEditIntegration
|
||||
{
|
||||
private static MO2Compiler _mo2Compiler;
|
||||
|
||||
public static AbsolutePath FindzEditPath(ACompiler compiler)
|
||||
{
|
||||
_mo2Compiler = (MO2Compiler) compiler;
|
||||
var executables = _mo2Compiler.MO2Ini.customExecutables;
|
||||
if (executables.size == null) return default;
|
||||
|
||||
foreach (var idx in Enumerable.Range(1, int.Parse(executables.size)))
|
||||
{
|
||||
var path = (string)executables[$"{idx}\\binary"];
|
||||
if (path == null) continue;
|
||||
|
||||
if (path.EndsWith("zEdit.exe"))
|
||||
return (AbsolutePath)path;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public class IncludeZEditPatches : ACompilationStep
|
||||
{
|
||||
private readonly Dictionary<AbsolutePath, zEditMerge> _mergesIndexed;
|
||||
private readonly Dictionary<AbsolutePath, zEditMerge> _mergesIndexed = new Dictionary<AbsolutePath, zEditMerge>();
|
||||
|
||||
private bool _disabled = true;
|
||||
|
||||
public IncludeZEditPatches(ACompiler compiler) : base(compiler)
|
||||
private MO2Compiler _mo2Compiler;
|
||||
|
||||
public IncludeZEditPatches(MO2Compiler compiler) : base(compiler)
|
||||
{
|
||||
_mo2Compiler = compiler;
|
||||
var zEditPath = FindzEditPath(compiler);
|
||||
var havezEdit = zEditPath != default;
|
||||
|
||||
@ -127,7 +110,24 @@ namespace Wabbajack.Lib
|
||||
_disabled = false;
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive> Run(RawSourceFile source)
|
||||
public static AbsolutePath FindzEditPath(MO2Compiler compiler)
|
||||
{
|
||||
var executables = compiler.MO2Ini.customExecutables;
|
||||
if (executables.size == null) return default;
|
||||
|
||||
foreach (var idx in Enumerable.Range(1, int.Parse(executables.size)))
|
||||
{
|
||||
var path = (string)executables[$"{idx}\\binary"];
|
||||
if (path == null) continue;
|
||||
|
||||
if (path.EndsWith("zEdit.exe"))
|
||||
return (AbsolutePath)path;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (_disabled) return null;
|
||||
if (!_mergesIndexed.TryGetValue(source.AbsolutePath, out var merge))
|
||||
@ -210,14 +210,14 @@ namespace Wabbajack.Lib
|
||||
{
|
||||
public ICompilationStep CreateStep(ACompiler compiler)
|
||||
{
|
||||
return new IncludeZEditPatches(compiler);
|
||||
return new IncludeZEditPatches((MO2Compiler)compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class zEditSettings
|
||||
{
|
||||
public string modManager;
|
||||
public string modManager = string.Empty;
|
||||
public AbsolutePath managerPath;
|
||||
public AbsolutePath modsPath;
|
||||
public AbsolutePath mergePath;
|
||||
@ -225,16 +225,16 @@ namespace Wabbajack.Lib
|
||||
|
||||
public class zEditMerge
|
||||
{
|
||||
public string name;
|
||||
public string filename;
|
||||
public List<zEditMergePlugin> plugins;
|
||||
public string name = string.Empty;
|
||||
public string filename = string.Empty;
|
||||
public List<zEditMergePlugin> plugins = new List<zEditMergePlugin>();
|
||||
|
||||
}
|
||||
|
||||
public class zEditMergePlugin
|
||||
{
|
||||
public string filename;
|
||||
public string dataFolder;
|
||||
public string? filename;
|
||||
public string? dataFolder;
|
||||
}
|
||||
|
||||
public static void VerifyMerges(MO2Compiler compiler)
|
||||
|
Loading…
Reference in New Issue
Block a user