Fixed issue, where the validator enabled state couldn't be loaded correctly, if in another assembly
This commit is contained in:
parent
ddb4fc25ea
commit
58acb2979d
5 changed files with 135 additions and 11 deletions
|
|
@ -13,6 +13,7 @@ namespace Module.ProjectValidator.Editor
|
|||
internal sealed class ProjectValidatorSettings : ScriptableObject
|
||||
{
|
||||
public List<string> assemblies = new();
|
||||
[NonReorderable]
|
||||
public List<ValidatorEnabled> validators = new();
|
||||
|
||||
public const string MenuPath = "Project/Project Validator";
|
||||
|
|
@ -74,13 +75,17 @@ namespace Module.ProjectValidator.Editor
|
|||
|
||||
for (var i = 0; i < settings.validators.Count; i++)
|
||||
{
|
||||
temp.Add(settings.validators[i].type);
|
||||
temp.Add(settings.validators[i].assemblyQualifiedName);
|
||||
}
|
||||
|
||||
for (var i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (!temp.Contains(list[i]))
|
||||
settings.validators.Add(new ValidatorEnabled(list[i], true));
|
||||
if (temp.Contains(list[i]))
|
||||
continue;
|
||||
|
||||
var type = Type.GetType(list[i]);
|
||||
var name = type != null ? type.Name : "Unknown Type";
|
||||
settings.validators.Add(new ValidatorEnabled(name, list[i], true));
|
||||
}
|
||||
|
||||
for (var i = temp.Count - 1; i >= 0; i--)
|
||||
|
|
@ -97,19 +102,21 @@ namespace Module.ProjectValidator.Editor
|
|||
for (var i = 0; i < types.Count; i++)
|
||||
{
|
||||
if (!types[i].IsInterface && !types[i].IsAbstract)
|
||||
typeNames.Add(types[i].FullName);
|
||||
typeNames.Add(types[i].AssemblyQualifiedName);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ValidatorEnabled
|
||||
{
|
||||
public string type;
|
||||
public string name;
|
||||
public string assemblyQualifiedName;
|
||||
public bool enabled;
|
||||
|
||||
public ValidatorEnabled(string type, bool enabled)
|
||||
public ValidatorEnabled(string name, string assemblyQualifiedName, bool enabled)
|
||||
{
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.assemblyQualifiedName = assemblyQualifiedName;
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue