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-09-27 12:42:46 +00:00
|
|
|
namespace Wabbajack.DTOs
|
2020-02-01 12:13:12 +00:00
|
|
|
{
|
2020-04-06 20:48:54 +00:00
|
|
|
[JsonName("Manifest")]
|
2020-02-01 12:13:12 +00:00
|
|
|
public class Manifest
|
|
|
|
{
|
2020-06-13 18:32:30 +00:00
|
|
|
public readonly string Name;
|
|
|
|
public readonly Version Version;
|
|
|
|
public readonly string Author;
|
|
|
|
public readonly string Description;
|
2020-02-01 12:13:12 +00:00
|
|
|
|
2020-06-13 18:32:30 +00:00
|
|
|
public readonly Game GameType;
|
2020-02-01 12:13:12 +00:00
|
|
|
// Enum toString for better parsing in other software
|
|
|
|
public string GameName;
|
2020-06-13 18:32:30 +00:00
|
|
|
public readonly long DownloadSize;
|
|
|
|
public readonly long InstallSize;
|
2020-02-01 12:13:12 +00:00
|
|
|
|
2020-05-05 14:38:06 +00:00
|
|
|
public bool IsNSFW;
|
|
|
|
|
2021-09-27 12:42:46 +00:00
|
|
|
public Archive[] Archives { get; set; }
|
|
|
|
public InlineFile[] InlinedFiles { get; set; }
|
2020-02-01 12:13:12 +00:00
|
|
|
|
|
|
|
public Manifest(ModList modlist)
|
|
|
|
{
|
|
|
|
Name = modlist.Name;
|
2020-04-16 15:54:26 +00:00
|
|
|
Version = modlist.Version;
|
2020-02-01 12:13:12 +00:00
|
|
|
Author = modlist.Author;
|
|
|
|
Description = modlist.Description;
|
|
|
|
|
|
|
|
GameType = modlist.GameType;
|
|
|
|
GameName = GameType.ToString();
|
|
|
|
|
2021-09-27 12:42:46 +00:00
|
|
|
DownloadSize = modlist.Archives.Sum(a => (long)a.Size);
|
|
|
|
InstallSize = modlist.Directives.Sum(d => d.Size);
|
2020-02-01 12:13:12 +00:00
|
|
|
|
2020-05-05 14:38:06 +00:00
|
|
|
IsNSFW = modlist.IsNSFW;
|
|
|
|
|
2020-02-01 12:13:12 +00:00
|
|
|
// meta is being omitted due to it being useless and not very space friendly
|
2021-09-27 12:42:46 +00:00
|
|
|
Archives = modlist.Archives.Select(a => new Archive
|
2020-02-01 12:13:12 +00:00
|
|
|
{
|
2021-09-27 12:42:46 +00:00
|
|
|
State = a.State,
|
2020-02-01 12:13:12 +00:00
|
|
|
Hash = a.Hash,
|
|
|
|
Name = a.Name,
|
|
|
|
Size = a.Size,
|
2021-09-27 12:42:46 +00:00
|
|
|
}).ToArray();
|
2020-06-13 18:32:30 +00:00
|
|
|
|
2021-09-27 12:42:46 +00:00
|
|
|
InlinedFiles = modlist.Directives.OfType<InlineFile>().ToArray();
|
2020-02-01 12:13:12 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-27 12:42:46 +00:00
|
|
|
}
|