2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 05:23:13 +00:00
This commit is contained in:
2024-11-09 01:46:00 +03:00
parent 2006c47013
commit 2dc373770c
30 changed files with 155 additions and 114 deletions

View File

@ -5,6 +5,8 @@ using System.Text;
namespace Esiur.Resource.Template;
#nullable enable
public class MemberData
{
public MemberInfo Info;
@ -15,6 +17,13 @@ public class MemberData
public MemberData? Child;
public byte Index;
public MemberData(string name, MemberInfo info, int order)
{
this.Name = name;
this.Info = info;
this.Order = order;
}
public MemberInfo GetMemberInfo()
{
var rt = Info;
@ -29,7 +38,7 @@ public class MemberData
public string? GetAnnotation()
{
string rt = null;
string? rt = null;
var md = this;
while (md != null)
{

View File

@ -601,18 +601,17 @@ public class TypeTemplate
.Where(x => x.GetCustomAttribute<IgnoreAttribute>() == null)
.Where(x => x.Name != "Instance")
.Where(x => !(x is MethodInfo m && m.IsSpecialName))
.Where(x=> !(x is EventInfo e &&
!(e.EventHandlerType.IsGenericType &&
.Where(x => !(x is EventInfo e &&
!(e.EventHandlerType.IsGenericType &&
(e.EventHandlerType.GetGenericTypeDefinition() == typeof(ResourceEventHandler<>)
|| e.EventHandlerType.GetGenericTypeDefinition() == typeof(CustomResourceEventHandler<>))
)
))
.Select(x => new MemberData()
{
Name = x.GetCustomAttribute<ExportAttribute>()?.Name ?? x.Name,
Info = x,
Order = order
})
.Select(x => new MemberData(
name: x.GetCustomAttribute<ExportAttribute>()?.Name ?? x.Name,
info: x,
order: order
))
.OrderBy(x => x.Name);
members.AddRange(mis.ToArray());
@ -627,12 +626,11 @@ public class TypeTemplate
.Where(x => !(x is FieldInfo c && !c.IsStatic))
.Where(x => x.GetCustomAttribute<ExportAttribute>() != null)
.Where(x => !(x is MethodInfo m && m.IsSpecialName))
.Select(x => new MemberData
{
Name = x.GetCustomAttribute<ExportAttribute>()?.Name ?? x.Name,
Info = x,
Order = order
})
.Select(x => new MemberData (
name : x.GetCustomAttribute<ExportAttribute>()?.Name ?? x.Name,
info : x,
order : order
))
.OrderBy(x => x.Name);
members.AddRange(mis.ToArray());
@ -641,7 +639,7 @@ public class TypeTemplate
type = type.BaseType;
if (type == null
if (type == null
|| type == typeof(Resource)
|| type == typeof(Record)
|| type == typeof(EntryPoint))