2024-06-24 18:28:40 -04:00
|
|
|
using CommonSocketLibrary.Abstract;
|
|
|
|
using CommonSocketLibrary.Common;
|
|
|
|
using Serilog;
|
|
|
|
|
|
|
|
namespace CommonSocketLibrary.Socket.Manager
|
|
|
|
{
|
2024-08-10 15:31:08 -04:00
|
|
|
public abstract class WebSocketMessageTypeManager : MessageTypeManager<IWebSocketHandler>
|
2024-06-24 18:28:40 -04:00
|
|
|
{
|
2024-08-10 15:31:08 -04:00
|
|
|
public WebSocketMessageTypeManager(IEnumerable<IWebSocketHandler> handlers, ILogger logger) : base(handlers, logger)
|
2024-06-24 18:28:40 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|