using System;
using Woodpecker.Net.Game.Encoding;
namespace Woodpecker.Net.Game.Messages
{
///
/// Represents a client>server message for the Habbo FUSE protocol.
///
public struct clientMessage
{
#region Declares
///
/// The message ID of this message.
///
public readonly int ID;
///
/// The content of this message.
///
public string Content;
#endregion
#region Constructors
public clientMessage(string Data)
{
this.ID = base64Encoding.Decode(Data.Substring(0, 2));
this.Content = Data.Substring(2);
}
#endregion
#region Methods
///
/// Retrieves a certain parameter from the message's content. If the parameter is not found or any errors occur, then "" is returned.
///
/// The ID of the parameter to retrieve.
public string getParameter(int paramID)
{
return base64Encoding.getParameter(this.Content, paramID);
}
#endregion
#region Properties
///
/// Returns the ID of this message encoded in Base64.
///
public string encodedID
{
get { return base64Encoding.Encode(this.ID); }
}
///
/// The debug header of this message.
///
public string debugHeader
{
get { return Debug.clientHeaders.getMessageDebugHeader(this.ID); }
}
///
/// Returns the first parameter in this message as string, as indicated by the Base64 header.
///
public string firstParameter
{
get { return base64Encoding.getFirstParameter(this.Content); }
}
///
/// Returns all parameters int this message as a string array, as indicated by the Base64 headers.
///
public string[] Parameters
{
get { return base64Encoding.getParameters(this.Content); }
}
#endregion
}
}