public static UInt16 GetUInt16(byte[] value, FFEndianType endian, int offset, int length) { FFUInt16 ffValue = new FFUInt16(); if (endian == FFEndianType.BigEndian) { ffValue.Value1 = value[0]; ffValue.Value2 = value[1]; } else { ffValue.Value1 = value[1]; ffValue.Value2 = value[0]; } return ffValue.Value; }
public static UInt16 GetUInt16(byte[] value, FFEndianType endian, int offset, int length) { FFUInt16 ffValue = new FFUInt16(); if (endian == FFEndianType.BigEndian) { ffValue.Value1 = value[0]; ffValue.Value2 = value[1]; } else { ffValue.Value1 = value[1]; ffValue.Value2 = value[0]; } return(ffValue.Value); }
public static byte[] GetUInt16Bytes(UInt16 value, FFEndianType endian) { FFUInt16 ffValue = new FFUInt16() { Value = value }; byte[] result = new byte[2]; if ((endian == FFEndianType.BigEndian && SystemEndianType == FFEndianType.LittleEndian) || (endian == FFEndianType.LittleEndian && SystemEndianType == FFEndianType.BigEndian)) { result[0] = ffValue.Value2; result[1] = ffValue.Value1; } else { result[0] = ffValue.Value1; result[1] = ffValue.Value2; } return(result); }
public static byte[] GetUInt16Bytes(UInt16 value, FFEndianType endian) { FFUInt16 ffValue = new FFUInt16() { Value = value }; byte[] result = new byte[2]; if ((endian == FFEndianType.BigEndian && SystemEndianType == FFEndianType.LittleEndian) || (endian == FFEndianType.LittleEndian && SystemEndianType == FFEndianType.BigEndian)) { result[0] = ffValue.Value2; result[1] = ffValue.Value1; } else { result[0] = ffValue.Value1; result[1] = ffValue.Value2; } return result; }