public void GetUInt64ResultFromBytesTest( ) { OperateResult <ulong> result = ByteTransformHelper.GetUInt64ResultFromBytes( OperateResult.CreateSuccessResult(BitConverter.GetBytes(5234512311231234UL)), byteTransform); Assert.IsTrue(result.IsSuccess && result.Content == 5234512311231234UL); }
/// <summary> /// 将指定的OperateResult类型转化 /// </summary> /// <param name="result">原始的类型</param> /// <returns>转化后的类型</returns> protected OperateResult <ulong> GetUInt64ResultFromBytes(OperateResult <byte[]> result) { return(ByteTransformHelper.GetUInt64ResultFromBytes(result, byteTransform)); }
/// <summary> /// 读取指定地址的ulong数据 /// </summary> /// <param name="address">起始地址,格式为"1234"</param> /// <returns>带有成功标志的ulong数据</returns> public OperateResult <ulong> ReadUInt64(string address) { return(ByteTransformHelper.GetUInt64ResultFromBytes(Read(address, 4), ByteTransform)); }
/// <summary> /// 读取设备的ulong类型的数据 /// </summary> /// <param name="address">起始地址</param> /// <returns>带成功标志的结果数据对象</returns> public OperateResult <ulong> ReadUInt64(string address) { return(ByteTransformHelper.GetUInt64ResultFromBytes(Read(address, (ushort)(4 * WordLength)), byteTransform)); }