GIFToWoWTexture/GIFConverter/TGASharpLib.cs
/// <summary>
/// Convert <see cref="TgaDevArea"/> (without Fields Data, only Directory!) to byte array.
/// </summary>
/// <returns>Byte array, Len = (NUMBER_OF_TAGS_IN_THE_DIRECTORY * 10) + 2 bytes in size.
/// The "+ 2" includes the 2 bytes for the number of tags in the directory.</returns>
Convert  (without Fields Data, only Directory!) to byte array.
Convert ( without Fields Data only Directory! ) to byte array .
public byte[] ToBytes()
        {
            if (entries == null)
                throw new Exception(nameof(Entries) + " = null!");
            ushort NumberOfEntries = (ushort)Math.Min(ushort.MaxValue, entries.Count);
            List<byte> DevDir = new List<byte>(BitConverter.GetBytes(NumberOfEntries));
            for (int i = 0; i < entries.Count; i++)
            {
                DevDir.AddRange(BitConverter.GetBytes(entries[i].Tag));
                DevDir.AddRange(BitConverter.GetBytes(entries[i].Offset));
                DevDir.AddRange(BitConverter.GetBytes(entries[i].FieldSize));
            }
            return DevDir.ToArray();
        }
public byte [ ] ToBytes ( ) { if ( entries == null ) throw new Exception ( nameof ( Entries ) + " " ) ; ushort NumberOfEntries = ( ushort ) Math . Min ( ushort . MaxValue , entries . Count ) ; List < byte > DevDir = new List < byte > ( BitConverter . GetBytes ( NumberOfEntries ) ) ; for ( int i = 0 ; i < entries . Count ; i ++ ) { DevDir . AddRange ( BitConverter . GetBytes ( entries [ i ] . Tag ) ) ; DevDir . AddRange ( BitConverter . GetBytes ( entries [ i ] . Offset ) ) ; DevDir . AddRange ( BitConverter . GetBytes ( entries [ i ] . FieldSize ) ) ; } return DevDir . ToArray ( ) ; }
Convert  (without Fields Data, only Directory!)
Convert ( without Fields Data only Directory! )
Byte array, Len = (NUMBER_OF_TAGS_IN_THE_DIRECTORY * 10) + 2 bytes in size.
The "+ 2" includes the 2 bytes for the number of tags in the directory.
Byte array Len = ( NUMBER_OF_TAGS_IN_THE_DIRECTORY * 10 ) + 2 bytes in size . The " + 2 " includes the 2 bytes for the number of tags in the directory .