|
using System;
using System.Collections.Generic;
using System.Text;
namespace ProxyCommon
{
public class RegisterMessage : Header
{
#region Memeber Variables
private string serverName;
#endregion
#region Constructor
public RegisterMessage(short SenderEndPoint, short RecieverEndPoint, string ServerName)
: base(MessageType.Register, SenderEndPoint, RecieverEndPoint)
{
serverName = ServerName;
ContentSize = serverName.Length;
}
public RegisterMessage(byte[] SerializationData) : base(SerializationData)
{
int bSize = base.GetSize();
byte[] thisBytes = new byte[SerializationData.Length - bSize];
Array.Copy(SerializationData, bSize, thisBytes, 0, thisBytes.Length);
serverName = ASCIIEncoding.ASCII.GetString(thisBytes);
}
#endregion
#region Overrides
public override int GetSize()
{
return serverName.Length;
}
public override byte[] ToByteArray()
{
int bSize = base.GetSize();
byte[] bytes = new byte[GetSize() + bSize];
base.ToByteArray().CopyTo(bytes, 0);
ASCIIEncoding.ASCII.GetBytes(serverName).CopyTo(bytes, bSize) ;
return bytes;
}
#endregion
#region Properties
public string ServerName
{
get { return serverName; }
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.