Skip to content

Commit 28d225b

Browse files
authored
Config update (v1.1.0) (#6)
* feat: config management * chore: add config tests * feat: Add config verification * fix: Ensures indexing and creation of ACConfigs directory * tests: add more config test cases * chore: verbose logs for outdated configs * chore: Add version attribute to AnchorChain.csproj * chore: Migrate away from SeaPower.FileManager * fix: expose FindFile so that plugins can find configs * chore: reduce indentation and convert spaces to tabs for consistency * feat: config validity is now granular, modders can now reset config values * fix: add necessary references for compilation and fix section key not present if not resetting values * chore: remove debug statements
1 parent 9ffcd4c commit 28d225b

File tree

7 files changed

+441
-214
lines changed

7 files changed

+441
-214
lines changed

AnchorChain.Tests/ConfigLoading.cs

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// Uncomment following line to activate CLO tests
2+
#define Config
3+
#if Config
4+
5+
using UnityEngine;
6+
7+
8+
namespace AnchorChain.Tests;
9+
10+
[ACPlugin("io.github.seapower-modders.AnchorChainConfigInfo", "Config Info", "1.0")]
11+
public class ConfigInfo : IAnchorChainMod
12+
{
13+
public void TriggerEntryPoint()
14+
{
15+
Debug.LogWarning("Config info 01, 03, and 04 should load.");
16+
}
17+
}
18+
19+
20+
// Test required config existing
21+
[ACPlugin("io.github.seapower-modders.AnchorChainConfig01", "Config 01", "1.0")]
22+
[ACConfig]
23+
public class Config01 : IAnchorChainMod
24+
{
25+
public void TriggerEntryPoint()
26+
{
27+
Debug.LogWarning("Config info 01 loaded.");
28+
}
29+
}
30+
31+
32+
// Test required config not existing
33+
[ACPlugin("io.github.seapower-modders.AnchorChainConfig02", "Config 02", "1.0")]
34+
[ACConfig]
35+
public class Config02 : IAnchorChainMod
36+
{
37+
public void TriggerEntryPoint()
38+
{
39+
Debug.LogWarning("Config info 02 loaded.");
40+
}
41+
}
42+
43+
44+
// Test non-required config existing
45+
[ACPlugin("io.github.seapower-modders.AnchorChainConfig03", "Config 03", "1.0")]
46+
[ACConfig(required: false)]
47+
public class Config03 : IAnchorChainMod
48+
{
49+
public void TriggerEntryPoint()
50+
{
51+
Debug.LogWarning("Config info 03 loaded.");
52+
}
53+
}
54+
55+
56+
// Test non-required config not existing
57+
[ACPlugin("io.github.seapower-modders.AnchorChainConfig04", "Config 04", "1.0")]
58+
[ACConfig(required: false)]
59+
public class Config04 : IAnchorChainMod
60+
{
61+
public void TriggerEntryPoint()
62+
{
63+
Debug.LogWarning("Config info 04 loaded.");
64+
}
65+
}
66+
67+
68+
// Test config missing section
69+
[ACPlugin("io.github.seapower-modders.AnchorChainConfig05", "Config 05", "1.0")]
70+
[ACConfig()]
71+
public class Config05 : IAnchorChainMod
72+
{
73+
public void TriggerEntryPoint()
74+
{
75+
Debug.LogWarning("Config info 05 loaded.");
76+
}
77+
}
78+
79+
80+
// Test config missing key
81+
[ACPlugin("io.github.seapower-modders.AnchorChainConfig06", "Config 06", "1.0")]
82+
[ACConfig()]
83+
public class Config06 : IAnchorChainMod
84+
{
85+
public void TriggerEntryPoint()
86+
{
87+
Debug.LogWarning("Config info 06 loaded.");
88+
}
89+
}
90+
91+
92+
// Test resetting value
93+
[ACPlugin("io.github.seapower-modders.AnchorChainConfig07", "Config 07", "1.0")]
94+
[ACConfig()]
95+
public class Config07 : IAnchorChainMod
96+
{
97+
public void TriggerEntryPoint()
98+
{
99+
Debug.LogWarning("Config info 07 loaded.");
100+
}
101+
}
102+
103+
104+
#endif

AnchorChain.Tests/ImpliedDependency.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Uncomment following line to activate SD tests
2-
#define ID
2+
// #define ID
33
#if ID
44

55
using UnityEngine;

AnchorChain.Tests/LoadOrder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Uncomment following line to activate SD tests
2-
#define LO
2+
// #define LO
33
#if LO
44

55
using UnityEngine;

AnchorChain.Tests/StrictDependency.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Uncomment following line to activate SD tests
2-
#define SD
2+
// #define SD
33
#if SD
44

55
using UnityEngine;

AnchorChain/AnchorChain.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>disable</Nullable>
77
<LangVersion>12.0</LangVersion>
8+
<Version>1.1.0</Version>
89
</PropertyGroup>
910

1011
<ItemGroup>
@@ -20,6 +21,10 @@
2021
<HintPath>..\Dll\BepInEx.dll</HintPath>
2122
<Private>False</Private>
2223
</Reference>
24+
<Reference Include="Noesis.NoesisGUI">
25+
<HintPath>..\Dll\Noesis.NoesisGUI.dll</HintPath>
26+
<Private>False</Private>
27+
</Reference>
2328
<Reference Include="Seapower-Scripts">
2429
<HintPath>..\Dll\Seapower-Scripts.dll</HintPath>
2530
<Private>False</Private>

0 commit comments

Comments
 (0)