本文整理汇总了C#中ClientMessage.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ClientMessage.ToString方法的具体用法?C# ClientMessage.ToString怎么用?C# ClientMessage.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClientMessage
的用法示例。
在下文中一共展示了ClientMessage.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePacket
public static void HandlePacket(GameClientMessageHandler handler, ClientMessage message)
{
if (handlers.ContainsKey(message.Id))
{
Logging.WriteLine("Handled Header: " + message.ToString(), ConsoleColor.Green);
StaticRequestHandler currentHandler = (StaticRequestHandler)handlers[message.Id];
currentHandler.Invoke(handler);
}
else
{
if (System.Diagnostics.Debugger.IsAttached)
{
Logging.WriteLine("Unhandled Header: " + message.ToString(), ConsoleColor.Red);
}
}
}
示例2: HandlePacket
public static void HandlePacket(GameClientMessageHandler handler, ClientMessage message)
{
if (handlers.ContainsKey(message.Id))
{
Logging.WriteLine("Cargado -> " + message.ToString(), ConsoleColor.White);
StaticRequestHandler currentHandler = (StaticRequestHandler)handlers[message.Id];
currentHandler.Invoke(handler);
}
else
{
if (System.Diagnostics.Debugger.IsAttached)
{
Logging.WriteLine("Error -> " + message.ToString(), ConsoleColor.Magenta);
}
}
}
示例3: AddIfNeeded
public void AddIfNeeded(uint GroupId, ClientMessage Request, ServerMessage Response)
{
lock (mCachedResponses)
{
foreach (ResponseCacheItem Item in mCachedResponses)
{
if (Item.GroupId == GroupId && Item.Request.ToString() == Request.ToString())
{
return;
}
}
ResponseCacheItem NewItem = new ResponseCacheItem(GroupId, Request, Response);
mCachedResponses.Add(NewItem);
}
}
示例4: AddIfNeeded
public void AddIfNeeded(uint GroupId, ClientMessage Request, ServerMessage Response)
{
lock (mCachedResponses)
{
if (mCachedResponses.Count > mCacheMaxCapacity)
{
// capacity has been reached, to protect overflow remove the oldest element in the cache immediatly..
mCachedResponses.RemoveAt(mCachedResponses.Count - 1);
}
foreach (ResponseCacheItem Item in mCachedResponses)
{
if (Item.GroupId == GroupId && Item.Request.ToString() == Request.ToString())
{
return;
}
}
ResponseCacheItem NewItem = new ResponseCacheItem(GroupId, Request, Response);
mCachedResponses.Add(NewItem);
}
}
示例5: TryGetResponse
public ServerMessage TryGetResponse(uint GroupId, ClientMessage Request)
{
lock (mCachedResponses)
{
foreach (ResponseCacheItem Item in mCachedResponses)
{
if (Item.GroupId == GroupId && Item.Request.ToString() == Request.ToString())
{
return Item.Response;
}
}
}
return null;
}