public static byte[] GetUInt32Bytes(UInt32 value, FFEndianType endian) { FFUInt32 ffValue = new FFUInt32() { Value = value }; byte[] result = new byte[4]; if ((endian == FFEndianType.BigEndian && SystemEndianType == FFEndianType.LittleEndian) || (endian == FFEndianType.LittleEndian && SystemEndianType == FFEndianType.BigEndian)) { result[0] = ffValue.Value4; result[1] = ffValue.Value3; result[2] = ffValue.Value2; result[3] = ffValue.Value1; } else { result[0] = ffValue.Value1; result[1] = ffValue.Value2; result[2] = ffValue.Value3; result[3] = ffValue.Value4; } return(result); }
public static UInt32 GetUInt32(byte[] value, FFEndianType endian, int offset, int length) { FFUInt32 ffValue = new FFUInt32(); if (endian == FFEndianType.BigEndian) { ffValue.Value1 = value[0]; ffValue.Value2 = value[1]; ffValue.Value3 = value[2]; ffValue.Value4 = value[3]; } else { ffValue.Value1 = value[3]; ffValue.Value2 = value[2]; ffValue.Value3 = value[1]; ffValue.Value4 = value[0]; } return(ffValue.Value); }
public static byte[] GetUInt32Bytes(UInt32 value, FFEndianType endian) { FFUInt32 ffValue = new FFUInt32() { Value = value }; byte[] result = new byte[4]; if ((endian == FFEndianType.BigEndian && SystemEndianType == FFEndianType.LittleEndian) || (endian == FFEndianType.LittleEndian && SystemEndianType == FFEndianType.BigEndian)) { result[0] = ffValue.Value4; result[1] = ffValue.Value3; result[2] = ffValue.Value2; result[3] = ffValue.Value1; } else { result[0] = ffValue.Value1; result[1] = ffValue.Value2; result[2] = ffValue.Value3; result[3] = ffValue.Value4; } return result; }
public static UInt32 GetUInt32(byte[] value, FFEndianType endian, int offset, int length) { FFUInt32 ffValue = new FFUInt32(); if (endian == FFEndianType.BigEndian) { ffValue.Value1 = value[0]; ffValue.Value2 = value[1]; ffValue.Value3 = value[2]; ffValue.Value4 = value[3]; } else { ffValue.Value1 = value[3]; ffValue.Value2 = value[2]; ffValue.Value3 = value[1]; ffValue.Value4 = value[0]; } return ffValue.Value; }