public BBMessageHeader(BaseBulletinBoard board, BulletinMessage msg) : base(0x71) { var poster = SafeString(msg.PostedName); var subject = SafeString(msg.Subject); var time = SafeString(msg.GetTimeAsString()); EnsureCapacity(22 + poster.Length + subject.Length + time.Length); Stream.Write((byte)0x01); // PacketID Stream.Write(board.Serial); // Bulletin board serial Stream.Write(msg.Serial); // Message serial var thread = msg.Thread; if (thread == null) { Stream.Write(0); // Thread serial--root } else { Stream.Write(thread.Serial); // Thread serial--parent } WriteString(poster); WriteString(subject); WriteString(time); }
public BBMessageHeader(BaseBulletinBoard board, BulletinMessage msg) : base(0x71) { string poster = this.SafeString(msg.PostedName); string subject = this.SafeString(msg.Subject); string time = this.SafeString(msg.GetTimeAsString()); this.EnsureCapacity(22 + poster.Length + subject.Length + time.Length); this.m_Stream.Write((byte)0x01); // PacketID this.m_Stream.Write((int)board.Serial); // Bulletin board serial this.m_Stream.Write((int)msg.Serial); // Message serial BulletinMessage thread = msg.Thread; if (thread == null) { this.m_Stream.Write((int)0); // Thread serial--root } else { this.m_Stream.Write((int)thread.Serial); // Thread serial--parent } this.WriteString(poster); this.WriteString(subject); this.WriteString(time); }
public BBMessageContent(BaseBulletinBoard board, BulletinMessage msg) : base(0x71) { string poster = SafeString(msg.PostedName); string subject = SafeString(msg.Subject); string time = SafeString(msg.GetTimeAsString()); EnsureCapacity(22 + poster.Length + subject.Length + time.Length); m_Stream.Write((byte)0x02); // PacketID m_Stream.Write((int)board.Serial); // Bulletin board serial m_Stream.Write((int)msg.Serial); // Message serial WriteString(poster); WriteString(subject); WriteString(time); m_Stream.Write((short)msg.PostedBody); m_Stream.Write((short)msg.PostedHue); int len = msg.PostedEquip.Length; if (len > 255) { len = 255; } m_Stream.Write((byte)len); for (int i = 0; i < len; ++i) { WriteString(msg.Lines[i], true); } }
public BBMessageContent(BaseBulletinBoard board, BulletinMessage msg) : base(0x71) { var poster = SafeString(msg.PostedName); var subject = SafeString(msg.Subject); var time = SafeString(msg.GetTimeAsString()); EnsureCapacity(22 + poster.Length + subject.Length + time.Length); Stream.Write((byte)0x02); // PacketID Stream.Write(board.Serial); // Bulletin board serial Stream.Write(msg.Serial); // Message serial WriteString(poster); WriteString(subject); WriteString(time); Stream.Write((short)msg.PostedBody); Stream.Write((short)msg.PostedHue); var len = msg.PostedEquip.Length; if (len > 255) { len = 255; } Stream.Write((byte)len); for (var i = 0; i < len; ++i) { var eq = msg.PostedEquip[i]; Stream.Write((short)eq.itemID); Stream.Write((short)eq.hue); } len = msg.Lines.Length; if (len > 255) { len = 255; } Stream.Write((byte)len); for (var i = 0; i < len; ++i) { WriteString(msg.Lines[i], true); } }
public BBMessageHeader( BaseBulletinBoard board, BulletinMessage msg ) : base(0x71) { string poster = SafeString( msg.PostedName ); string subject = SafeString( msg.Subject ); string time = SafeString( msg.GetTimeAsString() ); EnsureCapacity( 22 + poster.Length + subject.Length + time.Length ); m_Stream.Write( (byte) 0x01 ); // PacketID m_Stream.Write( (int) board.Serial ); // Bulletin board serial m_Stream.Write( (int) msg.Serial ); // Message serial BulletinMessage thread = msg.Thread; if ( thread == null ) m_Stream.Write( (int) 0 ); // Thread serial--root else m_Stream.Write( (int) thread.Serial ); // Thread serial--parent WriteString( poster ); WriteString( subject ); WriteString( time ); }
public BBMessageContent( BaseBulletinBoard board, BulletinMessage msg ) : base(0x71) { string poster = SafeString( msg.PostedName ); string subject = SafeString( msg.Subject ); string time = SafeString( msg.GetTimeAsString() ); EnsureCapacity( 22 + poster.Length + subject.Length + time.Length ); m_Stream.Write( (byte) 0x02 ); // PacketID m_Stream.Write( (int) board.Serial ); // Bulletin board serial m_Stream.Write( (int) msg.Serial ); // Message serial WriteString( poster ); WriteString( subject ); WriteString( time ); m_Stream.Write( (short) msg.PostedBody ); m_Stream.Write( (short) msg.PostedHue ); int len = msg.PostedEquip.Length; if ( len > 255 ) len = 255; m_Stream.Write( (byte) len ); for ( int i = 0; i < len; ++i ) { BulletinEquip eq = msg.PostedEquip[i]; m_Stream.Write( (short) eq.itemID ); m_Stream.Write( (short) eq.hue ); } len = msg.Lines.Length; if ( len > 255 ) len = 255; m_Stream.Write( (byte) len ); for ( int i = 0; i < len; ++i ) WriteString( msg.Lines[i] ); }