LANCommander/LANCommander.Server.Services/IPXRelayService.cs

42 lines
889 B
C#
Raw Permalink Normal View History

2023-09-08 22:26:28 -05:00
using IPXRelayDotNet;
using Microsoft.Extensions.Logging;
2023-09-08 22:26:28 -05:00
2024-08-04 18:44:33 -05:00
namespace LANCommander.Server.Services
2023-09-08 22:26:28 -05:00
{
public class IPXRelayService : BaseService
{
private IPXRelay Relay;
public IPXRelayService(ILogger<IPXRelayService> logger) : base(logger)
2023-09-08 22:26:28 -05:00
{
if (Relay == null)
Relay = new IPXRelay();
Init();
}
public void Init()
{
if (Relay != null)
Stop();
if (Relay == null)
2024-08-28 20:44:14 -05:00
Relay = new IPXRelay(Settings.IPXRelay.Port);
2023-09-08 22:26:28 -05:00
2024-08-28 20:44:14 -05:00
if (!Settings.IPXRelay.Logging)
2023-09-08 22:26:28 -05:00
Relay.DisableLogging();
2024-08-28 20:44:14 -05:00
if (Settings.IPXRelay.Enabled)
2023-09-08 22:26:28 -05:00
Relay.StartAsync();
}
public void Stop()
{
if (Relay != null)
Relay.Dispose();
Relay = null;
}
}
}