IW4M-Admin/SharedLibraryCore/Configuration/Validation/ServerConfigurationValidator.cs
RaidMax 697a752be0 make the version name match the actual name for FTP deployment
fix rare issue with summing session scores
copy font to expected wwwroot dir in debug mode so we get pretty icons when developing
upgrade some packages

pretty much reworked the entire server web config to support better validation and stuff.. not really a small fix

finish web configuration changes (I think)

finish up configuration changes and update shared library nuget
2020-01-20 10:23:23 -06:00

40 lines
1.1 KiB
C#

using FluentValidation;
using System.Net;
namespace SharedLibraryCore.Configuration.Validation
{
/// <summary>
/// Validation class for server configuration
/// </summary>
public class ServerConfigurationValidator : AbstractValidator<ServerConfiguration>
{
public ServerConfigurationValidator()
{
RuleFor(_server => _server.IPAddress)
.NotEmpty()
.Must(_address => IPAddress.TryParse(_address, out _));
RuleFor(_server => _server.Port)
.InclusiveBetween(0, ushort.MaxValue);
RuleFor(_server => _server.Password)
.NotEmpty();
RuleForEach(_server => _server.Rules)
.NotEmpty();
RuleForEach(_server => _server.AutoMessages)
.NotEmpty();
RuleFor(_server => _server.RConParserVersion)
.NotEmpty();
RuleFor(_server => _server.EventParserVersion)
.NotEmpty();
RuleFor(_server => _server.ReservedSlotNumber)
.InclusiveBetween(0, 32);
}
}
}