mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Created new Manifest class
This commit is contained in:
parent
ff7964b797
commit
366ccbc1e1
@ -159,28 +159,10 @@ namespace Wabbajack.Lib
|
||||
Utils.DeleteDirectory(ModListOutputFolder);
|
||||
}
|
||||
|
||||
public void GenerateReport()
|
||||
public void GenerateManifest()
|
||||
{
|
||||
string css;
|
||||
using (var cssStream = Utils.GetEmbeddedResourceStream("Wabbajack.Lib.css-min.css"))
|
||||
{
|
||||
using (var reader = new StreamReader(cssStream))
|
||||
{
|
||||
css = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
using (var fs = File.Open($"{ModList.Name}.md", System.IO.FileMode.Create))
|
||||
{
|
||||
fs.SetLength(0);
|
||||
using (var reporter = new ReportBuilder(fs, ModListOutputFolder))
|
||||
{
|
||||
reporter.Build(this, ModList);
|
||||
}
|
||||
}
|
||||
|
||||
ModList.ReportHTML = "<style>" + css + "</style>"
|
||||
+ CommonMarkConverter.Convert(File.ReadAllText($"{ModList.Name}.md"));
|
||||
var manifest = new Manifest(ModList);
|
||||
manifest.ToJSON(ModListOutputFile + ".manifest.json");
|
||||
}
|
||||
|
||||
public async Task GatherArchives()
|
||||
|
@ -290,7 +290,7 @@ namespace Wabbajack.Lib
|
||||
await ValidateModlist.RunValidation(Queue, ModList);
|
||||
UpdateTracker.NextStep("Generating Report");
|
||||
|
||||
GenerateReport();
|
||||
GenerateManifest();
|
||||
|
||||
UpdateTracker.NextStep("Exporting Modlist");
|
||||
ExportModList();
|
||||
|
51
Wabbajack.Lib/Manifest.cs
Normal file
51
Wabbajack.Lib/Manifest.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib
|
||||
{
|
||||
public class Manifest
|
||||
{
|
||||
public string Name;
|
||||
public string Author;
|
||||
public string Description;
|
||||
|
||||
public Game GameType;
|
||||
// Enum toString for better parsing in other software
|
||||
public string GameName;
|
||||
|
||||
public ModManager ModManager;
|
||||
// Enum toString for better parsing in other software
|
||||
public string ModManagerName;
|
||||
|
||||
public long DownloadSize;
|
||||
public long InstallSize;
|
||||
|
||||
public List<Archive> Archives;
|
||||
|
||||
public Manifest(ModList modlist)
|
||||
{
|
||||
Name = modlist.Name;
|
||||
Author = modlist.Author;
|
||||
Description = modlist.Description;
|
||||
|
||||
GameType = modlist.GameType;
|
||||
GameName = GameType.ToString();
|
||||
|
||||
ModManager = modlist.ModManager;
|
||||
ModManagerName = ModManager.ToString();
|
||||
|
||||
DownloadSize = modlist.DownloadSize;
|
||||
InstallSize = modlist.InstallSize;
|
||||
|
||||
// meta is being omitted due to it being useless and not very space friendly
|
||||
Archives = modlist.Archives.Select(a => new Archive
|
||||
{
|
||||
Hash = a.Hash,
|
||||
Name = a.Name,
|
||||
Size = a.Size,
|
||||
State = a.State
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
}
|
@ -248,7 +248,7 @@ namespace Wabbajack.Lib
|
||||
await ValidateModlist.RunValidation(Queue, ModList);
|
||||
|
||||
UpdateTracker.NextStep("Generating Report");
|
||||
GenerateReport();
|
||||
GenerateManifest();
|
||||
|
||||
UpdateTracker.NextStep("Exporting ModList");
|
||||
ExportModList();
|
||||
|
@ -80,8 +80,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="LibCefHelpers\cefsharp.7z" />
|
||||
<None Remove="css-min.css" />
|
||||
<EmbeddedResource Include="css-min.css" />
|
||||
<None Update="Downloaders\BethesdaNet\bethnetlogin.exe">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
Loading…
Reference in New Issue
Block a user