Ejemplo n.º 1
0
        public void GetInt16ResultFromBytesTest( )
        {
            OperateResult <short> result = ByteTransformHelper.GetInt16ResultFromBytes(
                OperateResult.CreateSuccessResult(BitConverter.GetBytes((short)12345)), byteTransform);

            Assert.IsTrue(result.IsSuccess && result.Content == 12345);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 将指定的OperateResult类型转化
 /// </summary>
 /// <param name="result">原始的类型</param>
 /// <returns>转化后的类型</returns>
 protected OperateResult <short> GetInt16ResultFromBytes(OperateResult <byte[]> result)
 {
     return(ByteTransformHelper.GetInt16ResultFromBytes(result, byteTransform));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 读取指定地址的short数据
 /// </summary>
 /// <param name="address">起始地址,格式为"1234"</param>
 /// <returns>带有成功标志的short数据</returns>
 public OperateResult <short> ReadInt16(string address)
 {
     return(ByteTransformHelper.GetInt16ResultFromBytes(Read(address, 1), ByteTransform));
 }