mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-02-02 10:02:04 -05:00
20 lines
610 B
C#
20 lines
610 B
C#
using Newtonsoft.Json;
|
|
|
|
namespace Cleanuparr.Infrastructure.Features.DownloadClient.Deluge.Extensions;
|
|
|
|
internal static class DelugeExtensions
|
|
{
|
|
public static List<String?> GetAllJsonPropertyFromType(this Type t)
|
|
{
|
|
var type = typeof(JsonPropertyAttribute);
|
|
var props = t.GetProperties()
|
|
.Where(prop => Attribute.IsDefined(prop, type))
|
|
.ToList();
|
|
|
|
return props
|
|
.Select(x => x.GetCustomAttributes(type, true).Single())
|
|
.Cast<JsonPropertyAttribute>()
|
|
.Select(x => x.PropertyName)
|
|
.ToList();
|
|
}
|
|
} |