本文整理汇总了C#中Reality.Communication.ClientMessage.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ClientMessage.ToString方法的具体用法?C# ClientMessage.ToString怎么用?C# ClientMessage.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reality.Communication.ClientMessage
的用法示例。
在下文中一共展示了ClientMessage.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessData
private void ProcessData(byte[] Data)
{
if (Data.Length == 0)
{
return;
}
if (Data[0] == 64)
{
int Pos = 0;
while (Pos < Data.Length)
{
ClientMessage Message = null;
try
{
int MessageLength = Base64Encoding.DecodeInt32(new byte[] { Data[Pos++], Data[Pos++], Data[Pos++] });
uint MessageId = Base64Encoding.DecodeUInt32(new byte[] { Data[Pos++], Data[Pos++] });
byte[] Content = new byte[MessageLength - 2];
for (int i = 0; i < Content.Length; i++)
{
Content[i] = Data[Pos++];
}
Message = new ClientMessage(MessageId, Content);
}
catch (Exception)
{
SessionManager.StopSession(mId); // packet formatting exception
return;
}
if (Message != null)
{
Output.WriteLine("[RCV][" + mId + "]: " + Message.ToString(), OutputLevel.DebugInformation);
try
{
DataRouter.HandleData(this, Message);
}
catch (Exception e)
{
Output.WriteLine("Critical error in HandleData stack: " + e.Message + "\n\n" + e.StackTrace,
OutputLevel.Notification);
string text = System.IO.File.ReadAllText(Environment.CurrentDirectory + "\\error-log.txt");
System.IO.StreamWriter file = new System.IO.StreamWriter(Environment.CurrentDirectory + "\\error-log.txt");
file.WriteLine(text + "Critical error in HandleData stack: " + e.Message + "\n\n" + e.StackTrace,
OutputLevel.Notification + "\n\n");
file.Close();
return;
}
}
}
}
else if (Data[0] == 60)
{
Output.WriteLine("Sent crossdomain policy to client " + mId + ".", OutputLevel.DebugInformation);
SendData(CrossdomainPolicy.GetBytes());
SessionManager.StopSession(mId);
}
else
{
SessionManager.StopSession(mId);
}
}