Fixed leftovers

This commit is contained in:
erri120 2019-11-11 21:05:23 +01:00 committed by Timothy Baldridge
parent f7ee563095
commit c6b4155126
2 changed files with 14 additions and 8 deletions

View File

@ -7,31 +7,34 @@ namespace Wabbajack.Lib.CompilationSteps
{
public class IncludePropertyFiles : ACompilationStep
{
private readonly Compiler _mo2Compiler;
public IncludePropertyFiles(ACompiler compiler) : base(compiler)
{
_mo2Compiler = (Compiler) compiler;
}
public override Directive Run(RawSourceFile source)
{
var files = new HashSet<string>
{
_compiler._mo2Compiler.ModListImage, _compiler._mo2Compiler.ModListReadme
_mo2Compiler.ModListImage, _mo2Compiler.ModListReadme
};
if (!files.Any(f => source.AbsolutePath.Equals(f))) return null;
if (!File.Exists(source.AbsolutePath)) return null;
var isBanner = source.AbsolutePath == _compiler._mo2Compiler.ModListImage;
var isBanner = source.AbsolutePath == _mo2Compiler.ModListImage;
//var isReadme = source.AbsolutePath == ModListReadme;
var result = source.EvolveTo<PropertyFile>();
result.SourceDataID = _compiler.IncludeFile(File.ReadAllBytes(source.AbsolutePath));
if (isBanner)
{
result.Type = PropertyType.Banner;
_compiler._mo2Compiler.ModListImage = result.SourceDataID;
_mo2Compiler.ModListImage = result.SourceDataID;
}
else
{
result.Type = PropertyType.Readme;
_compiler._mo2Compiler.ModListReadme = result.SourceDataID;
_mo2Compiler.ModListReadme = result.SourceDataID;
}
return result;

View File

@ -14,9 +14,12 @@ namespace Wabbajack.Lib
{
public class zEditIntegration
{
private static Compiler _mo2Compiler;
public static string FindzEditPath(ACompiler compiler)
{
var executables = compiler._mo2Compiler.MO2Ini.customExecutables;
_mo2Compiler = (Compiler) compiler;
var executables = _mo2Compiler.MO2Ini.customExecutables;
if (executables.size == null) return null;
foreach (var idx in Enumerable.Range(1, int.Parse(executables.size)))
@ -63,7 +66,7 @@ namespace Wabbajack.Lib
_mergesIndexed =
merges.ToDictionary(
m => Path.Combine(compiler._mo2Compiler.MO2Folder, "mods", m.Key.name, m.Key.filename),
m => Path.Combine(_mo2Compiler.MO2Folder, "mods", m.Key.name, m.Key.filename),
m => m.First());
}
@ -89,12 +92,12 @@ namespace Wabbajack.Lib
return new SourcePatch
{
RelativePath = abs_path.RelativeTo(_compiler._mo2Compiler.MO2Folder),
RelativePath = abs_path.RelativeTo(_mo2Compiler.MO2Folder),
Hash = _compiler.VFS[abs_path].Hash
};
}).ToList();
var src_data = result.Sources.Select(f => File.ReadAllBytes(Path.Combine(_compiler._mo2Compiler.MO2Folder, f.RelativePath)))
var src_data = result.Sources.Select(f => File.ReadAllBytes(Path.Combine(_mo2Compiler.MO2Folder, f.RelativePath)))
.ConcatArrays();
var dst_data = File.ReadAllBytes(source.AbsolutePath);