26 lines
842 B
C#
26 lines
842 B
C#
using CommonSocketLibrary.Abstract;
|
|
using CommonSocketLibrary.Common;
|
|
using Serilog;
|
|
|
|
namespace CommonSocketLibrary.Socket.Manager
|
|
{
|
|
public abstract class WebSocketMessageTypeManager : MessageTypeManager<IWebSocketHandler>
|
|
{
|
|
public WebSocketMessageTypeManager(IEnumerable<IWebSocketHandler> handlers, ILogger logger) : base(handlers, logger)
|
|
{
|
|
}
|
|
|
|
protected override Type? FetchMessageType(Type handlerType)
|
|
{
|
|
if (handlerType == null)
|
|
return null;
|
|
|
|
var name = handlerType.Namespace + "." + handlerType.Name;
|
|
name = name.Replace(".Handlers.", ".Data.")
|
|
.Replace("Handler", "Message")
|
|
.Replace("MessageMessage", "Message");
|
|
|
|
return handlerType.Assembly.GetType(name);
|
|
}
|
|
}
|
|
} |