mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-30 05:45:31 +02:00
New: Better interface for creating custom formats
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Annotations;
|
||||
|
||||
namespace Radarr.Http.ClientSchema
|
||||
{
|
||||
|
@@ -143,10 +143,21 @@ namespace Radarr.Http.ClientSchema
|
||||
|
||||
private static List<SelectOption> GetSelectOptions(Type selectOptions)
|
||||
{
|
||||
var options = from Enum e in Enum.GetValues(selectOptions)
|
||||
select new SelectOption { Value = Convert.ToInt32(e), Name = e.ToString() };
|
||||
if (selectOptions.IsEnum)
|
||||
{
|
||||
var options = from Enum e in Enum.GetValues(selectOptions)
|
||||
select new SelectOption { Value = Convert.ToInt32(e), Name = e.ToString() };
|
||||
|
||||
return options.OrderBy(o => o.Value).ToList();
|
||||
return options.OrderBy(o => o.Value).ToList();
|
||||
}
|
||||
|
||||
if (typeof(ISelectOptionsConverter).IsAssignableFrom(selectOptions))
|
||||
{
|
||||
var converter = Activator.CreateInstance(selectOptions) as ISelectOptionsConverter;
|
||||
return converter.GetSelectOptions();
|
||||
}
|
||||
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
private static Func<object, object> GetValueConverter(Type propertyType)
|
||||
|
@@ -1,8 +0,0 @@
|
||||
namespace Radarr.Http.ClientSchema
|
||||
{
|
||||
public class SelectOption
|
||||
{
|
||||
public int Value { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user