2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-26 21:13:13 +00:00

ResourceTemplate 2.0

This commit is contained in:
2021-05-25 17:06:19 +03:00
parent c8683e17e9
commit 82cbe3b01c
26 changed files with 1105 additions and 272 deletions

View File

@ -10,7 +10,7 @@ namespace Esiur.Resource.Template
{
public class PropertyTemplate : MemberTemplate
{
public enum PropertyPermission:byte
public enum PropertyPermission : byte
{
Read = 1,
Write,
@ -18,12 +18,15 @@ namespace Esiur.Resource.Template
}
public PropertyInfo Info
public PropertyInfo PropertyInfo
{
get;
set;
}
public TemplateDataType ValueType { get; set; }
/*
public bool Serilize
{
@ -32,12 +35,13 @@ namespace Esiur.Resource.Template
*/
//bool ReadOnly;
//IIPTypes::DataType ReturnType;
public PropertyPermission Permission {
public PropertyPermission Permission
{
get;
set;
}
public bool Recordable
{
get;
@ -84,6 +88,7 @@ namespace Esiur.Resource.Template
.AddUInt8((byte)(0x38 | pv))
.AddUInt8((byte)name.Length)
.AddUInt8Array(name)
.AddUInt8Array(ValueType.Compose())
.AddInt32(wexp.Length)
.AddUInt8Array(wexp)
.AddInt32(rexp.Length)
@ -97,6 +102,7 @@ namespace Esiur.Resource.Template
.AddUInt8((byte)(0x30 | pv))
.AddUInt8((byte)name.Length)
.AddUInt8Array(name)
.AddUInt8Array(ValueType.Compose())
.AddInt32(wexp.Length)
.AddUInt8Array(wexp)
.ToArray();
@ -108,25 +114,30 @@ namespace Esiur.Resource.Template
.AddUInt8((byte)(0x28 | pv))
.AddUInt8((byte)name.Length)
.AddUInt8Array(name)
.AddUInt8Array(ValueType.Compose())
.AddInt32(rexp.Length)
.AddUInt8Array(rexp)
.ToArray();
}
else
{
return new BinaryList()
.AddUInt8((byte)(0x20 | pv))
.AddUInt8((byte)name.Length)
.AddUInt8Array(name)
.AddUInt8Array(ValueType.Compose())
.ToArray();
}
}
public PropertyTemplate(ResourceTemplate template, byte index, string name, string read = null, string write = null, bool recordable = false)
:base(template, MemberType.Property, index, name)
public PropertyTemplate(ResourceTemplate template, byte index, string name, TemplateDataType valueType, string read = null, string write = null, bool recordable = false)
: base(template, MemberType.Property, index, name)
{
this.Recordable = recordable;
//this.Storage = storage;
this.ReadExpansion = read;
this.WriteExpansion = write;
this.ValueType = valueType;
}
}
}