Пример #1
0
        /// <summary>
        /// Writes the <see cref="AllianceDataResponseMessage"/> to the specified <see cref="MessageWriter"/>.
        /// </summary>
        /// <param name="writer">
        /// <see cref="MessageWriter"/> that will be used to write the <see cref="AllianceDataResponseMessage"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="writer"/> is null.</exception>
        public override void WriteMessage(MessageWriter writer)
        {
            ThrowIfWriterNull(writer);

            if (Clan == null)
            {
                throw new InvalidOperationException("Clan cannot be null.");
            }

            Clan.WriteMessageComponent(writer);
            writer.Write(Description);

            writer.Write(Unknown1);

            var inWar = WarId != 0;

            writer.Write(inWar);
            if (inWar)
            {
                writer.Write(WarId);
            }

            writer.Write(Unknown2);
            writer.Write(Unknown3);

            if (Members == null)
            {
                writer.Write(0);
            }
            else
            {
                var count = Members.Length;
                writer.Write(count);
                for (int i = 0; i < count; i++)
                {
                    var member = Members[i];
                    if (member == null)
                    {
                        throw new InvalidOperationException("Encountered null ClanMemberMesasgeComponent.");
                    }

                    member.WriteMessageComponent(writer);
                }
            }

            writer.Write(Unknown4);
            writer.Write(Unknown5);
        }
        /// <summary>
        /// Writes the <see cref="AllianceFullEntryMessage"/> to the specified <see cref="MessageWriter"/>.
        /// </summary>
        /// <param name="writer">
        /// <see cref="MessageWriter"/> that will be used to write the <see cref="AllianceFullEntryMessage"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="writer"/> is null.</exception>
        public override void WriteMessage(MessageWriter writer)
        {
            ThrowIfWriterNull(writer);

            if (Clan == null)
            {
                throw new InvalidOperationException("Clan cannot be null.");
            }

            writer.Write(Description);
            writer.Write(Unknown1);
            writer.Write(Unknown2);

            var inWar = WarId != 0;

            writer.Write(inWar);
            if (inWar)
            {
                writer.Write(WarId);
            }

            Clan.WriteMessageComponent(writer);
        }