mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-06-27 14:53:11 +00:00
WS
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import 'dart:core';
|
||||
|
||||
import '../Data/DC.dart';
|
||||
import '../Data/Structure.dart';
|
||||
import '../Data/AutoList.dart';
|
||||
@ -21,6 +22,9 @@ import './Template/MemberTemplate.dart';
|
||||
import '../Data/PropertyValue.dart';
|
||||
import 'Warehouse.dart';
|
||||
|
||||
import '../Core/PropertyModificationInfo.dart';
|
||||
|
||||
|
||||
class Instance extends IEventHandler {
|
||||
String _name;
|
||||
|
||||
@ -387,7 +391,8 @@ class Instance extends IEventHandler {
|
||||
//_resource.emitArgs("modified", [pt.name, value]);
|
||||
_resource.emitArgs(":${pt.name}", [value]);
|
||||
|
||||
_resource.emitProperty(pt.name);
|
||||
_resource.emitProperty(
|
||||
PropertyModificationInfo(_resource, pt, value, _instanceAge));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -542,7 +547,7 @@ class Instance extends IEventHandler {
|
||||
if (customTemplate != null)
|
||||
_template = customTemplate;
|
||||
else
|
||||
_template = Warehouse.getTemplateByType(resource.runtimeType);
|
||||
_template = Warehouse.getTemplateByType(resource.runtimeType)!;
|
||||
|
||||
// set ages
|
||||
for (int i = 0; i < _template.properties.length; i++) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'dart:ffi';
|
||||
//import 'dart:ffi';
|
||||
|
||||
import '../../Data/IRecord.dart';
|
||||
import '../../Resource/IResource.dart';
|
||||
@ -27,31 +27,32 @@ class TemplateDataType {
|
||||
TemplateDataType.fromType(type, bool isArray) {
|
||||
int dt;
|
||||
|
||||
if (type == null || type == dynamic)
|
||||
if (type == null || type == dynamic) {
|
||||
dt = DataType.Void;
|
||||
else if (type is int) {
|
||||
dt = type;
|
||||
} else if (type == bool)
|
||||
}
|
||||
// else if (type is int) {
|
||||
// dt = type;
|
||||
else if (type == bool)
|
||||
dt = DataType.Bool;
|
||||
else if (type == Uint8)
|
||||
dt = DataType.UInt8;
|
||||
else if (type == Int8)
|
||||
dt = DataType.Int8;
|
||||
else if (type == Uint16)
|
||||
dt = DataType.UInt16;
|
||||
else if (type == Int16)
|
||||
dt = DataType.Int16;
|
||||
else if (type == Uint32)
|
||||
dt = DataType.UInt32;
|
||||
else if (type == Int32)
|
||||
dt = DataType.Int32;
|
||||
else if (type == Uint64)
|
||||
dt = DataType.UInt64;
|
||||
else if (type == Int64 || type == int)
|
||||
// else if (type == Uint8)
|
||||
// dt = DataType.UInt8;
|
||||
// else if (type == Int8)
|
||||
// dt = DataType.Int8;
|
||||
// else if (type == Uint16)
|
||||
// dt = DataType.UInt16;
|
||||
// else if (type == Int16)
|
||||
// dt = DataType.Int16;
|
||||
// else if (type == Uint32)
|
||||
// dt = DataType.UInt32;
|
||||
// else if (type == Int32)
|
||||
// dt = DataType.Int32;
|
||||
// else if (type == Uint64)
|
||||
// dt = DataType.UInt64;
|
||||
else if (/* type == Int64 || */ type == int)
|
||||
dt = DataType.Int64;
|
||||
else if (type == Float)
|
||||
dt = DataType.Float32;
|
||||
else if (type == Double || type == double)
|
||||
// else if (type == Float)
|
||||
// dt = DataType.Float32;
|
||||
else if (/* type == Double || */ type == double)
|
||||
dt = DataType.Float64;
|
||||
else if (type == String)
|
||||
dt = DataType.String;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'dart:ffi';
|
||||
//import 'dart:ffi';
|
||||
|
||||
import '../../Net/IIP/DistributedResource.dart';
|
||||
|
||||
|
@ -482,12 +482,12 @@ class Warehouse {
|
||||
return rt;
|
||||
}
|
||||
|
||||
static T createInstance<T>(Type T) {
|
||||
return _factory[T]?.instanceCreator.call();
|
||||
static T createInstance<T>(Type type) {
|
||||
return _factory[type]?.instanceCreator.call();
|
||||
}
|
||||
|
||||
static List<T> createArray<T>(Type T) {
|
||||
return _factory[T]?.arrayCreator.call();
|
||||
static List<T> createArray<T>(Type type) {
|
||||
return _factory[type]?.arrayCreator.call();
|
||||
}
|
||||
|
||||
static AsyncReply<T> newResource<T extends IResource>(String name,
|
||||
@ -546,16 +546,17 @@ class Warehouse {
|
||||
/// </summary>
|
||||
/// <param name="type">.Net type.</param>
|
||||
/// <returns>Resource template.</returns>
|
||||
static TypeTemplate getTemplateByType(Type type) {
|
||||
static TypeTemplate? getTemplateByType(Type type) {
|
||||
// loaded ?
|
||||
for (var tmps in _templates.values)
|
||||
for (var tmp in tmps.values) if (tmp.definedType == type) return tmp;
|
||||
|
||||
//if (tmp.className == type.toString()) return tmp;
|
||||
|
||||
//try {
|
||||
var template = new TypeTemplate.fromType(type, true);
|
||||
|
||||
return template;
|
||||
//} catch (ex) {
|
||||
// return null;
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user