VortexCompiler include Properties

This commit is contained in:
erri120 2019-11-17 15:30:06 +01:00
parent c22cc20fc8
commit 24378ac553
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135
5 changed files with 27 additions and 22 deletions

View File

@ -12,6 +12,9 @@ namespace Wabbajack.Lib
{
public abstract class ACompiler
{
public string ModListName, ModListAuthor, ModListDescription, ModListImage, ModListWebsite, ModListReadme;
public string WabbajackVersion;
public StatusUpdateTracker UpdateTracker { get; protected set; }
public WorkQueue Queue { get; protected set; }

View File

@ -2,43 +2,42 @@
using System.Linq;
using Alphaleonis.Win32.Filesystem;
using Newtonsoft.Json;
using Wabbajack.Common;
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>
{
_mo2Compiler.ModListImage, _mo2Compiler.ModListReadme
_compiler.ModListImage, _compiler.ModListReadme
};
if (!files.Any(f => source.AbsolutePath.Equals(f))) return null;
if (!File.Exists(source.AbsolutePath)) return null;
var isBanner = source.AbsolutePath == _mo2Compiler.ModListImage;
var isBanner = source.AbsolutePath == _compiler.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;
_mo2Compiler.ModListImage = result.SourceDataID;
_compiler.ModListImage = result.SourceDataID;
}
else
{
result.Type = PropertyType.Readme;
_mo2Compiler.ModListReadme = result.SourceDataID;
_compiler.ModListReadme = result.SourceDataID;
}
return result;
}
}
public override IState GetState()
{

View File

@ -1,18 +1,12 @@
using CommonMark;
using Compression.BSA;
using System;
using System.CodeDom;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reactive.Subjects;
using System.Reflection;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Wabbajack.Common;
using Wabbajack.Lib.CompilationSteps;
@ -23,7 +17,6 @@ using Wabbajack.Lib.Validation;
using Wabbajack.VirtualFileSystem;
using Directory = Alphaleonis.Win32.Filesystem.Directory;
using File = Alphaleonis.Win32.Filesystem.File;
using FileInfo = Alphaleonis.Win32.Filesystem.FileInfo;
using Path = Alphaleonis.Win32.Filesystem.Path;
namespace Wabbajack.Lib
@ -37,10 +30,7 @@ namespace Wabbajack.Lib
public string MO2Folder;
public string MO2Profile;
public string ModListName, ModListAuthor, ModListDescription, ModListWebsite, ModListImage, ModListReadme;
public string WabbajackVersion;
public Compiler(string mo2_folder)
{

View File

@ -47,9 +47,6 @@ namespace Wabbajack.Lib
DownloadsFolder = downloadsFolder;
StagingFolder = stagingFolder;
ModListOutputFolder = "output_folder";
// TODO: add custom modlist name
ModListOutputFile = $"VORTEX_TEST_MODLIST{ExtensionManager.Extension}";
}
public override void Info(string msg)
@ -84,6 +81,8 @@ namespace Wabbajack.Lib
public override bool Compile()
{
ModListOutputFile = $"{ModListName}{ExtensionManager.Extension}";
Info($"Starting Vortex compilation for {GameName} at {GamePath} with staging folder at {StagingFolder} and downloads folder at {DownloadsFolder}.");
Info("Starting pre-compilation steps");
@ -197,6 +196,12 @@ namespace Wabbajack.Lib
ModList = new ModList
{
Name = ModListName ?? $"Vortex ModList for {Game.ToString()}",
Author = ModListAuthor ?? "",
Description = ModListDescription ?? "",
Readme = ModListReadme ?? "",
Image = ModListImage ?? "",
Website = ModListWebsite ?? "",
Archives = SelectedArchives,
ModManager = ModManager.Vortex,
Directives = InstallDirectives,
@ -411,7 +416,7 @@ namespace Wabbajack.Lib
Utils.Log("Generating compilation stack");
return new List<ICompilationStep>
{
//new IncludePropertyFiles(this),
new IncludePropertyFiles(this),
new IncludeVortexDeployment(this),
new IncludeRegex(this, "^*\\.meta"),
new IgnoreVortex(this),

View File

@ -90,7 +90,15 @@ namespace Wabbajack
GameLocation.TargetPath,
VortexCompiler.TypicalVortexFolder(),
DownloadsLocation.TargetPath,
StagingLocation.TargetPath);
StagingLocation.TargetPath)
{
ModListName = ModlistSettings.ModListName,
ModListAuthor = ModlistSettings.AuthorText,
ModListDescription = ModlistSettings.Description,
ModListImage = ModlistSettings.ImagePath.TargetPath,
ModListWebsite = ModlistSettings.Website,
ModListReadme = ModlistSettings.ReadMeText.TargetPath
};
}
catch (Exception ex)
{