Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions EXILED/Exiled.Loader/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,5 @@ public sealed class Config : IConfig
/// </summary>
[Description("Indicates whether Exiled should auto-update itself as soon as a new release is available.")]
public bool EnableAutoUpdates { get; set; } = true;

/// <summary>
/// Gets or sets a value indicating whether config validator should check all properties inside config values' types.
/// </summary>
[Description("Indicating whether config validator should check all properties inside config values' types.")]
public bool EnableDeepValidation { get; set; } = false;
}
}
16 changes: 8 additions & 8 deletions EXILED/Exiled.Loader/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,16 @@ public static void ValidateType(object instance, object defaultInstance, Propert
return;
}

if (hasValidateChildrenAttribute || (!LoaderPlugin.Config.EnableDeepValidation && !(propertyInfo.PropertyType.Namespace?.Contains("System") ?? false)))
if (!hasValidateChildrenAttribute)
return;

foreach (PropertyInfo property in propertyInfo.PropertyType.GetProperties().Where(x => x.GetMethod != null && x.SetMethod != null))
{
foreach (PropertyInfo property in propertyInfo.PropertyType.GetProperties().Where(x => x.GetMethod != null && x.SetMethod != null))
{
ConstructorInfo ctor = property.PropertyType.GetConstructor(Type.EmptyTypes);
if (ctor is null)
continue;
ConstructorInfo ctor = property.PropertyType.GetConstructor(Type.EmptyTypes);
if (ctor is null)
continue;

ValidateType(value, ctor.Invoke(null, null), property, ref validated);
}
ValidateType(value, ctor.Invoke(null, null), property, ref validated);
}
}

Expand Down
Loading