|
|
|
@ -80,12 +80,12 @@ public static class ModelConvert
|
|
|
|
|
else if (propertyType == FLOAT)
|
|
|
|
|
{
|
|
|
|
|
field.SetValue(t,
|
|
|
|
|
Convert.ChangeType(BitUtls.Byte2Float(bytes, start, length, scale) - offset, propertyType), null);
|
|
|
|
|
Convert.ChangeType(Math.Round(BitUtls.Byte2Float(bytes, start, length, scale) - offset, attribute.Round), propertyType), null);
|
|
|
|
|
}
|
|
|
|
|
else if (propertyType == DOUBLE)
|
|
|
|
|
{
|
|
|
|
|
field.SetValue(t,
|
|
|
|
|
Convert.ChangeType(BitUtls.Byte2Double(bytes, start, length, scale) - offset, propertyType), null);
|
|
|
|
|
Convert.ChangeType(Math.Round(BitUtls.Byte2Double(bytes, start, length, scale) - offset, attribute.Round), propertyType), null);
|
|
|
|
|
}
|
|
|
|
|
else if (propertyType == STRING)
|
|
|
|
|
{
|
|
|
|
@ -129,10 +129,11 @@ public static class ModelConvert
|
|
|
|
|
byte[] value = GetPropertyValue(t, field, attribute);
|
|
|
|
|
start = attribute.Start;
|
|
|
|
|
length = PropertyReadConstant.Byte == attribute.Type ? attribute.Length * 8 : attribute.Length;
|
|
|
|
|
length = length > value.Length * 8 ? value.Length * 8 : length;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < length; i++)
|
|
|
|
|
{
|
|
|
|
|
bitArray[start + i] = (value[i % 8] & (1 << i % 8)) > 0;
|
|
|
|
|
bitArray[start + i] = (value[i / 8] & (1 << i % 8)) > 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|