Exemplo n.º 1
0
        public void GetInt64ResultFromBytesTest( )
        {
            OperateResult <long> result = ByteTransformHelper.GetInt64ResultFromBytes(
                OperateResult.CreateSuccessResult(BitConverter.GetBytes(5234512311231234L)), byteTransform);

            Assert.IsTrue(result.IsSuccess && result.Content == 5234512311231234L);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 将指定的OperateResult类型转化
 /// </summary>
 /// <param name="result">原始的类型</param>
 /// <returns>转化后的类型</returns>
 protected OperateResult <long> GetInt64ResultFromBytes(OperateResult <byte[]> result)
 {
     return(ByteTransformHelper.GetInt64ResultFromBytes(result, byteTransform));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 读取指定地址的long数据
 /// </summary>
 /// <param name="address">起始地址,格式为"1234"</param>
 /// <returns>带有成功标志的long数据</returns>
 public OperateResult <long> ReadInt64(string address)
 {
     return(ByteTransformHelper.GetInt64ResultFromBytes(Read(address, 4), ByteTransform));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 读取设备的long类型的数据
 /// </summary>
 /// <param name="address">起始地址</param>
 /// <returns>带成功标志的结果数据对象</returns>
 public OperateResult <long> ReadInt64(string address)
 {
     return(ByteTransformHelper.GetInt64ResultFromBytes(Read(address, (ushort)(4 * WordLength)), byteTransform));
 }