Removed old ReportBuilder and css

This commit is contained in:
erri120 2020-02-01 13:10:51 +01:00
parent 2a7455f275
commit ff7964b797
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135
3 changed files with 0 additions and 220 deletions

View File

@ -1,152 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Wabbajack.Common;
using File = Alphaleonis.Win32.Filesystem.File;
using Path = Alphaleonis.Win32.Filesystem.Path;
namespace Wabbajack.Lib
{
public class ReportBuilder : IDisposable
{
private const int WRAP_SIZE = 80;
private readonly StreamWriter _wtr;
private string _outputFolder;
public ReportBuilder(Stream str, string outputFolder)
{
_outputFolder = outputFolder;
_wtr = new StreamWriter(str);
}
public void Dispose()
{
_wtr.Flush();
_wtr?.Dispose();
}
public void Text(string txt)
{
var offset = 0;
while (offset + WRAP_SIZE < txt.Length)
{
_wtr.WriteLine(txt.Substring(offset, WRAP_SIZE));
offset += WRAP_SIZE;
}
if (offset < txt.Length) _wtr.WriteLine(txt.Substring(offset, txt.Length - offset));
}
public void NoWrapText(string txt)
{
_wtr.WriteLine(txt);
}
public void Build(ACompiler c, ModList lst)
{
MO2Compiler compiler = null;
if (lst.ModManager == ModManager.MO2)
compiler = (MO2Compiler) c;
Text($"### {lst.Name} by {lst.Author} - Installation Summary");
Text($"Build with Wabbajack Version {lst.WabbajackVersion}");
Text(lst.Description);
Text("#### Website:");
NoWrapText($"[{lst.Website}]({lst.Website})");
Text($"Mod Manager: {lst.ModManager.ToString()}");
if (lst.ModManager == ModManager.MO2)
{
var readmeFile = Path.Combine(compiler?.MO2ProfileDir, "readme.md");
if (File.Exists(readmeFile))
File.ReadAllLines(readmeFile)
.Do(NoWrapText);
}
var archiveCount = lst.Archives.Count + lst.Directives.Count(d => d is SteamMeta);
var totalSize = lst.Archives.Sum(a => a.Size);
totalSize += lst.Directives.Where(d => d is SteamMeta).Cast<SteamMeta>().Sum(s => s.Size);
Text(
$"#### Download Summary ({archiveCount} archives - {totalSize.ToFileSizeString()})");
foreach (var archive in SortArchives(lst.Archives))
{
var hash = archive.Hash.FromBase64().ToHex();
NoWrapText(archive.State.GetReportEntry(archive));
NoWrapText($" * Size : {archive.Size.ToFileSizeString()}");
NoWrapText($" * SHA256 : [{hash}](https://www.virustotal.com/gui/file/{hash})");
}
lst.Directives.Where(d => d is SteamMeta).Do(f =>
{
if (!(f is SteamMeta s))
{
return;
}
var link = $"https://steamcommunity.com/sharedfiles/filedetails/?id={s.ItemID}";
var size = ((long)s.Size).ToFileSizeString();
NoWrapText($"* Steam Workshop Item: [{s.ItemID}]({link}) | Size: {size}");
});
Text("\n\n");
var patched = lst.Directives.OfType<PatchedFromArchive>().OrderBy(p => p.To).ToList();
Text($"#### Summary of ({patched.Count}) patches");
foreach (var directive in patched)
NoWrapText(
$"* Applying {SizeForID(directive.PatchID)} byte patch `{directive.FullPath}` to create `{directive.To}`");
var files = lst.Directives.OrderBy(d => d.To).ToList();
Text($"\n\n### Install Plan of ({files.Count}) files");
Text("(ignoring files that are directly copied from archives or listed in the patches section above)");
foreach (var directive in files.OrderBy(f => f.GetType().Name).ThenByDescending(f => f.To))
switch (directive)
{
case PropertyFile i:
NoWrapText($"* `{i.SourceDataID}` as a `{Enum.GetName(typeof(PropertyType),i.Type)}`");
break;
case FromArchive f:
//NoWrapText($"* `{f.To}` from `{f.FullPath}`");
break;
case CleanedESM i:
NoWrapText($"* `{i.To}` by applying a patch to a game ESM ({i.SourceESMHash})");
break;
case RemappedInlineFile i:
NoWrapText($"* `{i.To}` by remapping the contents of an inline file");
break;
case InlineFile i:
NoWrapText($"* `{i.To}` from `{SizeForID(i.SourceDataID).ToFileSizeString()}` file included in modlist");
break;
case CreateBSA i:
NoWrapText(
$"* `{i.To}` by creating a BSA of files found in `{Consts.BSACreationDir}\\{i.TempID}`");
break;
}
var inlined = lst.Directives.OfType<InlineFile>()
.Select(f => (f.To, "inlined", SizeForID(f.SourceDataID)))
.Concat(lst.Directives
.OfType<PatchedFromArchive>()
.Select(f => (f.To, "patched", SizeForID(f.PatchID))))
.Distinct()
.OrderByDescending(f => f.Item3);
NoWrapText("\n\n### Summary of inlined files in this installer");
foreach (var inline in inlined)
{
NoWrapText($"* {inline.Item3.ToFileSizeString()} for {inline.Item2} file {inline.To}");
}
}
private long SizeForID(string id)
{
return File.GetSize(Path.Combine(_outputFolder, id));
}
private IEnumerable<Archive> SortArchives(List<Archive> lstArchives)
{
return lstArchives.OrderByDescending(a => a.Size);
}
}
}

View File

@ -1 +0,0 @@
*{margin:0;padding:0;border:0;font-size:100%;font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;vertical-align:baseline;-webkit-text-size-adjust:none;padding-left:10px;padding-right:10px}ul{list-style:none}q{quotes:none}q:after,q:before{content:'';content:none}h1,h2,h3,h4,h5,h6{color:#555;font-weight:400;line-height:1.5;margin:0}h3{margin:1em 0 1em .5em;text-align:left;text-decoration:underline}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color:inherit;text-decoration:none}h2{font-size:1.85em;font-weight:300}h3{font-size:1.75em}h4{font-size:1.5em}h5{font-size:.9em}h6{font-size:.7em}a{color:#6cc091;text-decoration:underline}a:hover{text-decoration:none}code{background:rgba(144,144,144,.075);border-radius:0;border:solid 1px #dbdbdb;font-family:"Courier New",monospace;font-size:.9em}

View File

@ -1,67 +0,0 @@
* {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
vertical-align: baseline;
-webkit-text-size-adjust: none;
padding-left: 10px;
padding-right: 10px;
}
ul {
list-style: none;
}
q {
quotes: none;
}
q:before , q:after {
content: '';
content: none;
}
h1, h2, h3, h4, h5, h6 {
color: #555;
font-weight: 400;
line-height: 1.5;
margin: 0 0 0 0;
}
h3 {
margin: 1em 0 1em 0.5em;
text-align: left;
text-decoration: underline;
}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
color: inherit;
text-decoration: none;
}
h2 {
font-size: 1.85em;
font-weight: 300;
}
h3 {
font-size: 1.75em;
}
h4 {
font-size: 1.5em;
}
h5 {
font-size: 0.9em;
}
h6 {
font-size: 0.7em;
}
a {
color: #6cc091;
text-decoration: underline;
}
a:hover {
text-decoration: none;
}
code {
background: rgba(144, 144, 144, 0.075);
border-radius: 0;
border: solid 1px #dbdbdb;
font-family: "Courier New", monospace;
font-size: 0.9em;
}