wabbajack/Wabbajack.DTOs/ModList/Manifest.cs

55 lines
1.4 KiB
C#
Raw Normal View History

2021-09-27 12:42:46 +00:00
using System;
2020-02-01 12:13:12 +00:00
using System.Linq;
2021-09-27 12:42:46 +00:00
using Wabbajack.DTOs.Directives;
using Wabbajack.DTOs.JsonConverters;
2020-02-01 12:13:12 +00:00
2021-10-23 16:51:17 +00:00
namespace Wabbajack.DTOs;
[JsonName("Manifest")]
public class Manifest
2020-02-01 12:13:12 +00:00
{
2021-10-23 16:51:17 +00:00
public readonly string Author;
public readonly string Description;
public readonly long DownloadSize;
public readonly Game GameType;
public readonly long InstallSize;
public readonly string Name;
public readonly Version Version;
// Enum toString for better parsing in other software
public string GameName;
public bool IsNSFW;
public Manifest(ModList modlist)
2020-02-01 12:13:12 +00:00
{
2021-10-23 16:51:17 +00:00
Name = modlist.Name;
Version = modlist.Version;
Author = modlist.Author;
Description = modlist.Description;
2020-02-01 12:13:12 +00:00
2021-10-23 16:51:17 +00:00
GameType = modlist.GameType;
GameName = GameType.ToString();
2020-02-01 12:13:12 +00:00
2021-10-23 16:51:17 +00:00
DownloadSize = modlist.Archives.Sum(a => a.Size);
InstallSize = modlist.Directives.Sum(d => d.Size);
2021-10-23 16:51:17 +00:00
IsNSFW = modlist.IsNSFW;
2020-02-01 12:13:12 +00:00
2021-10-23 16:51:17 +00:00
// meta is being omitted due to it being useless and not very space friendly
Archives = modlist.Archives.Select(a => new Archive
2020-02-01 12:13:12 +00:00
{
2021-10-23 16:51:17 +00:00
State = a.State,
Hash = a.Hash,
Name = a.Name,
Size = a.Size
}).ToArray();
InlinedFiles = modlist.Directives.OfType<InlineFile>().ToArray();
2020-02-01 12:13:12 +00:00
}
2021-10-23 16:51:17 +00:00
public Archive[] Archives { get; set; }
public InlineFile[] InlinedFiles { get; set; }
2021-09-27 12:42:46 +00:00
}