LANCommander/LANCommander.Server/Services/IPXRelayService.cs
2024-08-04 18:44:33 -05:00

42 lines
874 B
C#

using IPXRelayDotNet;
namespace LANCommander.Server.Services
{
public class IPXRelayService : BaseService
{
private IPXRelay Relay;
public IPXRelayService() : base()
{
if (Relay == null)
Relay = new IPXRelay();
Init();
}
public void Init()
{
var settings = SettingService.GetSettings();
if (Relay != null)
Stop();
if (Relay == null)
Relay = new IPXRelay(settings.IPXRelay.Port);
if (!settings.IPXRelay.Logging)
Relay.DisableLogging();
if (settings.IPXRelay.Enabled)
Relay.StartAsync();
}
public void Stop()
{
if (Relay != null)
Relay.Dispose();
Relay = null;
}
}
}