public virtual void WriteFourCC(string data) { if (order == ByteOrder.LittleEndian) { Write(EndianSwap.ReverseString(data), false); } else { Write(data, false); } }
public virtual string ReadFourCC() { string fourcc = ReadString(4); if (order == ByteOrder.LittleEndian) { return(EndianSwap.ReverseString(fourcc)); } else { return(fourcc); } }
protected byte[] ByteSwap(byte[] bytes) { if (order == ByteOrder.BigEndian) { switch (bytes.Length) { case 2: EndianSwap.ByteSwap2(bytes); break; case 4: EndianSwap.ByteSwap4(bytes); break; case 8: EndianSwap.ByteSwap8(bytes); break; default: throw new NotSupportedException("Stream lengths other than 2, 4, and 8 are invalid for an endian swap."); } } return(bytes); }