2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-10-30 15:41:35 +00:00

Pull Stream

This commit is contained in:
2025-10-30 12:45:29 +03:00
parent a63a9b5511
commit 746f12320e
25 changed files with 1637 additions and 704 deletions

View File

@@ -11,7 +11,7 @@ public class ArgumentTemplate
public bool Optional { get; set; }
public RepresentationType Type { get; set; }
public TRU Type { get; set; }
public ParameterInfo ParameterInfo { get; set; }
@@ -24,7 +24,7 @@ public class ArgumentTemplate
var cs = (uint)data[offset++];
var name = data.GetString(offset, cs);
offset += cs;
var (size, type) = RepresentationType.Parse(data, offset);
var (size, type) = TRU.Parse(data, offset);
return (cs + 2 + size, new ArgumentTemplate(name, index, type, optional));
}
@@ -34,7 +34,7 @@ public class ArgumentTemplate
}
public ArgumentTemplate(string name, int index, RepresentationType type, bool optional)
public ArgumentTemplate(string name, int index, TRU type, bool optional)
{
Name = name;
Index = index;

View File

@@ -12,11 +12,11 @@ public class ConstantTemplate : MemberTemplate
public readonly object Value;
//public readonly byte[] ValueData;
public readonly string Annotation;
public readonly RepresentationType ValueType;
public readonly TRU ValueType;
public FieldInfo FieldInfo { get; set; }
public ConstantTemplate(TypeTemplate template, byte index, string name, bool inherited, RepresentationType valueType, object value, string annotation)
public ConstantTemplate(TypeTemplate template, byte index, string name, bool inherited, TRU valueType, object value, string annotation)
: base(template, index, name, inherited)
{
Annotation = annotation;
@@ -73,7 +73,7 @@ public class ConstantTemplate : MemberTemplate
{
var annotationAttr = ci.GetCustomAttribute<AnnotationAttribute>(true);
var valueType = RepresentationType.FromType(ci.FieldType);
var valueType = TRU.FromType(ci.FieldType);
if (valueType == null)
throw new Exception($"Unsupported type `{ci.FieldType}` in constant `{type.Name}.{ci.Name}`");

View File

@@ -21,7 +21,7 @@ public class EventTemplate : MemberTemplate
public EventInfo EventInfo { get; set; }
public RepresentationType ArgumentType { get; set; }
public TRU ArgumentType { get; set; }
public override byte[] Compose()
{
@@ -55,7 +55,7 @@ public class EventTemplate : MemberTemplate
.ToArray();
}
public EventTemplate(TypeTemplate template, byte index, string name, bool inherited, RepresentationType argumentType, string annotation = null, bool subscribable = false)
public EventTemplate(TypeTemplate template, byte index, string name, bool inherited, TRU argumentType, string annotation = null, bool subscribable = false)
: base(template, index, name, inherited)
{
this.Annotation = annotation;
@@ -75,7 +75,7 @@ public class EventTemplate : MemberTemplate
var argType = ei.EventHandlerType.GenericTypeArguments[0];
var evtType = RepresentationType.FromType(argType);
var evtType = TRU.FromType(argType);
if (evtType == null)
throw new Exception($"Unsupported type `{argType}` in event `{type.Name}.{ei.Name}`");

View File

@@ -25,7 +25,7 @@ public class FunctionTemplate : MemberTemplate
// set;
//}
public RepresentationType ReturnType { get; set; }
public TRU ReturnType { get; set; }
public bool IsStatic { get; set; }
@@ -66,7 +66,7 @@ public class FunctionTemplate : MemberTemplate
return bl.ToArray();
}
public FunctionTemplate(TypeTemplate template, byte index, string name, bool inherited, bool isStatic, ArgumentTemplate[] arguments, RepresentationType returnType, string annotation = null)
public FunctionTemplate(TypeTemplate template, byte index, string name, bool inherited, bool isStatic, ArgumentTemplate[] arguments, TRU returnType, string annotation = null)
: base(template, index, name, inherited)
{
this.Arguments = arguments;
@@ -82,20 +82,20 @@ public class FunctionTemplate : MemberTemplate
var genericRtType = mi.ReturnType.IsGenericType ? mi.ReturnType.GetGenericTypeDefinition() : null;
RepresentationType rtType;
TRU rtType;
if (genericRtType == typeof(AsyncReply<>))
{
rtType = RepresentationType.FromType(mi.ReturnType.GetGenericArguments()[0]);
rtType = TRU.FromType(mi.ReturnType.GetGenericArguments()[0]);
}
else if (genericRtType == typeof(IEnumerable<>))// || genericRtType == typeof(IAsyncEnumerable<>))
{
// get export
rtType = RepresentationType.FromType(mi.ReturnType.GetGenericArguments()[0]);
rtType = TRU.FromType(mi.ReturnType.GetGenericArguments()[0]);
}
else
{
rtType = RepresentationType.FromType(mi.ReturnType);
rtType = TRU.FromType(mi.ReturnType);
}
if (rtType == null)
@@ -165,7 +165,7 @@ public class FunctionTemplate : MemberTemplate
var arguments = args.Select(x =>
{
var argType = RepresentationType.FromType(x.ParameterType);
var argType = TRU.FromType(x.ParameterType);
if (argType == null)
throw new Exception($"Unsupported type `{x.ParameterType}` in method `{type.Name}.{mi.Name}` parameter `{x.Name}`");

View File

@@ -25,7 +25,7 @@ public class PropertyTemplate : MemberTemplate
set;
}
public RepresentationType ValueType { get; set; }
public TRU ValueType { get; set; }
/*
@@ -136,7 +136,7 @@ public class PropertyTemplate : MemberTemplate
}
public PropertyTemplate(TypeTemplate template, byte index, string name, bool inherited,
RepresentationType valueType, string readAnnotation = null, string writeAnnotation = null, bool recordable = false)
TRU valueType, string readAnnotation = null, string writeAnnotation = null, bool recordable = false)
: base(template, index, name, inherited)
{
this.Recordable = recordable;
@@ -152,8 +152,8 @@ public class PropertyTemplate : MemberTemplate
var genericPropType = pi.PropertyType.IsGenericType ? pi.PropertyType.GetGenericTypeDefinition() : null;
var propType = genericPropType == typeof(PropertyContext<>) ?
RepresentationType.FromType(pi.PropertyType.GetGenericArguments()[0]) :
RepresentationType.FromType(pi.PropertyType);
TRU.FromType(pi.PropertyType.GetGenericArguments()[0]) :
TRU.FromType(pi.PropertyType);
if (propType == null)
throw new Exception($"Unsupported type `{pi.PropertyType}` in property `{type.Name}.{pi.Name}`");

View File

@@ -380,7 +380,7 @@ public class TypeTemplate
{
var annotationAttr = ci.GetCustomAttribute<AnnotationAttribute>(true);
var valueType = RepresentationType.FromType(ci.FieldType);
var valueType = TRU.FromType(ci.FieldType);
if (valueType == null)
throw new Exception($"Unsupported type `{ci.FieldType}` in constant `{type.Name}.{ci.Name}`");
@@ -783,7 +783,7 @@ public class TypeTemplate
offset += (uint)data[offset] + 1;
// return type
var (rts, returnType) = RepresentationType.Parse(data, offset);
var (rts, returnType) = TRU.Parse(data, offset);
offset += rts;
// arguments count
@@ -823,7 +823,7 @@ public class TypeTemplate
offset += (uint)data[offset] + 1;
var (dts, valueType) = RepresentationType.Parse(data, offset);
var (dts, valueType) = TRU.Parse(data, offset);
offset += dts;
@@ -857,7 +857,7 @@ public class TypeTemplate
var name = data.GetString(offset + 1, data[offset]);// Encoding.ASCII.GetString(data, (int)offset + 1, (int)data[offset]);
offset += (uint)data[offset] + 1;
var (dts, argType) = RepresentationType.Parse(data, offset);
var (dts, argType) = TRU.Parse(data, offset);
offset += dts;
@@ -883,7 +883,7 @@ public class TypeTemplate
var name = data.GetString(offset + 1, data[offset]);
offset += (uint)data[offset] + 1;
var (dts, valueType) = RepresentationType.Parse(data, offset);
var (dts, valueType) = TRU.Parse(data, offset);
offset += dts;