本文整理匯總了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;
}