public BookHeader( Mobile from, BaseBook book ) : base ( 0xD4 )
{
string title = book.Title == null ? "" : book.Title;
string author = book.Author == null ? "" : book.Author;
byte[] titleBuffer = Utility.UTF8.GetBytes( title );
byte[] authorBuffer = Utility.UTF8.GetBytes( author );
EnsureCapacity( 15 + titleBuffer.Length + authorBuffer.Length );
m_Stream.Write( (int) book.Serial );
m_Stream.Write( (bool) true );
m_Stream.Write( (bool) book.Writable && from.InRange( book.GetWorldLocation(), 1 ) );
m_Stream.Write( (ushort) book.PagesCount );
m_Stream.Write( (ushort) (titleBuffer.Length + 1) );
m_Stream.Write( titleBuffer, 0, titleBuffer.Length );
m_Stream.Write( (byte) 0 ); // terminate
m_Stream.Write( (ushort) (authorBuffer.Length + 1) );
m_Stream.Write( authorBuffer, 0, authorBuffer.Length );
m_Stream.Write( (byte) 0 ); // terminate
}
}