wyUpdate.Common.WriteFiles.WriteShort C# (CSharp) Method

WriteShort() public static method

public static WriteShort ( Stream fs, byte flag, short val ) : void
fs Stream
flag byte
val short
return void
        public static void WriteShort(Stream fs, byte flag, short val)
        {
            //write the flag (e.g. 0x01, 0xFF, etc.)
            fs.WriteByte(flag);

            //write the size of the data (Long = 2bytes)
            fs.Write(BitConverter.GetBytes(2), 0, 4);

            // write the integer data
            fs.Write(BitConverter.GetBytes(val), 0, 2);
        }