2018-04-11 18:24:21 -04:00
|
|
|
|
using SharedLibraryCore.Interfaces;
|
2018-04-23 17:03:50 -04:00
|
|
|
|
using System;
|
2018-04-11 18:24:21 -04:00
|
|
|
|
using System.Collections.Generic;
|
2018-03-18 22:25:11 -04:00
|
|
|
|
|
2018-04-08 02:44:42 -04:00
|
|
|
|
namespace SharedLibraryCore.Configuration
|
2018-03-14 01:36:25 -04:00
|
|
|
|
{
|
2018-04-11 18:24:21 -04:00
|
|
|
|
public class ServerConfiguration : IBaseConfiguration
|
2018-03-14 01:36:25 -04:00
|
|
|
|
{
|
|
|
|
|
public string IPAddress { get; set; }
|
2018-04-23 17:03:50 -04:00
|
|
|
|
public ushort Port { get; set; }
|
2018-03-14 01:36:25 -04:00
|
|
|
|
public string Password { get; set; }
|
2018-08-26 20:20:47 -04:00
|
|
|
|
public IList<string> Rules { get; set; }
|
|
|
|
|
public IList<string> AutoMessages { get; set; }
|
2018-04-11 18:24:21 -04:00
|
|
|
|
public bool UseT6MParser { get; set; }
|
2018-04-23 01:43:48 -04:00
|
|
|
|
public string ManualLogPath { get; set; }
|
2019-02-03 21:47:05 -05:00
|
|
|
|
public string CustomParserVersion { get; set; }
|
2018-08-07 14:43:09 -04:00
|
|
|
|
public int ReservedSlotNumber { get; set; }
|
2018-04-11 18:24:21 -04:00
|
|
|
|
|
|
|
|
|
public IBaseConfiguration Generate()
|
|
|
|
|
{
|
2018-05-05 16:36:26 -04:00
|
|
|
|
var loc = Utilities.CurrentLocalization.LocalizationIndex;
|
2018-04-23 17:03:50 -04:00
|
|
|
|
|
|
|
|
|
while (string.IsNullOrEmpty(IPAddress))
|
|
|
|
|
{
|
|
|
|
|
string input = Utilities.PromptString(loc["SETUP_SERVER_IP"]);
|
|
|
|
|
|
|
|
|
|
if (System.Net.IPAddress.TryParse(input, out System.Net.IPAddress ip))
|
|
|
|
|
IPAddress = input;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while(Port < 1)
|
|
|
|
|
{
|
|
|
|
|
string input = Utilities.PromptString(loc["SETUP_SERVER_PORT"]);
|
|
|
|
|
if (UInt16.TryParse(input, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.CurrentCulture, out ushort port))
|
|
|
|
|
Port = port;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Password = Utilities.PromptString(loc["SETUP_SERVER_RCON"]);
|
|
|
|
|
AutoMessages = new List<string>();
|
|
|
|
|
Rules = new List<string>();
|
|
|
|
|
UseT6MParser = Utilities.PromptBool(loc["SETUP_SERVER_USET6M"]);
|
2018-12-30 19:13:13 -05:00
|
|
|
|
ReservedSlotNumber = loc["SETUP_SERVER_RESERVEDSLOT"].PromptInt(null, 0, 32);
|
2018-08-07 14:43:09 -04:00
|
|
|
|
|
2018-04-11 18:24:21 -04:00
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name() => "ServerConfiguration";
|
2018-03-14 01:36:25 -04:00
|
|
|
|
}
|
|
|
|
|
}
|