mirror of https://github.com/hykilpikonna/AquaDX
parent
436bdde60a
commit
2646f642b5
|
@ -12,6 +12,8 @@ public class HeadlessConfigInterface
|
||||||
public IReflectionProvider ReflectionProvider { get; init; }
|
public IReflectionProvider ReflectionProvider { get; init; }
|
||||||
public IReflectionManager ReflectionManager { get; init; }
|
public IReflectionManager ReflectionManager { get; init; }
|
||||||
|
|
||||||
|
public string ApiVersion { get; init; }
|
||||||
|
|
||||||
public HeadlessConfigInterface(Assembly loadedConfigAssembly, AssemblyDefinition modsAssembly)
|
public HeadlessConfigInterface(Assembly loadedConfigAssembly, AssemblyDefinition modsAssembly)
|
||||||
{
|
{
|
||||||
this.loadedConfigAssembly = loadedConfigAssembly;
|
this.loadedConfigAssembly = loadedConfigAssembly;
|
||||||
|
@ -20,6 +22,10 @@ public class HeadlessConfigInterface
|
||||||
loadedConfigAssembly.GetType("AquaMai.Config.Reflection.MonoCecilReflectionProvider"), [modsAssembly]) as IReflectionProvider;
|
loadedConfigAssembly.GetType("AquaMai.Config.Reflection.MonoCecilReflectionProvider"), [modsAssembly]) as IReflectionProvider;
|
||||||
ReflectionManager = Activator.CreateInstance(
|
ReflectionManager = Activator.CreateInstance(
|
||||||
loadedConfigAssembly.GetType("AquaMai.Config.Reflection.ReflectionManager"), [ReflectionProvider]) as IReflectionManager;
|
loadedConfigAssembly.GetType("AquaMai.Config.Reflection.ReflectionManager"), [ReflectionProvider]) as IReflectionManager;
|
||||||
|
ApiVersion = loadedConfigAssembly
|
||||||
|
.GetType("AquaMai.Config.ApiVersion")
|
||||||
|
.GetField("Version", BindingFlags.Public | BindingFlags.Static)
|
||||||
|
.GetRawConstantValue() as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfigView CreateConfigView(string tomlString = null)
|
public IConfigView CreateConfigView(string tomlString = null)
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace AquaMai.Config;
|
||||||
|
|
||||||
|
public static class ApiVersion
|
||||||
|
{
|
||||||
|
// Using a raw string for API version instead of a constant for maximum compatibility.
|
||||||
|
// When breaking changes are made, increment the major version.
|
||||||
|
// When new APIs are added in a backwards-compatible but non-forward-compatible manner, increment the minor version.
|
||||||
|
public const string Version = "1.0";
|
||||||
|
}
|
|
@ -84,7 +84,7 @@ public class ReflectionManager : IReflectionManager
|
||||||
sectionsByFullName.Add(type.FullName, section);
|
sectionsByFullName.Add(type.FullName, section);
|
||||||
}
|
}
|
||||||
|
|
||||||
var order = reflectionProvider.GetEnum("AquaMai.Mods.SetionNameOrder");
|
var order = reflectionProvider.GetEnum("AquaMai.Mods.SectionNameOrder");
|
||||||
sections = sections
|
sections = sections
|
||||||
.OrderBy(x => x.Key)
|
.OrderBy(x => x.Key)
|
||||||
.OrderBy(x =>
|
.OrderBy(x =>
|
||||||
|
|
|
@ -25,8 +25,8 @@ public class General
|
||||||
public static readonly string locale = "";
|
public static readonly string locale = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Please add/remove corresponding entries in SetionNameOrder enum when adding/removing sections.
|
// Please add/remove corresponding entries in SectionNameOrder enum when adding/removing sections.
|
||||||
public enum SetionNameOrder
|
public enum SectionNameOrder
|
||||||
{
|
{
|
||||||
DeprecationWarning,
|
DeprecationWarning,
|
||||||
General,
|
General,
|
||||||
|
|
Loading…
Reference in New Issue