public void BytesToUInt64TransferTest( )
        {
            byte[] data = new byte[16];
            ReverseBytesByWord(BitConverter.GetBytes(1234567812123334123UL), byteTransform.DataFormat).CopyTo(data, 0);
            ReverseBytesByWord(BitConverter.GetBytes(92353421232423213UL), byteTransform.DataFormat).CopyTo(data, 8);

            ulong[] array = byteTransform.TransUInt64(data, 0, 2);
            Assert.AreEqual <ulong>(1234567812123334123UL, array[0]);
            Assert.AreEqual <ulong>(92353421232423213UL, array[1]);
        }
Example #2
0
        /// <summary>
        /// 读取指定地址的ulong数组
        /// </summary>
        /// <param name="address">起始地址,格式为"1234"</param>
        /// <param name="length">数组长度</param>
        /// <returns>带有成功标志的ulong数据</returns>
        public OperateResult <ulong[]> ReadUInt64(string address, ushort length)
        {
            OperateResult <byte[]> read = Read(address, (ushort)(length * 4));

            if (!read.IsSuccess)
            {
                return(OperateResult.CreateFailedResult <ulong[]>(read));
            }
            return(OperateResult.CreateSuccessResult(byteTransform.TransUInt64(read.Content, 0, length)));
        }