mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
attempt at better config I/O during setup
This commit is contained in:
1 parent
5f4461f7e5
commit
a5ddec48c8
2 files changed
+12
No files matched your search
@@ -43,6 +43,9 @@ public sealed class MiraPluginManager
|
||||
var info = new MiraPluginInfo(miraPlugin, pluginInfo);
|
||||
var roles = new List<Type>();
|
||||
|
||||
var oldConfigSetting = info.PluginConfig.SaveOnConfigSet;
|
||||
info.PluginConfig.SaveOnConfigSet = false;
|
||||
|
||||
foreach (var type in assembly.GetTypes())
|
||||
{
|
||||
if (type.GetCustomAttribute<MiraIgnoreAttribute>() != null)
|
||||
@@ -96,6 +99,9 @@ public sealed class MiraPluginManager
|
||||
RegisterColorClasses(type);
|
||||
}
|
||||
|
||||
info.PluginConfig.Save();
|
||||
info.PluginConfig.SaveOnConfigSet = oldConfigSetting;
|
||||
|
||||
info.OptionGroups.Sort((x, y) => x.GroupPriority.CompareTo(y.GroupPriority));
|
||||
QueuedRoleRegistrations.Add(info, roles);
|
||||
|
||||
|
||||
@@ -59,6 +59,9 @@ public static class CustomRoleManager
|
||||
{
|
||||
roles.ForEach(x => RoleIds.Add(x, GetNextRoleId()));
|
||||
|
||||
var oldConfigSetting = pluginInfo.PluginConfig.SaveOnConfigSet;
|
||||
pluginInfo.PluginConfig.SaveOnConfigSet = false;
|
||||
|
||||
foreach (var roleType in roles)
|
||||
{
|
||||
ClassInjector.RegisterTypeInIl2Cpp(roleType);
|
||||
@@ -71,6 +74,9 @@ public static class CustomRoleManager
|
||||
|
||||
pluginInfo.CustomRoles.Add((ushort)role.Role, role);
|
||||
}
|
||||
|
||||
pluginInfo.PluginConfig.Save();
|
||||
pluginInfo.PluginConfig.SaveOnConfigSet = oldConfigSetting;
|
||||
}
|
||||
|
||||
private static RoleBehaviour? RegisterRole(Type roleType, MiraPluginInfo parentMod)
|
||||
|
||||
Reference in new issue
Block a user