mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Added Presets to Indexers to add indexers with default properties. In an older version of NzbDrone these default indexers were added automatically and could not be removed.
This commit is contained in:
@@ -5,6 +5,7 @@ using NzbDrone.Common;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.Reflection;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using Omu.ValueInjecter;
|
||||
|
||||
namespace NzbDrone.Api.ClientSchema
|
||||
{
|
||||
@@ -55,7 +56,7 @@ namespace NzbDrone.Api.ClientSchema
|
||||
}
|
||||
|
||||
|
||||
public static object ReadFormSchema(List<Field> fields, Type targetType)
|
||||
public static object ReadFormSchema(List<Field> fields, Type targetType, object defaults = null)
|
||||
{
|
||||
Ensure.That(targetType, () => targetType).IsNotNull();
|
||||
|
||||
@@ -63,6 +64,11 @@ namespace NzbDrone.Api.ClientSchema
|
||||
|
||||
var target = Activator.CreateInstance(targetType);
|
||||
|
||||
if (defaults != null)
|
||||
{
|
||||
target.InjectFrom(defaults);
|
||||
}
|
||||
|
||||
foreach (var propertyInfo in properties)
|
||||
{
|
||||
var fieldAttribute = propertyInfo.GetAttribute<FieldDefinitionAttribute>(false);
|
||||
|
Reference in New Issue
Block a user