30 lines
941 B
C#
30 lines
941 B
C#
namespace MrGameEng.Mods;
|
|
|
|
/// <summary>One discovered mod: its metadata and content directories on disk.</summary>
|
|
public sealed class Mod
|
|
{
|
|
internal Mod(ModInfo info, string rootPath)
|
|
{
|
|
Info = info;
|
|
RootPath = rootPath;
|
|
}
|
|
|
|
/// <summary>Metadata from <c>About/About.json</c>.</summary>
|
|
public ModInfo Info { get; }
|
|
|
|
/// <summary>Absolute path of the mod's root directory.</summary>
|
|
public string RootPath { get; }
|
|
|
|
/// <summary>Unique mod id (shortcut for <c>Info.Id</c>).</summary>
|
|
public string Id => Info.Id;
|
|
|
|
/// <summary>
|
|
/// Absolute path of a content folder inside the mod (e.g. <c>Defs</c>, <c>Textures</c>,
|
|
/// <c>Languages</c>). The folder is not required to exist.
|
|
/// </summary>
|
|
public string ContentPath(string folder) => Path.Combine(RootPath, folder);
|
|
|
|
/// <inheritdoc />
|
|
public override string ToString() => $"{Id} {Info.Version}".TrimEnd();
|
|
}
|