All pastes #384730 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-03-07 08:40 UTC
rendered paste body
using UniSphere.Common.VariableTypes;
using UniSphere.Messaging.Messages;
using UniSphere.Messaging.Messages.Interfaces;

namespace UniSphere.Common.Messaging.Messages.RenderSpecific
{
    public class SkyBoxMessageResponse : BaseResponseMessage<SkyBoxResponseCode>
    {
                /// <summary>
        /// Indicates the Type Identifier for this message.
        /// </summary>
        /// <returns></returns>
        public override SUInt16 GetMessageTypeId()
        {
            return new SUInt16((ushort)GetEnumMessageType());
        }

        /// <summary>
        /// Gets the type of the enumerated message.
        /// </summary>
        /// <returns></returns>
        public override enumMessageType GetEnumMessageType()
        {
            return enumMessageType.SKYBOX_RESPONSE_MESSAGE;
        }
 

        #region Constructors

        /// <author>Sjef van Leeuwen 21-1-2007 14:00</author>
        public SkyBoxMessageResponse(SkyBoxResponseCode responseCode, uint lifeformId, string left, string right, string top, string bottom, string front, string back) 
            : base(responseCode, 
                   new object[]
                       {
                           new SUInt16((ushort)responseCode),
                           new SUInt32(lifeformId),
                           new SString(left),
                           new SString(right),
                           new SString(top), 
                           new SString(bottom),
                           new SString(front),
                           new SString(back)
                       })
        {}

        /// <summary>
        /// Initializes a new instance of the <see cref="SkyBoxMessageResponse"/> class.
        /// </summary>
        /// <param name="responseCode">The response code.</param>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <param name="top">The top.</param>
        /// <param name="bottom">The bottom.</param>
        /// <param name="front">The front.</param>
        /// <param name="back">The back.</param>
        /// <author>Sjef van Leeuwen 19-2-2007 14:21</author>
        internal SkyBoxMessageResponse(SUInt16 responseCode, SUInt32 lifeformId, SString left, SString right, SString top, SString bottom, SString front, SString back)
            : base(responseCode, new object[]
                                     {   
                                         responseCode, lifeformId, left,right,top,bottom,front,back
                                     })
        { }
        
        #endregion

        #region Properties

        /// <summary>
        /// Gets the lifeform id.
        /// </summary>
        /// <value>The lifeform id.</value>
        /// <author>Sjef van Leeuwen 20-2-2007 20:18</author>
        public SUInt32 LifeformId
        {
            get { return (SUInt32)_parameters[1]; }
        }

        /// <summary>
        /// Gets the left.
        /// </summary>
        /// <value>The left.</value>
        /// <author>Sjef van Leeuwen 19-2-2007 14:30</author>
        public SString Left
        {
            get { return (SString)_parameters[2]; }
        }

        /// <summary>
        /// Gets the right.
        /// </summary>
        /// <value>The right.</value>
        /// <author>Sjef van Leeuwen 19-2-2007 14:30</author>
        public SString Right
        {
            get { return (SString)_parameters[3]; }
        }

        /// <summary>
        /// Gets the top.
        /// </summary>
        /// <value>The top.</value>
        /// <author>Sjef van Leeuwen 19-2-2007 14:30</author>
        public SString Top
        {
            get { return (SString)_parameters[4]; }
        }

        /// <summary>
        /// Gets the bottom.
        /// </summary>
        /// <value>The bottom.</value>
        /// <author>Sjef van Leeuwen 19-2-2007 14:30</author>
        public SString Bottom
        {
            get { return (SString)_parameters[5]; }
        }

        /// <summary>
        /// Gets the front.
        /// </summary>
        /// <value>The front.</value>
        /// <author>Sjef van Leeuwen 19-2-2007 14:30</author>
        public SString Front
        {
            get { return (SString)_parameters[6]; }
        }

        /// <summary>
        /// Gets the back.
        /// </summary>
        /// <value>The back.</value>
        /// <author>Sjef van Leeuwen 19-2-2007 14:30</author>
        public SString Back
        {
            get { return (SString)_parameters[7]; }
        }
        
        #endregion

        #region Static Methods

        /// <summary>
        /// Deserializes the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        /// <author>Sjef van Leeuwen 21-1-2007 14:04</author>
        public static SkyBoxMessageResponse Deserialize(byte[] message)
        {
            SUInt16 responseCode = new SUInt16(message, 0);
            int OffSet = SUInt16.BYTE_LENGTH;
            return new SkyBoxMessageResponse(responseCode,
                                             GetSUInt32(ref message, ref OffSet),
                                             GetString(ref message,ref OffSet),
                                             GetString(ref message,ref OffSet),
                                             GetString(ref message,ref OffSet),
                                             GetString(ref message,ref OffSet),
                                             GetString(ref message,ref OffSet),
                                             GetString(ref message,ref OffSet));
        }
        
        #endregion

    }
}