e8dff01c41
less warns when using a disposed socket topstats added to tokens as {{TOPSTATS}} fixed topstats reporting for only a single server added fix to iw4 regex for negative score tokens now support multiple lines (using Environment.NewLine to separate) localization includes culture again
55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using SharedLibraryCore.Interfaces;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace SharedLibraryCore.Configuration
|
|
{
|
|
public class ServerConfiguration : IBaseConfiguration
|
|
{
|
|
public string IPAddress { get; set; }
|
|
public ushort Port { get; set; }
|
|
public string Password { get; set; }
|
|
public List<string> Rules { get; set; }
|
|
public List<string> AutoMessages { get; set; }
|
|
public bool UseT6MParser { get; set; }
|
|
public bool UseIW5MParser { get; set; }
|
|
public string ManualLogPath { get; set; }
|
|
|
|
public IBaseConfiguration Generate()
|
|
{
|
|
var loc = Utilities.CurrentLocalization.LocalizationIndex;
|
|
|
|
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"]);
|
|
if (!UseT6MParser)
|
|
UseIW5MParser = Utilities.PromptBool(loc["SETUP_SERVER_USEIW5M"]);
|
|
if (UseIW5MParser)
|
|
ManualLogPath = Utilities.PromptString(loc["SETUP_SERVER_MANUALLOG"]);
|
|
|
|
return this;
|
|
}
|
|
|
|
public string Name() => "ServerConfiguration";
|
|
}
|
|
}
|