Esempio n. 1
0
        public static LongRegister Parse(SqlString stringToParse)
        {
            if (stringToParse.IsNull)
            {
                return(Null);
            }

            var parsedLongRegisterData = stringToParse.Value.Split(",".ToCharArray());
            var parsedLongRegister     = new LongRegister()
            {
                Address = ModbusAddress.Parse(parsedLongRegisterData[0]), ByteSwap = bool.Parse(parsedLongRegisterData[1]), WordSwap = bool.Parse(parsedLongRegisterData[2]), Value = Int32.Parse(parsedLongRegisterData[3])
            };

            return(parsedLongRegister);
        }
Esempio n. 2
0
        public static LongRegisterArray Parse(SqlString stringToParse)
        {
            if (stringToParse.IsNull)
            {
                return(Null);
            }

            var parsedLongRegisterArray = new LongRegisterArray()
            {
                longRegisters = new List <LongRegister>()
            };

            var parsedString = stringToParse.Value.Split("|".ToCharArray());

            for (var i = 0; parsedString.Length > i; i++)
            {
                parsedLongRegisterArray.LongRegisters.Add(LongRegister.Parse(parsedString[i]));
            }

            return(parsedLongRegisterArray);
        }
Esempio n. 3
0
        public void Read(BinaryReader binaryReader)
        {
            LongRegisters.Clear();
            IsNull = binaryReader.ReadBoolean();

            if (IsNull)
            {
                return;
            }
            else
            {
                var length = binaryReader.ReadInt32();

                for (var i = 0; length > i; i++)
                {
                    var longRegister = new LongRegister();
                    longRegister.Read(binaryReader);
                    LongRegisters.Add(longRegister);
                }
            }
        }
Esempio n. 4
0
 public LongRegisterArray AddLongRegister(LongRegister longRegister)
 {
     LongRegisters.Add(longRegister);
     return(this);
 }