mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #1080 from wabbajack-tools/move-ini-include
Move where we include ini additions
This commit is contained in:
@ -100,7 +100,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
|
|
||||||
public string GetMetaIniString()
|
public string GetMetaIniString()
|
||||||
{
|
{
|
||||||
return $"{string.Join("\n", GetMetaIni())}\ninstalled=true";
|
return string.Join("\n", GetMetaIni());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<(Archive? Archive, TempFile NewFile)> ServerFindUpgrade(Archive a)
|
public async Task<(Archive? Archive, TempFile NewFile)> ServerFindUpgrade(Archive a)
|
||||||
|
@ -252,14 +252,34 @@ namespace Wabbajack.Lib
|
|||||||
.OfType<ArchiveMeta>()
|
.OfType<ArchiveMeta>()
|
||||||
.PMap(Queue, async directive =>
|
.PMap(Queue, async directive =>
|
||||||
{
|
{
|
||||||
Status($"Writing included .meta file {directive.To}");
|
Status($"Writing .meta file {directive.To}");
|
||||||
var outPath = DownloadFolder.Combine(directive.To);
|
foreach (var archive in ModList.Archives)
|
||||||
if (outPath.IsFile) await outPath.DeleteAsync();
|
{
|
||||||
var bytes = await LoadBytesFromPath(directive.SourceDataID);
|
if (HashedArchives.TryGetValue(archive.Hash, out var paths))
|
||||||
await outPath.WriteAllBytesAsync(bytes);
|
{
|
||||||
|
var metaPath = paths.WithExtension(Consts.MetaFileExtension);
|
||||||
|
if (!metaPath.Exists)
|
||||||
|
{
|
||||||
|
var meta = AddInstalled(archive.State.GetMetaIni()).ToArray();
|
||||||
|
await metaPath.WriteAllLinesAsync(meta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerable<string> AddInstalled(string[] getMetaIni)
|
||||||
|
{
|
||||||
|
foreach (var f in getMetaIni)
|
||||||
|
{
|
||||||
|
yield return f;
|
||||||
|
if (f == "[General]")
|
||||||
|
{
|
||||||
|
yield return "installed=true";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async ValueTask ValidateGameESMs()
|
private async ValueTask ValidateGameESMs()
|
||||||
{
|
{
|
||||||
foreach (var esm in ModList.Directives.OfType<CleanedESM>().ToList())
|
foreach (var esm in ModList.Directives.OfType<CleanedESM>().ToList())
|
||||||
|
Reference in New Issue
Block a user