25 lines
755 B
C#
25 lines
755 B
C#
using LANCommander.Server.Services;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
namespace LANCommander.Server.Hubs
|
|
{
|
|
public class GameServerHub : Hub
|
|
{
|
|
readonly ServerProcessService ServerProcessService;
|
|
public GameServerHub(ServerProcessService serverProcessService) {
|
|
ServerProcessService = serverProcessService;
|
|
|
|
ServerProcessService.OnLog += ServerProcessService_OnLog;
|
|
}
|
|
|
|
private void ServerProcessService_OnLog(object sender, ServerLogEventArgs e)
|
|
{
|
|
Clients.All.SendAsync("Log", e.Log.ServerId, e.Log.Id, e.Line);
|
|
}
|
|
|
|
public void Log(Guid serverId, string message)
|
|
{
|
|
Clients.All.SendAsync("Log", serverId, message);
|
|
}
|
|
}
|
|
}
|