2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-12-14 08:50:23 +00:00

Deserialization fix

This commit is contained in:
2025-11-16 11:06:20 +03:00
parent e2e4ac90bc
commit d730fe1b8d
14 changed files with 571 additions and 221 deletions

View File

@@ -88,6 +88,10 @@ public class FunctionTemplate : MemberTemplate
{
rtType = TRU.FromType(mi.ReturnType.GetGenericArguments()[0]);
}
else if (genericRtType == typeof(Task<>))
{
rtType = TRU.FromType(mi.ReturnType.GetGenericArguments()[0]);
}
else if (genericRtType == typeof(IEnumerable<>))// || genericRtType == typeof(IAsyncEnumerable<>))
{
// get export

View File

@@ -487,7 +487,7 @@ public class TypeTemplate
}
// add attributes
var attrs = type.GetProperties(BindingFlags.Public | BindingFlags.Instance)
var attrs = type.GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Where(x => x.GetCustomAttribute<AttributeAttribute>() != null);
foreach (var attr in attrs)
@@ -606,6 +606,7 @@ public class TypeTemplate
.Where(x => !(x is FieldInfo c && !c.IsStatic))
.Where(x => x.GetCustomAttribute<IgnoreAttribute>() == null)
.Where(x => x.Name != "Instance")
.Where(x => x.Name != "Trigger")
.Where(x => !(x is MethodInfo m && m.IsSpecialName))
.Where(x => !(x is EventInfo e &&
!(e.EventHandlerType.IsGenericType &&
@@ -632,9 +633,9 @@ 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 (
info : x,
order : order
.Select(x => new MemberData(
info: x,
order: order
))
.OrderBy(x => x.Name);
@@ -692,7 +693,7 @@ public class TypeTemplate
}
// assign indexies
// assign indexes
var groups = members.Where(x => x.Parent == null)
.OrderBy(x => x.Name).OrderByDescending(x => x.Order)
.GroupBy(x => x.Info.MemberType);
@@ -924,13 +925,13 @@ public class TypeTemplate
public Map<byte, object> CastProperties(Map<string, object> properties)
{
var rt = new Map<byte, object>();
foreach(var kv in properties)
foreach (var kv in properties)
{
var pt = GetPropertyTemplateByName(kv.Key);
if (pt == null) continue;
rt.Add(pt.Index, kv.Value);
}
return rt;
}
}