/// <summary>
 /// Writes a <see cref="GuildMemberNameRank"/> to a <see cref="IValueWriter"/>.
 /// </summary>
 /// <param name="writer">The <see cref="IValueWriter"/> to write the <paramref name="value"/> to.</param>
 /// <param name="name">Unique name of the <paramref name="value"/> that will be used to distinguish it
 /// from other values when reading.</param>
 /// <param name="value">The <see cref="GuildMemberNameRank"/> to write.</param>
 public static void Write(this IValueWriter writer, string name, GuildMemberNameRank value)
 {
     if (writer.SupportsNameLookup)
     {
         if (writer.SupportsNodes)
         {
             // Write out using a child node
             writer.WriteStartNode(name);
             writer.Write(_nameValueKey, value.Name);
             writer.Write(_rankValueKey, value.Rank);
             writer.WriteEndNode(name);
         }
         else
         {
             // Concat the values together so name lookup still works
             var s = value.Name + _concatDelimiter + value.Rank;
             writer.Write(name, s);
         }
     }
     else
     {
         // No need for name lookup, so just write out raw
         writer.Write(null, value.Name);
         writer.Write(null, value.Rank);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Appends a message to a <see cref="BitStream"/> for synchronizing the client's guild information for when
 /// a member's rank changes.
 /// The message is then read and handled by the receiver using <see cref="UserGuildInformation.Read"/>.
 /// </summary>
 /// <param name="pw">The <see cref="BitStream"/> to append the message to.</param>
 /// <param name="member">The guild member who's rank changed.</param>
 public static void WriteUpdateMemberRank(BitStream pw, GuildMemberNameRank member)
 {
     pw.WriteEnum(GuildInfoMessages.UpdateRank);
     pw.Write(null, member);
 }
Beispiel #3
0
 /// <summary>
 /// Appends a message to a <see cref="BitStream"/> for synchronizing the client's guild information for when
 /// a member is added to the guild.
 /// The message is then read and handled by the receiver using <see cref="UserGuildInformation.Read"/>.
 /// </summary>
 /// <param name="pw">The <see cref="BitStream"/> to append the message to.</param>
 /// <param name="member">The guild member that was added.</param>
 public static void WriteAddMember(BitStream pw, GuildMemberNameRank member)
 {
     pw.WriteEnum(GuildInfoMessages.AddMember);
     pw.Write(null, member);
 }
Beispiel #4
0
 /// <summary>
 /// When overridden in the derived class, allows for additional handling the corresponding event without
 /// the overhead of using event hooks. Therefore, it is recommended that this overload is used instead of
 /// the corresponding event when possible.
 /// </summary>
 /// <param name="member">The member the event is related to.</param>
 protected virtual void OnMemberRankUpdated(GuildMemberNameRank member)
 {
 }
Beispiel #5
0
 /// <summary>
 /// When overridden in the derived class, allows for additional handling the corresponding event without
 /// the overhead of using event hooks. Therefore, it is recommended that this overload is used instead of
 /// the corresponding event when possible.
 /// </summary>
 /// <param name="member">The member the event is related to.</param>
 protected virtual void OnMemberAdded(GuildMemberNameRank member)
 {
 }