mirror of
https://github.com/esiur/esiur-dart.git
synced 2026-04-03 17:58:21 +00:00
null-safety
This commit is contained in:
@@ -30,82 +30,56 @@ import 'DC.dart';
|
||||
import 'DataType.dart';
|
||||
import 'Guid.dart';
|
||||
|
||||
class BinaryList
|
||||
{
|
||||
var _list = <int>[];
|
||||
class BinaryList {
|
||||
var _list = <int>[];
|
||||
|
||||
int get length => _list.length;
|
||||
int get length => _list.length;
|
||||
|
||||
BinaryList addDateTime(DateTime value)
|
||||
{
|
||||
_list.addAll(DC.dateTimeToBytes(value));
|
||||
return this;
|
||||
}
|
||||
void addDateTime(DateTime value) {
|
||||
_list.addAll(DC.dateTimeToBytes(value));
|
||||
}
|
||||
|
||||
BinaryList insertDateTime(int position, DateTime value)
|
||||
{
|
||||
_list.insertAll(position, DC.dateTimeToBytes(value));
|
||||
return this;
|
||||
}
|
||||
void insertDateTime(int position, DateTime value) {
|
||||
_list.insertAll(position, DC.dateTimeToBytes(value));
|
||||
}
|
||||
|
||||
void addDateTimeArray(List<DateTime> value) {
|
||||
_list.addAll(DC.dateTimeArrayToBytes(value));
|
||||
}
|
||||
|
||||
BinaryList addDateTimeArray(List<DateTime> value)
|
||||
{
|
||||
_list.addAll(DC.dateTimeArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
void insertDateTimeArray(int position, List<DateTime> value) {
|
||||
_list.insertAll(position, DC.dateTimeArrayToBytes(value));
|
||||
}
|
||||
|
||||
BinaryList insertDateTimeArray(int position, List<DateTime> value)
|
||||
{
|
||||
_list.insertAll(position, DC.dateTimeArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
void addGuid(Guid value) {
|
||||
_list.addAll(DC.guidToBytes(value));
|
||||
}
|
||||
|
||||
BinaryList addGuid(Guid value)
|
||||
{
|
||||
_list.addAll(DC.guidToBytes(value));
|
||||
return this;
|
||||
}
|
||||
void insertGuid(int position, Guid value) {
|
||||
_list.insertAll(position, DC.guidToBytes(value));
|
||||
}
|
||||
|
||||
BinaryList insertGuid(int position, Guid value)
|
||||
{
|
||||
_list.insertAll(position, DC.guidToBytes(value));
|
||||
return this;
|
||||
}
|
||||
void addGuidArray(List<Guid> value) {
|
||||
_list.addAll(DC.guidArrayToBytes(value));
|
||||
}
|
||||
|
||||
BinaryList addGuidArray(List<Guid> value)
|
||||
{
|
||||
_list.addAll(DC.guidArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
void insertGuidArray(int position, List<Guid> value) {
|
||||
_list.insertAll(position, DC.guidArrayToBytes(value));
|
||||
}
|
||||
|
||||
BinaryList insertGuidArray(int position, List<Guid> value)
|
||||
{
|
||||
_list.insertAll(position, DC.guidArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
void addUint8Array(Uint8List value) {
|
||||
_list.addAll(value);
|
||||
}
|
||||
|
||||
void addDC(DC value) {
|
||||
_list.addAll(value.toArray());
|
||||
}
|
||||
|
||||
BinaryList addUint8Array(Uint8List value)
|
||||
{
|
||||
_list.addAll(value);
|
||||
return this;
|
||||
}
|
||||
void insertUint8Array(int position, Uint8List value) {
|
||||
_list.insertAll(position, value);
|
||||
}
|
||||
|
||||
BinaryList addDC(DC value)
|
||||
{
|
||||
_list.addAll(value.toArray());
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertUint8Array(int position, Uint8List value)
|
||||
{
|
||||
_list.insertAll(position, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
BinaryList addHex(String value)
|
||||
{
|
||||
return this.addUint8Array(DC.fromHex(value, null));
|
||||
@@ -117,434 +91,316 @@ class BinaryList
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
BinaryList addString(String value)
|
||||
{
|
||||
_list.addAll(DC.stringToBytes(value));
|
||||
return this;
|
||||
void addString(String value) {
|
||||
_list.addAll(DC.stringToBytes(value));
|
||||
}
|
||||
|
||||
void insertString(int position, String value) {
|
||||
_list.insertAll(position, DC.stringToBytes(value));
|
||||
}
|
||||
|
||||
void addStringArray(List<String> value) {
|
||||
_list.addAll(DC.stringArrayToBytes(value));
|
||||
}
|
||||
|
||||
void insertStringArray(int position, List<String> value) {
|
||||
_list.insertAll(position, DC.stringArrayToBytes(value));
|
||||
}
|
||||
|
||||
void insertUint8(int position, int value) {
|
||||
_list.insert(position, value);
|
||||
}
|
||||
|
||||
void addUint8(int value) {
|
||||
_list.add(value);
|
||||
}
|
||||
|
||||
void addInt8(int value) {
|
||||
_list.add(value);
|
||||
}
|
||||
|
||||
void insertInt8(int position, int value) {
|
||||
_list.insert(position, value);
|
||||
}
|
||||
|
||||
void addInt8Array(Int8List value) {
|
||||
_list.addAll(DC.int8ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void insertInt8Array(int position, Int8List value) {
|
||||
_list.insertAll(position, DC.int8ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void addChar(int value) {
|
||||
_list.addAll(DC.charToBytes(value));
|
||||
}
|
||||
|
||||
void InsertChar(int position, int value) {
|
||||
_list.insertAll(position, DC.charToBytes(value));
|
||||
}
|
||||
|
||||
void addCharArray(Uint16List value) {
|
||||
_list.addAll(DC.charArrayToBytes(value));
|
||||
}
|
||||
|
||||
void InsertCharArray(int position, Uint16List value) {
|
||||
_list.insertAll(position, DC.charArrayToBytes(value));
|
||||
}
|
||||
|
||||
void addBoolean(bool value) {
|
||||
_list.addAll(DC.boolToBytes(value));
|
||||
}
|
||||
|
||||
void insertBoolean(int position, bool value) {
|
||||
_list.insertAll(position, DC.boolToBytes(value));
|
||||
}
|
||||
|
||||
void addBooleanArray(List<bool> value) {
|
||||
_list.addAll(DC.boolToBytes(value));
|
||||
}
|
||||
|
||||
void insertBooleanArray(int position, List<bool> value) {
|
||||
_list.insertAll(position, DC.boolToBytes(value));
|
||||
}
|
||||
|
||||
void addUint16(int value) {
|
||||
_list.addAll(DC.uint16ToBytes(value));
|
||||
}
|
||||
|
||||
void insertUint16(int position, int value) {
|
||||
_list.insertAll(position, DC.uint16ToBytes(value));
|
||||
}
|
||||
|
||||
void addUint16Array(Uint16List value) {
|
||||
_list.addAll(DC.uint16ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void insertUint16Array(int position, Uint16List value) {
|
||||
_list.insertAll(position, DC.uint16ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void addInt16(int value) {
|
||||
_list.addAll(DC.int16ToBytes(value));
|
||||
}
|
||||
|
||||
void insertInt16(int position, int value) {
|
||||
_list.insertAll(position, DC.int16ToBytes(value));
|
||||
}
|
||||
|
||||
void addInt16Array(Int16List value) {
|
||||
_list.addAll(DC.int16ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void insertInt16Array(int position, Int16List value) {
|
||||
_list.insertAll(position, DC.int16ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void addUint32(int value) {
|
||||
_list.addAll(DC.uint32ToBytes(value));
|
||||
}
|
||||
|
||||
void insertUint32(int position, int value) {
|
||||
_list.insertAll(position, DC.uint32ToBytes(value));
|
||||
}
|
||||
|
||||
void addUint32Array(Uint32List value) {
|
||||
_list.addAll(DC.uint32ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void InsertUint32Array(int position, Uint32List value) {
|
||||
_list.insertAll(position, DC.uint32ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void addInt32(int value) {
|
||||
_list.addAll(DC.int32ToBytes(value));
|
||||
}
|
||||
|
||||
void insertInt32(int position, int value) {
|
||||
_list.insertAll(position, DC.int32ToBytes(value));
|
||||
}
|
||||
|
||||
void addInt32Array(Int32List value) {
|
||||
_list.addAll(DC.int32ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void insertInt32Array(int position, Int32List value) {
|
||||
_list.insertAll(position, DC.int32ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void addUint64(int value) {
|
||||
_list.addAll(DC.uint64ToBytes(value));
|
||||
}
|
||||
|
||||
void insertUint64(int position, int value) {
|
||||
_list.insertAll(position, DC.uint64ToBytes(value));
|
||||
}
|
||||
|
||||
void addUint64Array(Uint64List value) {
|
||||
_list.addAll(DC.uint64ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void InsertUint64Array(int position, Uint64List value) {
|
||||
_list.insertAll(position, DC.uint64ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void addInt64(int value) {
|
||||
_list.addAll(DC.int64ToBytes(value));
|
||||
}
|
||||
|
||||
void insertInt64(int position, int value) {
|
||||
_list.insertAll(position, DC.int64ToBytes(value));
|
||||
}
|
||||
|
||||
void addInt64Array(Int64List value) {
|
||||
_list.addAll(DC.int64ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void insertInt64Array(int position, Int64List value) {
|
||||
_list.insertAll(position, DC.int64ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void addFloat32(double value) {
|
||||
_list.addAll(DC.float32ToBytes(value));
|
||||
}
|
||||
|
||||
void insertFloat32(int position, double value) {
|
||||
_list.insertAll(position, DC.float32ToBytes(value));
|
||||
}
|
||||
|
||||
void addFloat32Array(Float32List value) {
|
||||
_list.addAll(DC.float32ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void insertFloat32Array(int position, Float32List value) {
|
||||
_list.insertAll(position, DC.float32ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void addFloat64(double value) {
|
||||
_list.addAll(DC.float64ToBytes(value));
|
||||
}
|
||||
|
||||
void insertFloat64(int position, double value) {
|
||||
_list.insertAll(position, DC.float64ToBytes(value));
|
||||
}
|
||||
|
||||
void addFloat64Array(Float64List value) {
|
||||
_list.addAll(DC.float64ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void insertFloat64Array(int position, Float64List value) {
|
||||
_list.insertAll(position, DC.float64ArrayToBytes(value));
|
||||
}
|
||||
|
||||
void add(type, value) {
|
||||
switch (type) {
|
||||
case DataType.Bool:
|
||||
addBoolean(value);
|
||||
return;
|
||||
case DataType.BoolArray:
|
||||
addBooleanArray(value);
|
||||
return;
|
||||
case DataType.UInt8:
|
||||
addUint8(value);
|
||||
return;
|
||||
case DataType.UInt8Array:
|
||||
addUint8Array(value);
|
||||
return;
|
||||
case DataType.Int8:
|
||||
addInt8(value);
|
||||
return;
|
||||
case DataType.Int8Array:
|
||||
addInt8Array(value);
|
||||
return;
|
||||
case DataType.Char:
|
||||
addChar(value);
|
||||
return;
|
||||
case DataType.CharArray:
|
||||
addCharArray(value);
|
||||
return;
|
||||
case DataType.UInt16:
|
||||
addUint16(value);
|
||||
return;
|
||||
case DataType.UInt16Array:
|
||||
addUint16Array(value);
|
||||
return;
|
||||
case DataType.Int16:
|
||||
addInt16(value);
|
||||
return;
|
||||
case DataType.Int16Array:
|
||||
addInt16Array(value);
|
||||
return;
|
||||
case DataType.UInt32:
|
||||
addUint32(value);
|
||||
return;
|
||||
case DataType.UInt32Array:
|
||||
addUint32Array(value);
|
||||
return;
|
||||
case DataType.Int32:
|
||||
addInt32(value);
|
||||
return;
|
||||
case DataType.Int32Array:
|
||||
addInt32Array(value);
|
||||
return;
|
||||
case DataType.UInt64:
|
||||
addUint64(value);
|
||||
return;
|
||||
case DataType.UInt64Array:
|
||||
addUint64Array(value);
|
||||
return;
|
||||
case DataType.Int64:
|
||||
addInt64(value);
|
||||
return;
|
||||
case DataType.Int64Array:
|
||||
addInt64Array(value);
|
||||
return;
|
||||
|
||||
case DataType.Float32:
|
||||
addFloat32(value);
|
||||
return;
|
||||
case DataType.Float32Array:
|
||||
addFloat32Array(value);
|
||||
return;
|
||||
|
||||
case DataType.Float64:
|
||||
addFloat64(value);
|
||||
return;
|
||||
case DataType.Float64Array:
|
||||
addFloat64Array(value);
|
||||
return;
|
||||
|
||||
case DataType.String:
|
||||
addString(value);
|
||||
return;
|
||||
case DataType.StringArray:
|
||||
addStringArray(value);
|
||||
return;
|
||||
|
||||
case DataType.DateTime:
|
||||
addDateTime(value);
|
||||
return;
|
||||
case DataType.DateTimeArray:
|
||||
addDateTimeArray(value);
|
||||
return;
|
||||
|
||||
default:
|
||||
throw new Exception("Not Implemented " + type.ToString());
|
||||
//return this;
|
||||
}
|
||||
}
|
||||
|
||||
BinaryList insertString(int position, String value)
|
||||
{
|
||||
_list.insertAll(position, DC.stringToBytes(value));
|
||||
return this;
|
||||
}
|
||||
/// <summary>
|
||||
/// Convert the _list to an array of bytes
|
||||
/// </summary>
|
||||
/// <returns>Bytes array</returns>
|
||||
Uint8List toArray() {
|
||||
return Uint8List.fromList(_list);
|
||||
}
|
||||
|
||||
BinaryList addStringArray(List<String> value)
|
||||
{
|
||||
_list.addAll(DC.stringArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
DC toDC() {
|
||||
return new DC.fromUint8Array(toArray());
|
||||
}
|
||||
|
||||
BinaryList insertStringArray(int position, List<String> value)
|
||||
{
|
||||
_list.insertAll(position, DC.stringArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertUint8(int position, int value)
|
||||
{
|
||||
_list.insert(position, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addUint8(int value)
|
||||
{
|
||||
_list.add(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addInt8(int value)
|
||||
{
|
||||
_list.add(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertInt8(int position, int value)
|
||||
{
|
||||
_list.insert(position, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addInt8Array(Int8List value)
|
||||
{
|
||||
_list.addAll(DC.int8ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertInt8Array(int position, Int8List value)
|
||||
{
|
||||
_list.insertAll(position, DC.int8ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
BinaryList addChar(int value)
|
||||
{
|
||||
_list.addAll(DC.charToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList InsertChar(int position, int value)
|
||||
{
|
||||
_list.insertAll(position, DC.charToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addCharArray(Uint16List value)
|
||||
{
|
||||
_list.addAll(DC.charArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList InsertCharArray(int position, Uint16List value)
|
||||
{
|
||||
_list.insertAll(position, DC.charArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
BinaryList addBoolean(bool value)
|
||||
{
|
||||
_list.addAll(DC.boolToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertBoolean(int position, bool value)
|
||||
{
|
||||
_list.insertAll(position, DC.boolToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addBooleanArray(List<bool> value)
|
||||
{
|
||||
_list.addAll(DC.boolToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertBooleanArray(int position, List<bool> value)
|
||||
{
|
||||
_list.insertAll(position, DC.boolToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addUint16(int value)
|
||||
{
|
||||
_list.addAll(DC.uint16ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertUint16(int position, int value)
|
||||
{
|
||||
_list.insertAll(position, DC.uint16ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addUint16Array(Uint16List value)
|
||||
{
|
||||
_list.addAll(DC.uint16ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertUint16Array(int position, Uint16List value)
|
||||
{
|
||||
_list.insertAll(position, DC.uint16ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
BinaryList addInt16(int value)
|
||||
{
|
||||
_list.addAll(DC.int16ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertInt16(int position, int value)
|
||||
{
|
||||
_list.insertAll(position, DC.int16ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
BinaryList addInt16Array(Int16List value)
|
||||
{
|
||||
_list.addAll(DC.int16ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertInt16Array(int position, Int16List value)
|
||||
{
|
||||
_list.insertAll(position, DC.int16ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addUint32(int value)
|
||||
{
|
||||
_list.addAll(DC.uint32ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertUint32(int position, int value)
|
||||
{
|
||||
_list.insertAll(position, DC.uint32ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addUint32Array(Uint32List value)
|
||||
{
|
||||
_list.addAll(DC.uint32ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
BinaryList InsertUint32Array(int position, Uint32List value)
|
||||
{
|
||||
_list.insertAll(position, DC.uint32ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
BinaryList addInt32(int value)
|
||||
{
|
||||
_list.addAll(DC.int32ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertInt32(int position, int value)
|
||||
{
|
||||
_list.insertAll(position, DC.int32ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addInt32Array(Int32List value)
|
||||
{
|
||||
_list.addAll(DC.int32ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertInt32Array(int position, Int32List value)
|
||||
{
|
||||
_list.insertAll(position, DC.int32ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
BinaryList addUint64(int value)
|
||||
{
|
||||
_list.addAll(DC.uint64ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertUint64(int position, int value)
|
||||
{
|
||||
_list.insertAll(position, DC.uint64ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addUint64Array(Uint64List value)
|
||||
{
|
||||
_list.addAll(DC.uint64ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList InsertUint64Array(int position, Uint64List value)
|
||||
{
|
||||
_list.insertAll(position, DC.uint64ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addInt64(int value)
|
||||
{
|
||||
_list.addAll(DC.int64ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertInt64(int position, int value)
|
||||
{
|
||||
_list.insertAll(position, DC.int64ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addInt64Array(Int64List value)
|
||||
{
|
||||
_list.addAll(DC.int64ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertInt64Array(int position, Int64List value)
|
||||
{
|
||||
_list.insertAll(position, DC.int64ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addFloat32(double value)
|
||||
{
|
||||
_list.addAll(DC.float32ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertFloat32(int position, double value)
|
||||
{
|
||||
_list.insertAll(position, DC.float32ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addFloat32Array(Float32List value)
|
||||
{
|
||||
_list.addAll(DC.float32ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertFloat32Array(int position, Float32List value)
|
||||
{
|
||||
_list.insertAll(position, DC.float32ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
BinaryList addFloat64(double value)
|
||||
{
|
||||
_list.addAll(DC.float64ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertFloat64(int position, double value)
|
||||
{
|
||||
_list.insertAll(position, DC.float64ToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList addFloat64Array(Float64List value)
|
||||
{
|
||||
_list.addAll(DC.float64ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
BinaryList insertFloat64Array(int position, Float64List value)
|
||||
{
|
||||
_list.insertAll(position, DC.float64ArrayToBytes(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BinaryList add(type, value)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DataType.Bool:
|
||||
addBoolean(value);
|
||||
return this;
|
||||
case DataType.BoolArray:
|
||||
addBooleanArray(value);
|
||||
return this;
|
||||
case DataType.UInt8:
|
||||
addUint8(value);
|
||||
return this;
|
||||
case DataType.UInt8Array:
|
||||
addUint8Array(value);
|
||||
return this;
|
||||
case DataType.Int8:
|
||||
addInt8(value);
|
||||
return this;
|
||||
case DataType.Int8Array:
|
||||
addInt8Array(value);
|
||||
return this;
|
||||
case DataType.Char:
|
||||
addChar(value);
|
||||
return this;
|
||||
case DataType.CharArray:
|
||||
addCharArray(value);
|
||||
return this;
|
||||
case DataType.UInt16:
|
||||
addUint16(value);
|
||||
return this;
|
||||
case DataType.UInt16Array:
|
||||
addUint16Array(value);
|
||||
return this;
|
||||
case DataType.Int16:
|
||||
addInt16(value);
|
||||
return this;
|
||||
case DataType.Int16Array:
|
||||
addInt16Array(value);
|
||||
return this;
|
||||
case DataType.UInt32:
|
||||
addUint32(value);
|
||||
return this;
|
||||
case DataType.UInt32Array:
|
||||
addUint32Array(value);
|
||||
return this;
|
||||
case DataType.Int32:
|
||||
addInt32(value);
|
||||
return this;
|
||||
case DataType.Int32Array:
|
||||
addInt32Array(value);
|
||||
return this;
|
||||
case DataType.UInt64:
|
||||
addUint64(value);
|
||||
return this;
|
||||
case DataType.UInt64Array:
|
||||
addUint64Array(value);
|
||||
return this;
|
||||
case DataType.Int64:
|
||||
addInt64(value);
|
||||
return this;
|
||||
case DataType.Int64Array:
|
||||
addInt64Array(value);
|
||||
return this;
|
||||
|
||||
case DataType.Float32:
|
||||
addFloat32(value);
|
||||
return this;
|
||||
case DataType.Float32Array:
|
||||
addFloat32Array(value);
|
||||
return this;
|
||||
|
||||
case DataType.Float64:
|
||||
addFloat64(value);
|
||||
return this;
|
||||
case DataType.Float64Array:
|
||||
addFloat64Array(value);
|
||||
return this;
|
||||
|
||||
case DataType.String:
|
||||
addString(value);
|
||||
return this;
|
||||
case DataType.StringArray:
|
||||
addStringArray(value);
|
||||
return this;
|
||||
|
||||
case DataType.DateTime:
|
||||
addDateTime(value);
|
||||
return this;
|
||||
case DataType.DateTimeArray:
|
||||
addDateTimeArray(value);
|
||||
return this;
|
||||
|
||||
default:
|
||||
throw new Exception("Not Implemented " + type.ToString());
|
||||
//return this;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Convert the _list to an array of bytes
|
||||
/// </summary>
|
||||
/// <returns>Bytes array</returns>
|
||||
Uint8List toArray()
|
||||
{
|
||||
return Uint8List.fromList(_list);
|
||||
}
|
||||
|
||||
|
||||
DC toDC()
|
||||
{
|
||||
return new DC.fromUint8Array(toArray());
|
||||
}
|
||||
|
||||
|
||||
AsyncReply<dynamic> done()
|
||||
{
|
||||
return null;
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
AsyncReply<dynamic> done() {
|
||||
return AsyncReply.ready(null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user