Ejemplo n.º 1
0
        /// <inheritdoc />
        public byte[] GetBytes()
        {
            var bytes = new List <byte>();

            bytes.AddRange(Basic.GetBytes());               //  12 bytes
            bytes.AddRange(Assign.GetBytes());              //   2 bytes
            bytes.AddRange(Amplifier.GetBytes());           //   8 bytes
            bytes.AddRange(Output.GetBytes());              //   6 bytes
            bytes.AddRange(Expression.GetBytes());          //   4 bytes (3 + 1 reserve)
            bytes.AddRange(VelocityControl.GetBytes());     //   1 byte

            foreach (var wmt in Wmts)
            {
                bytes.AddRange(wmt.GetBytes());             // 116 bytes (29 bytes each)
            }
            bytes.AddRange(Pitch.GetBytes());               //  13 bytes
            bytes.AddRange(Tvf.GetBytes());                 //  20 bytes
            bytes.AddRange(Tva.GetBytes());                 //  11 bytes
            bytes.AddRange(Other.GetBytes());               //   2 bytes

            return(bytes.ToArray());
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public void CopyFrom(byte[] data)
        {
            if (data.Length != DumpLength)
            {
                throw new InvalidDumpSizeException(DumpLength, data.Length);
            }

            Basic.CopyFrom(data.Take(12).ToArray());
            Assign.CopyFrom(data.Skip(12).Take(2).ToArray());
            Amplifier.CopyFrom(data.Skip(14).Take(8).ToArray());
            Output.CopyFrom(data.Skip(22).Take(6).ToArray());
            Expression.CopyFrom(data.Skip(28).Take(4).ToArray());
            VelocityControl.CopyFrom(data.Skip(32).Take(1).ToArray());

            for (var i = 0; i < Wmts.Length; i++)
            {
                Wmts[i].CopyFrom(data.Skip(33 + i * 29).Take(29).ToArray());
            }

            Pitch.CopyFrom(data.Skip(149).Take(13).ToArray());
            Tvf.CopyFrom(data.Skip(162).Take(20).ToArray());
            Tva.CopyFrom(data.Skip(182).Take(11).ToArray());
            Other.CopyFrom(data.Skip(193).Take(2).ToArray());
        }