Exemplo n.º 1
0
        private void SetValueFromParam(string paramName, dynamic value)
        {
            var param = GetPropertyInfo(paramName);

            if (param != null)
            {
                NetworkPackageValue paramValue = GetNetworkPackageValue(paramName);
                paramValue.Value = value;
                SetByteValues(paramValue, value);
            }
        }
Exemplo n.º 2
0
        private List <NetworkPackageValue> GetNetworkPackageValues()
        {
            List <NetworkPackageValue> packageValues = new List <NetworkPackageValue>();

            List <string> paramaters = GetPropertiesNames();

            foreach (var param in paramaters)
            {
                NetworkPackageValue value = GetNetworkPackageValue(param);
                packageValues.Add(value);
            }

            packageValues = packageValues.OrderBy(x => x.RowNumber).ToList();

            return(packageValues);
        }
Exemplo n.º 3
0
        private void SetByteValues(NetworkPackageValue paramValue, dynamic value)
        {
            dynamic converter = GetConverter(value.GetType());

            if (converter != null)
            {
                int byteCount = paramValue.ByteCount;

                if (byteCount <= 1)
                {
                    paramValue.ByteValue = ConverToByte(converter, value);
                }
                else
                {
                    paramValue.ByteArrayValue = ConverToByteArray(converter, value, byteCount);
                }
            }
        }
 private void SetByteArrayValues(NetworkPackageValue value, byte[] bytes, dynamic converter)
 {
     byte[] range = bytes.ToList().GetRange(value.RowNumber - 1, value.ByteCount).ToArray();
     value.Value          = ConvertToByteArray(converter, range);
     value.ByteArrayValue = range;
 }