KeePassLib.Serialization.Kdb4File.WriteHeaderField C# (CSharp) Method

WriteHeaderField() private static method

private static WriteHeaderField ( BinaryWriter bwOut, Kdb4HeaderFieldID kdbID, byte pbData ) : void
bwOut BinaryWriter
kdbID Kdb4HeaderFieldID
pbData byte
return void
        private static void WriteHeaderField(BinaryWriter bwOut,
            Kdb4HeaderFieldID kdbID, byte[] pbData)
        {
            Debug.Assert(bwOut != null);
            if(bwOut == null) throw new ArgumentNullException("bwOut");

            bwOut.Write((byte)kdbID);

            if(pbData != null)
            {
                ushort uLength = (ushort)pbData.Length;
                bwOut.Write(uLength);

                if(uLength > 0) bwOut.Write(pbData);
            }
            else bwOut.Write((ushort)0);
        }