Exemplo n.º 1
0
        /// <summary>
        /// Method for pulling an unsigned integer from the byte array.
        /// </summary>
        /// <param name="data">the byte array</param>
        /// <param name="offset">index where to start pulling from the array</param>
        /// <returns>returns a 4-byte unsigned integer</returns>
        internal static UInt32 popUnsignedInteger(ref byte[] data, ref Int32 offset)
        {
            if (data.Length - offset < 4)
            {
                return(0);
            }

            UInt32 ret = AoConvert.NetworkToHostOrder(BitConverter.ToUInt32(data, offset));

            offset += 4;
            return(ret);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor for outgoing messages
        /// </summary>
        /// <param name="PrivateGroupID">the id of the buddy who is hosting the private group</param>
        /// <param name="FormattedText">The contents of the message.  Can contain click links and color formatting in HTML.</param>
        /// <param name="VoiceCommand">The voice command to send, if any.  Can be null.</param>
        internal PrivateGroupMessagePacket(UInt32 PrivateGroupID, String FormattedText, VoiceBlob VoiceCommand) :
            base(Packet.Type.PRIVGRP_MSG)
        {
            this.AddData(AoConvert.HostToNetworkOrder(PrivateGroupID));
            this.AddData(new AoString(FormattedText));

            if (VoiceCommand == null)
            {
                this.AddData(new AoString("\0"));
            }
            else
            {
                this.AddData(VoiceCommand);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor used for outgoing packets
        /// </summary>
        /// <param name="id">The character id of the buddy</param>
        /// <param name="AddBuddy">boolean, whether to add or remove buddy</param>
        /// <param name="TempBuddy">boolean, whether to add as temp buddy</param>
        internal BuddyStatusPacket(UInt32 id, bool AddBuddy, bool TempBuddy)
            :
            base((AddBuddy ? Packet.Type.BUDDY_ADD : Packet.Type.BUDDY_REMOVE))
        {
            this.AddData(AoConvert.HostToNetworkOrder(id));

            // if the buddy is to be added, you need to send a string containing "1"
            // if the buddy is to be removed, you need to send an empty packet
            if (AddBuddy && TempBuddy)
            {
                this.AddData(new AoString("0"));
            }
            else if (AddBuddy)
            {
                this.AddData(new AoString("1"));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructor for outgoing packet data
        /// </summary>
        /// <param name="BuddyID">The id of the buddy to who to send the message.</param>
        /// <param name="FormattedText">The contents of the message.  Can contain click links and color formatting in HTML.</param>
        /// <param name="VoiceCommand">The Voice command to send, if any.  Can be null.</param>
        internal TellPacket(UInt32 BuddyID, String FormattedText, VoiceBlob VoiceCommand) :
            base(Packet.Type.MSG_PRIVATE)
        {
            this._buddyID = BuddyID;
            this._message = new AoString(FormattedText);

            this.AddData(AoConvert.HostToNetworkOrder(this._buddyID));
            this.AddData(this._message);

            if (VoiceCommand == null)
            {
                this.AddData(new AoString("\0"));
            }
            else
            {
                this.AddData(VoiceCommand);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Constructor for outgoing packets
 /// </summary>
 /// <param name="PrivateGroupID">id of the private group</param>
 /// <param name="Join">whether to join or part</param>
 internal PrivateGroupJoinPacket(UInt32 PrivateGroupID, bool Join) :
     base((Join ? Packet.Type.PRIVGRP_JOIN : Packet.Type.PRIVGRP_PART))
 {
     this.AddData(AoConvert.HostToNetworkOrder(PrivateGroupID));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Constructor for outgoing packets
 /// </summary>
 /// <param name="type">the Packet.Type of the packet</param>
 /// <param name="id">the id to send</param>
 internal SimpleIdPacket(Packet.Type type, UInt32 id) : base(type)
 {
     this.AddData(AoConvert.HostToNetworkOrder(id));
 }