public static FloatRegister Parse(SqlString stringToParse) { if (stringToParse.IsNull) { return(Null); } var parsedFloatRegisterData = stringToParse.Value.Split(",".ToCharArray()); var parsedFloatRegister = new FloatRegister() { Address = ModbusAddress.Parse(parsedFloatRegisterData[0]), ByteSwap = bool.Parse(parsedFloatRegisterData[1]), WordSwap = bool.Parse(parsedFloatRegisterData[2]), Value = Int32.Parse(parsedFloatRegisterData[3]) }; return(parsedFloatRegister); }
public static FloatRegisterArray Parse(SqlString stringToParse) { if (stringToParse.IsNull) { return(Null); } var parsedFloatRegisterArray = new FloatRegisterArray() { floatRegisters = new List <FloatRegister>() }; var parsedString = stringToParse.Value.Split("|".ToCharArray()); for (var i = 0; parsedString.Length > i; i++) { parsedFloatRegisterArray.FloatRegisters.Add(FloatRegister.Parse(parsedString[i])); } return(parsedFloatRegisterArray); }
public void Read(BinaryReader binaryReader) { FloatRegisters.Clear(); IsNull = binaryReader.ReadBoolean(); if (IsNull) { return; } else { var length = binaryReader.ReadInt32(); for (var i = 0; length > i; i++) { var floatRegister = new FloatRegister(); floatRegister.Read(binaryReader); FloatRegisters.Add(floatRegister); } } }
public FloatRegisterArray AddFloatRegister(FloatRegister floatRegister) { FloatRegisters.Add(floatRegister); return(this); }