本文整理汇总了C#中IncomingMessage.GetContentString方法的典型用法代码示例。如果您正苦于以下问题:C# IncomingMessage.GetContentString方法的具体用法?C# IncomingMessage.GetContentString怎么用?C# IncomingMessage.GetContentString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IncomingMessage
的用法示例。
在下文中一共展示了IncomingMessage.GetContentString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleConnectionData
private void HandleConnectionData(ref byte[] data)
{
int pos = 0;
while (pos < data.Length)
{
try
{
if (data[0] == 60)
{
CoreManager.ServerCore.GetStandardOut().PrintDebug("[" + _id + "] --> Policy Request");
SendData(PolicyReplyData);
CoreManager.ServerCore.GetStandardOut().PrintDebug("[" + _id + "] <-- Policy Sent");
Close();
return;
}
// Total length of message (without this): 3 Base64 bytes
int messageLength = Base64Encoding.DecodeInt32(new[] {data[pos++], data[pos++], data[pos++]});
// ID of message: 2 Base64 bytes
uint messageID = Base64Encoding.DecodeUInt32(new[] {data[pos++], data[pos++]});
// Data of message: (messageLength - 2) bytes
byte[] content = new byte[messageLength - 2];
for (int i = 0; i < content.Length; i++)
{
content[i] = data[pos++];
}
// Create message object
IncomingMessage message = new IncomingMessage(messageID, content);
if (Habbo.IsLoggedIn())
CoreManager.ServerCore.GetStandardOut().PrintDebug("[" + Habbo.GetUsername() + "] --> " +
message.GetHeader() +
message.GetContentString());
else
CoreManager.ServerCore.GetStandardOut().PrintDebug("[" + _id + "] --> " +
message.GetHeader() +
message.GetContentString());
// Handle message object
bool unknown = true;
if (_packetHandlers.GetLength(0) > messageID)
{
if (_packetHandlers[messageID, 3] != null)
{
lock (_packetHandlers[messageID, 3])
{
_packetHandlers[messageID, 3].Invoke(Habbo, message); // Execute High Priority
unknown = false;
}
}
if (message.IsCancelled())
return;
if (_packetHandlers[messageID, 2] != null)
{
lock (_packetHandlers[messageID, 2])
{
_packetHandlers[messageID, 2].Invoke(Habbo, message); // Execute Low Priority
unknown = false;
}
}
if (message.IsCancelled())
return;
if (_packetHandlers[messageID, 1] != null)
{
lock (_packetHandlers[messageID, 1])
{
_packetHandlers[messageID, 1].Invoke(Habbo, message); // Execute Default Action
unknown = false;
}
}
if (_packetHandlers[messageID, 0] != null)
{
lock (_packetHandlers[messageID, 0])
{
_packetHandlers[messageID, 0].Invoke(Habbo, message); // Execute Watchers
unknown = false;
}
}
}
if (unknown)
{
CoreManager.ServerCore.GetStandardOut().PrintWarning("Packet " + messageID + " ('" +
message.GetHeader() + "') unhandled!");
}
}
catch (IndexOutOfRangeException) // Bad formatting!
{
// TODO: Move this to IHI
//IonEnvironment.GetHabboHotel().GetClients().StopClient(_id, 0);
}
//.........这里部分代码省略.........
示例2: Process_DYNAMIC
private void Process_DYNAMIC(Habbo Sender, IncomingMessage Message)
{
lock (this.fPacketLogs)
{
this.fPacketLogs.
Append("<div class='packet'>").
Append('[').
Append(Message.GetID()).
Append("] <u>").
Append(Message.GetHeader()).
Append("</u>").
Append(Message.GetContentString()).
Append("</div>");
}
}