mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-03-31 18:38:22 +00:00
renaming 2
This commit is contained in:
@@ -107,7 +107,7 @@ public class ConstantDef : MemberDef
|
||||
|
||||
var value = ci.GetValue(null);
|
||||
|
||||
if (typeDef?.Type == TypeDefKind.Enum)
|
||||
if (typeDef?.Kind == TypeDefKind.Enum)
|
||||
value = Convert.ChangeType(value, ci.FieldType.GetEnumUnderlyingType());
|
||||
|
||||
Map<string, string> annotations = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Esiur.Core;
|
||||
using Esiur.Data;
|
||||
using Esiur.Net.IIP;
|
||||
using Esiur.Protocol;
|
||||
using Esiur.Resource;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -217,7 +217,7 @@ public class FunctionDef : MemberDef
|
||||
|
||||
if (args.Length > 0)
|
||||
{
|
||||
if (args.Last().ParameterType == typeof(DistributedConnection)
|
||||
if (args.Last().ParameterType == typeof(EpConnection)
|
||||
|| args.Last().ParameterType == typeof(InvocationContext))
|
||||
args = args.Take(args.Count() - 1).ToArray();
|
||||
}
|
||||
@@ -286,7 +286,7 @@ public class FunctionDef : MemberDef
|
||||
{
|
||||
annotations = new Map<string, string>();
|
||||
annotations.Add("", "(" + String.Join(",",
|
||||
mi.GetParameters().Where(x => x.ParameterType != typeof(DistributedConnection))
|
||||
mi.GetParameters().Where(x => x.ParameterType != typeof(EpConnection))
|
||||
.Select(x => "[" + x.ParameterType.Name + "] " + x.Name)) + ") -> " + mi.ReturnType.Name);
|
||||
|
||||
}
|
||||
@@ -307,7 +307,7 @@ public class FunctionDef : MemberDef
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
//return = "(" + String.Join(",", mi.GetParameters().Where(x => x.ParameterType != typeof(DistributedConnection)).Select(x => "[" + x.ParameterType.Name + "] " + x.Name)) + ") -> " + mi.ReturnType.Name;
|
||||
//return = "(" + String.Join(",", mi.GetParameters().Where(x => x.ParameterType != typeof(EpConnection)).Select(x => "[" + x.ParameterType.Name + "] " + x.Name)) + ") -> " + mi.ReturnType.Name;
|
||||
|
||||
return $"{ReturnType} {Name}({string.Join(", ", Arguments.Select(a => a.ToString()))})";
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MemberDef
|
||||
// Inherited = inherited;
|
||||
//}
|
||||
|
||||
public string Fullname => Definition.ClassName + "." + Name;
|
||||
public string Fullname => Definition.Name + "." + Name;
|
||||
|
||||
//public virtual byte[] Compose()
|
||||
//{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Esiur.Data;
|
||||
using Esiur.Net.IIP;
|
||||
using Esiur.Protocol;
|
||||
using Esiur.Resource;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -34,7 +34,7 @@ public class PropertyDef : MemberDef
|
||||
}
|
||||
*/
|
||||
//bool ReadOnly;
|
||||
//IIPTypes::DataType ReturnType;
|
||||
//EPTypes::DataType ReturnType;
|
||||
public PropertyPermission Permission
|
||||
{
|
||||
get;
|
||||
@@ -43,7 +43,7 @@ public class PropertyDef : MemberDef
|
||||
|
||||
//public bool IsNullable { get; set; }
|
||||
|
||||
public bool Recordable
|
||||
public bool HasHistory
|
||||
{
|
||||
get;
|
||||
set;
|
||||
@@ -87,7 +87,7 @@ public class PropertyDef : MemberDef
|
||||
|
||||
|
||||
var hasAnnotation = ((data[offset] & 0x8) == 0x8);
|
||||
var recordable = ((data[offset] & 1) == 1);
|
||||
var hasHistory = ((data[offset] & 1) == 1);
|
||||
var permission = (PropertyPermission)((data[offset++] >> 1) & 0x3);
|
||||
var name = data.GetString(offset + 1, data[offset]);
|
||||
|
||||
@@ -116,7 +116,7 @@ public class PropertyDef : MemberDef
|
||||
Name = name,
|
||||
Inherited = inherited,
|
||||
Permission = permission,
|
||||
Recordable = recordable,
|
||||
HasHistory = hasHistory,
|
||||
ValueType = valueType,
|
||||
Annotations = annotations
|
||||
});
|
||||
@@ -127,7 +127,7 @@ public class PropertyDef : MemberDef
|
||||
{
|
||||
var name = DC.ToBytes(Name);
|
||||
|
||||
var pv = ((byte)(Permission) << 1) | (Recordable ? 1 : 0);
|
||||
var pv = ((byte)(Permission) << 1) | (HasHistory ? 1 : 0);
|
||||
|
||||
if (Inherited)
|
||||
pv |= 0x80;
|
||||
@@ -193,17 +193,7 @@ public class PropertyDef : MemberDef
|
||||
}
|
||||
}
|
||||
|
||||
//public PropertyTemplate(TypeSchema template, byte index, string name, bool inherited,
|
||||
// TRU valueType, string readAnnotation = null, string writeAnnotation = null, bool recordable = false)
|
||||
// : base(template, index, name, inherited)
|
||||
//{
|
||||
// this.Recordable = recordable;
|
||||
// //this.Storage = storage;
|
||||
// if (readAnnotation != null)
|
||||
// this.ReadAnnotation = readAnnotation;
|
||||
// this.WriteAnnotation = writeAnnotation;
|
||||
// this.ValueType = valueType;
|
||||
//}
|
||||
|
||||
|
||||
public static PropertyDef MakePropertyDef(Type type, PropertyInfo pi, string name, byte index, PropertyPermission permission, TypeDef schema)
|
||||
{
|
||||
@@ -273,24 +263,12 @@ public class PropertyDef : MemberDef
|
||||
Inherited = pi.DeclaringType != type,
|
||||
ValueType = propType,
|
||||
PropertyInfo = pi,
|
||||
Recordable = storageAttr == null ? false : storageAttr.Mode == StorageMode.Recordable,
|
||||
HasHistory = storageAttr == null ? false : storageAttr.Mode == StorageMode.History,
|
||||
Permission = permission,
|
||||
Annotations = annotations,
|
||||
};
|
||||
|
||||
//var pt = new PropertyTemplate(TypeSchema, index, customName ?? pi.Name, pi.DeclaringType != type, propType);
|
||||
|
||||
//if (storageAttr != null)
|
||||
// pt.Recordable = storageAttr.Mode == StorageMode.Recordable;
|
||||
|
||||
//if (annotationAttr != null)
|
||||
// pt.ReadAnnotation = annotationAttr.Annotation;
|
||||
//else
|
||||
// pt.ReadAnnotation = GetTypeAnnotationName(pi.PropertyType);
|
||||
|
||||
//pt.PropertyInfo = pi;
|
||||
|
||||
//return pt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ using Esiur.Data;
|
||||
using Esiur.Core;
|
||||
using System.Security.Cryptography;
|
||||
using Esiur.Proxy;
|
||||
using Esiur.Net.IIP;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Esiur.Resource;
|
||||
using Esiur.Protocol;
|
||||
|
||||
namespace Esiur.Data.Types;
|
||||
|
||||
@@ -245,7 +245,7 @@ public class TypeDef
|
||||
// Get parents
|
||||
while (parentType != null)
|
||||
{
|
||||
var parentTemplate = warehouse.GetTemplateByType(parentType);
|
||||
var parentTemplate = warehouse.GetTypeDefByType(parentType);
|
||||
if (parentTemplate != null)
|
||||
{
|
||||
list.Add(parentTemplate);
|
||||
@@ -262,7 +262,7 @@ public class TypeDef
|
||||
|
||||
foreach (var functionReturnType in functionReturnTypes)
|
||||
{
|
||||
var functionReturnTemplate = warehouse.GetTemplateByType(functionReturnType);
|
||||
var functionReturnTemplate = warehouse.GetTypeDefByType(functionReturnType);
|
||||
if (functionReturnTemplate != null)
|
||||
{
|
||||
if (!bag.Contains(functionReturnTemplate))
|
||||
@@ -281,7 +281,7 @@ public class TypeDef
|
||||
|
||||
foreach (var fpType in fpTypes)
|
||||
{
|
||||
var fpt = warehouse.GetTemplateByType(fpType);
|
||||
var fpt = warehouse.GetTypeDefByType(fpType);
|
||||
if (fpt != null)
|
||||
{
|
||||
if (!bag.Contains(fpt))
|
||||
@@ -293,18 +293,18 @@ public class TypeDef
|
||||
}
|
||||
}
|
||||
|
||||
// skip DistributedConnection argument
|
||||
// skip EpConnection argument
|
||||
if (args.Length > 0)
|
||||
{
|
||||
var last = args.Last();
|
||||
if (last.ParameterType != typeof(DistributedConnection))
|
||||
if (last.ParameterType != typeof(EpConnection))
|
||||
{
|
||||
|
||||
var fpTypes = GetDistributedTypes(last.ParameterType);
|
||||
|
||||
foreach (var fpType in fpTypes)
|
||||
{
|
||||
var fpt = warehouse.GetTemplateByType(fpType);
|
||||
var fpt = warehouse.GetTypeDefByType(fpType);
|
||||
if (fpt != null)
|
||||
{
|
||||
if (!bag.Contains(fpt))
|
||||
@@ -326,7 +326,7 @@ public class TypeDef
|
||||
|
||||
foreach (var propertyType in propertyTypes)
|
||||
{
|
||||
var propertyTemplate = warehouse.GetTemplateByType(propertyType);
|
||||
var propertyTemplate = warehouse.GetTypeDefByType(propertyType);
|
||||
if (propertyTemplate != null)
|
||||
{
|
||||
if (!bag.Contains(propertyTemplate))
|
||||
@@ -345,7 +345,7 @@ public class TypeDef
|
||||
|
||||
foreach (var eventType in eventTypes)
|
||||
{
|
||||
var eventTemplate = warehouse.GetTemplateByType(eventType);
|
||||
var eventTemplate = warehouse.GetTypeDefByType(eventType);
|
||||
|
||||
if (eventTemplate != null)
|
||||
{
|
||||
@@ -398,7 +398,7 @@ public class TypeDef
|
||||
else
|
||||
throw new Exception("Type must implement IResource, IRecord or inherit from DistributedResource.");
|
||||
|
||||
IsWrapper = Codec.InheritsClass(type, typeof(DistributedResource));
|
||||
IsWrapper = Codec.InheritsClass(type, typeof(EpResource));
|
||||
|
||||
type = ResourceProxy.GetBaseType(type);
|
||||
|
||||
@@ -410,7 +410,7 @@ public class TypeDef
|
||||
typeId = GetTypeUUID(type);
|
||||
|
||||
if (warehouse != null)
|
||||
warehouse.RegisterSchema(this);
|
||||
warehouse.RegisterTypeDef(this);
|
||||
|
||||
var hierarchy = GetHierarchy(type);
|
||||
|
||||
@@ -729,6 +729,7 @@ public class TypeDef
|
||||
byte functionIndex = 0;
|
||||
byte propertyIndex = 0;
|
||||
byte eventIndex = 0;
|
||||
byte constantIndex = 0;
|
||||
|
||||
for (int i = 0; i < methodsCount; i++)
|
||||
{
|
||||
@@ -750,14 +751,14 @@ public class TypeDef
|
||||
}
|
||||
else if (type == 2) // Event
|
||||
{
|
||||
var (len, et) = EventDef.Parse(data, offset, propertyIndex++, inherited);
|
||||
var (len, et) = EventDef.Parse(data, offset, eventIndex++, inherited);
|
||||
offset += len;
|
||||
od.events.Add(et);
|
||||
}
|
||||
// constant
|
||||
else if (type == 3)
|
||||
{
|
||||
var (len, ct) = ConstantDef.Parse(data, offset, propertyIndex++, inherited);
|
||||
var (len, ct) = ConstantDef.Parse(data, offset, constantIndex++, inherited);
|
||||
offset += len;
|
||||
od.constants.Add(ct);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user