Merge pull request #923 from erri120/more-info-manifest

Added InlineFile Directives to the manifest
This commit is contained in:
Timothy Baldridge 2020-06-13 14:30:14 -07:00 committed by GitHub
commit f4779afd44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 30 deletions

View File

@ -144,33 +144,31 @@ namespace Wabbajack.Lib
ModList.Image = (RelativePath)"modlist-image.png"; ModList.Image = (RelativePath)"modlist-image.png";
} }
using (var of = await ModListOutputFolder.Combine("modlist").Create()) await using (var of = await ModListOutputFolder.Combine("modlist").Create())
ModList.ToJson(of); ModList.ToJson(of);
await ModListOutputFile.DeleteAsync(); await ModListOutputFile.DeleteAsync();
using (var fs = await ModListOutputFile.Create()) await using (var fs = await ModListOutputFile.Create())
{ {
using (var za = new ZipArchive(fs, ZipArchiveMode.Create)) using var za = new ZipArchive(fs, ZipArchiveMode.Create);
await ModListOutputFolder.EnumerateFiles()
.DoProgress("Compressing ModList",
async f =>
{ {
await ModListOutputFolder.EnumerateFiles() var ze = za.CreateEntry((string)f.FileName);
.DoProgress("Compressing ModList", await using var os = ze.Open();
async f => await using var ins = await f.OpenRead();
{ await ins.CopyToAsync(os);
var ze = za.CreateEntry((string)f.FileName); });
await using var os = ze.Open();
await using var ins = await f.OpenRead();
await ins.CopyToAsync(os);
});
// Copy in modimage // Copy in modimage
if (ModListImage.Exists) if (ModListImage.Exists)
{ {
var ze = za.CreateEntry((string)ModList.Image); var ze = za.CreateEntry((string)ModList.Image);
await using var os = ze.Open(); await using var os = ze.Open();
await using var ins = await ModListImage.OpenRead(); await using var ins = await ModListImage.OpenRead();
await ins.CopyToAsync(os); await ins.CopyToAsync(os);
}
} }
} }
@ -186,7 +184,6 @@ namespace Wabbajack.Lib
}; };
metadata.ToJson(ModListOutputFile + ".meta.json"); metadata.ToJson(ModListOutputFile + ".meta.json");
Utils.Log("Removing ModList staging folder"); Utils.Log("Removing ModList staging folder");
await Utils.DeleteDirectory(ModListOutputFolder); await Utils.DeleteDirectory(ModListOutputFolder);
} }

View File

@ -9,25 +9,26 @@ namespace Wabbajack.Lib
[JsonName("Manifest")] [JsonName("Manifest")]
public class Manifest public class Manifest
{ {
public string Name; public readonly string Name;
public Version Version; public readonly Version Version;
public string Author; public readonly string Author;
public string Description; public readonly string Description;
public Game GameType; public readonly Game GameType;
// Enum toString for better parsing in other software // Enum toString for better parsing in other software
public string GameName; public string GameName;
public ModManager ModManager; public readonly ModManager ModManager;
// Enum toString for better parsing in other software // Enum toString for better parsing in other software
public string ModManagerName; public string ModManagerName;
public long DownloadSize; public readonly long DownloadSize;
public long InstallSize; public readonly long InstallSize;
public bool IsNSFW; public bool IsNSFW;
public List<Archive> Archives; public readonly List<Archive> Archives;
public readonly List<InlineFile> InlinedFiles;
public Manifest(ModList modlist) public Manifest(ModList modlist)
{ {
@ -54,6 +55,8 @@ namespace Wabbajack.Lib
Name = a.Name, Name = a.Name,
Size = a.Size, Size = a.Size,
}).ToList(); }).ToList();
InlinedFiles = modlist.Directives.OfType<InlineFile>().ToList();
} }
} }
} }