Some mod movement.

This commit is contained in:
Ottermandias 2023-04-01 14:24:12 +02:00
parent c12dbf3f8a
commit 577669b21f
26 changed files with 726 additions and 732 deletions

36
Penumbra/Mods/ModMeta.cs Normal file
View file

@ -0,0 +1,36 @@
using System.IO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Penumbra.Services;
using Penumbra.Util;
namespace Penumbra.Mods;
public readonly struct ModMeta : ISavable
{
public const uint FileVersion = 3;
private readonly Mod _mod;
public ModMeta(Mod mod)
=> _mod = mod;
public string ToFilename(FilenameService fileNames)
=> fileNames.ModMetaPath(_mod);
public void Save(StreamWriter writer)
{
var jObject = new JObject
{
{ nameof(FileVersion), JToken.FromObject(FileVersion) },
{ nameof(Mod.Name), JToken.FromObject(_mod.Name) },
{ nameof(Mod.Author), JToken.FromObject(_mod.Author) },
{ nameof(Mod.Description), JToken.FromObject(_mod.Description) },
{ nameof(Mod.Version), JToken.FromObject(_mod.Version) },
{ nameof(Mod.Website), JToken.FromObject(_mod.Website) },
{ nameof(Mod.ModTags), JToken.FromObject(_mod.ModTags) },
};
using var jWriter = new JsonTextWriter(writer) { Formatting = Formatting.Indented };
jObject.WriteTo(jWriter);
}
}