2019-04-14 10:55:05 -05:00
|
|
|
|
using SharedLibraryCore.Configuration.Attributes;
|
2019-04-11 20:43:05 -05:00
|
|
|
|
using SharedLibraryCore.Interfaces;
|
2018-03-18 21:25:11 -05:00
|
|
|
|
using System;
|
2019-04-11 20:43:05 -05:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2018-03-14 00:36:25 -05:00
|
|
|
|
|
2018-04-08 01:44:42 -05:00
|
|
|
|
namespace SharedLibraryCore.Configuration
|
2018-03-14 00:36:25 -05:00
|
|
|
|
{
|
2018-03-18 21:25:11 -05:00
|
|
|
|
public class ApplicationConfiguration : IBaseConfiguration
|
2018-03-14 00:36:25 -05:00
|
|
|
|
{
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("SETUP_ENABLE_WEBFRONT")]
|
2019-07-27 15:23:45 -05:00
|
|
|
|
[ConfigurationLinked("WebfrontBindUrl", "ManualWebfrontUrl", "WebfrontPrimaryColor", "WebfrontSecondaryColor", "WebfrontCustomBranding")]
|
2018-04-16 15:31:14 -05:00
|
|
|
|
public bool EnableWebFront { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_BIND_URL")]
|
|
|
|
|
public string WebfrontBindUrl { get; set; }
|
|
|
|
|
[ConfigurationOptional]
|
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_MANUAL_URL")]
|
|
|
|
|
public string ManualWebfrontUrl { get; set; }
|
2019-07-27 08:18:49 -05:00
|
|
|
|
[ConfigurationOptional]
|
2019-07-27 15:23:45 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_PRIMARY_COLOR")]
|
2019-07-27 08:18:49 -05:00
|
|
|
|
public string WebfrontPrimaryColor { get; set; }
|
|
|
|
|
[ConfigurationOptional]
|
2019-07-27 15:23:45 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SECONDARY_COLOR")]
|
2019-07-27 08:18:49 -05:00
|
|
|
|
public string WebfrontSecondaryColor { get; set; }
|
2019-07-27 15:23:45 -05:00
|
|
|
|
[ConfigurationOptional]
|
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_BRANDING")]
|
|
|
|
|
public string WebfrontCustomBranding { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("SETUP_ENABLE_MULTIOWN")]
|
2018-03-14 00:36:25 -05:00
|
|
|
|
public bool EnableMultipleOwners { get; set; }
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("SETUP_ENABLE_STEPPEDPRIV")]
|
2018-03-24 16:35:54 -05:00
|
|
|
|
public bool EnableSteppedHierarchy { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_USE_LOCAL_TRANSLATIONS")]
|
|
|
|
|
public bool UseLocalTranslations { get; set; }
|
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_IGNORE_BOTS")]
|
|
|
|
|
public bool IgnoreBots { get; set; }
|
|
|
|
|
|
2019-07-17 12:29:51 -05:00
|
|
|
|
[ConfigurationLinked("CustomSayName")]
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("SETUP_ENABLE_CUSTOMSAY")]
|
2018-03-29 23:13:40 -05:00
|
|
|
|
public bool EnableCustomSayName { get; set; }
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("SETUP_SAY_NAME")]
|
2018-03-29 23:13:40 -05:00
|
|
|
|
public string CustomSayName { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
|
|
|
|
|
[LocalizedDisplayName("SETUP_DISPLAY_SOCIAL")]
|
2019-07-17 12:29:51 -05:00
|
|
|
|
[ConfigurationLinked("SocialLinkAddress", "SocialLinkTitle")]
|
2019-04-11 20:43:05 -05:00
|
|
|
|
public bool EnableSocialLink { get; set; }
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("SETUP_SOCIAL_LINK")]
|
2018-05-07 23:58:46 -05:00
|
|
|
|
public string SocialLinkAddress { get; set; }
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("SETUP_SOCIAL_TITLE")]
|
2018-05-05 17:52:04 -05:00
|
|
|
|
public string SocialLinkTitle { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("SETUP_USE_CUSTOMENCODING")]
|
2019-07-17 12:29:51 -05:00
|
|
|
|
[ConfigurationLinked("CustomParserEncoding")]
|
2019-03-30 22:04:15 -05:00
|
|
|
|
public bool EnableCustomParserEncoding { get; set; }
|
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENCODING")]
|
2018-04-21 17:18:20 -05:00
|
|
|
|
public string CustomParserEncoding { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
|
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENABLE_WHITELIST")]
|
2019-07-17 12:29:51 -05:00
|
|
|
|
[ConfigurationLinked("WebfrontConnectionWhitelist")]
|
2019-04-11 20:43:05 -05:00
|
|
|
|
public bool EnableWebfrontConnectionWhitelist { get; set; }
|
2019-04-14 10:55:05 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_WHITELIST_LIST")]
|
2020-01-17 17:31:53 -06:00
|
|
|
|
public string[] WebfrontConnectionWhitelist { get; set; } = new string[0];
|
2019-04-11 20:43:05 -05:00
|
|
|
|
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
|
2019-07-17 12:29:51 -05:00
|
|
|
|
[ConfigurationLinked("CustomLocale")]
|
2019-03-30 22:04:15 -05:00
|
|
|
|
public bool EnableCustomLocale { get; set; }
|
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
|
2018-04-24 17:01:27 -05:00
|
|
|
|
public string CustomLocale { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_DB_PROVIDER")]
|
2018-09-23 19:45:54 -05:00
|
|
|
|
public string DatabaseProvider { get; set; } = "sqlite";
|
2019-04-11 20:43:05 -05:00
|
|
|
|
[ConfigurationOptional]
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CONNECTION_STRING")]
|
2018-04-25 01:38:59 -05:00
|
|
|
|
public string ConnectionString { get; set; }
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_RCON_POLLRATE")]
|
2018-06-07 21:19:12 -05:00
|
|
|
|
public int RConPollRate { get; set; } = 5000;
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_MAX_TB")]
|
2018-10-15 19:51:04 -05:00
|
|
|
|
public TimeSpan MaximumTempBanTime { get; set; } = new TimeSpan(24 * 30, 0, 0);
|
2020-01-17 17:31:53 -06:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENABLE_COLOR_CODES")]
|
2019-08-02 18:04:34 -05:00
|
|
|
|
public bool EnableColorCodes { get; set; }
|
2019-03-30 22:04:15 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_AUTOMESSAGE_PERIOD")]
|
2018-03-14 13:22:04 -05:00
|
|
|
|
public int AutoMessagePeriod { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_AUTOMESSAGES")]
|
2020-01-17 17:31:53 -06:00
|
|
|
|
public string[] AutoMessages { get; set; } = new string[0];
|
2019-04-11 20:43:05 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_GLOBAL_RULES")]
|
2020-01-17 17:31:53 -06:00
|
|
|
|
public string[] GlobalRules { get; set; } = new string[0];
|
2019-04-11 20:43:05 -05:00
|
|
|
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_DISALLOWED_NAMES")]
|
2020-01-17 17:31:53 -06:00
|
|
|
|
public string[] DisallowedClientNames { get; set; } = new string[0];
|
2019-04-12 22:25:18 -05:00
|
|
|
|
[UIHint("ServerConfiguration")]
|
2020-01-17 17:31:53 -06:00
|
|
|
|
public ServerConfiguration[] Servers { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
|
|
|
|
|
[ConfigurationIgnore]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
[ConfigurationIgnore]
|
2020-01-17 17:31:53 -06:00
|
|
|
|
public MapConfiguration[] Maps { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
[ConfigurationIgnore]
|
2020-01-17 17:31:53 -06:00
|
|
|
|
public QuickMessageConfiguration[] QuickMessages { get; set; }
|
2019-04-11 20:43:05 -05:00
|
|
|
|
[ConfigurationIgnore]
|
|
|
|
|
public string WebfrontUrl => string.IsNullOrEmpty(ManualWebfrontUrl) ? WebfrontBindUrl?.Replace("0.0.0.0", "127.0.0.1") : ManualWebfrontUrl;
|
2020-04-22 18:46:41 -05:00
|
|
|
|
[ConfigurationIgnore]
|
|
|
|
|
public bool IgnoreServerConnectionLost { get; set; }
|
2018-03-18 21:25:11 -05:00
|
|
|
|
|
|
|
|
|
public IBaseConfiguration Generate()
|
|
|
|
|
{
|
2018-05-05 15:36:26 -05:00
|
|
|
|
var loc = Utilities.CurrentLocalization.LocalizationIndex;
|
2018-04-18 15:46:53 -05:00
|
|
|
|
Id = Guid.NewGuid().ToString();
|
2018-08-22 20:25:34 -05:00
|
|
|
|
|
2018-04-22 15:04:18 -05:00
|
|
|
|
EnableWebFront = Utilities.PromptBool(loc["SETUP_ENABLE_WEBFRONT"]);
|
|
|
|
|
EnableMultipleOwners = Utilities.PromptBool(loc["SETUP_ENABLE_MULTIOWN"]);
|
|
|
|
|
EnableSteppedHierarchy = Utilities.PromptBool(loc["SETUP_ENABLE_STEPPEDPRIV"]);
|
|
|
|
|
EnableCustomSayName = Utilities.PromptBool(loc["SETUP_ENABLE_CUSTOMSAY"]);
|
2018-03-18 21:25:11 -05:00
|
|
|
|
|
2018-04-22 15:04:18 -05:00
|
|
|
|
bool useCustomParserEncoding = Utilities.PromptBool(loc["SETUP_USE_CUSTOMENCODING"]);
|
2019-04-21 16:28:13 -05:00
|
|
|
|
if (useCustomParserEncoding)
|
|
|
|
|
{
|
|
|
|
|
CustomParserEncoding = Utilities.PromptString(loc["SETUP_ENCODING_STRING"]);
|
|
|
|
|
}
|
2018-04-21 17:18:20 -05:00
|
|
|
|
|
2018-09-04 12:40:29 -05:00
|
|
|
|
WebfrontBindUrl = "http://0.0.0.0:1624";
|
2018-04-19 00:48:14 -05:00
|
|
|
|
|
2018-03-29 23:13:40 -05:00
|
|
|
|
if (EnableCustomSayName)
|
2019-04-09 15:02:49 -05:00
|
|
|
|
{
|
2018-04-22 15:04:18 -05:00
|
|
|
|
CustomSayName = Utilities.PromptString(loc["SETUP_SAY_NAME"]);
|
2019-04-09 15:02:49 -05:00
|
|
|
|
}
|
2018-03-18 21:25:11 -05:00
|
|
|
|
|
2018-05-07 23:58:46 -05:00
|
|
|
|
EnableSocialLink = Utilities.PromptBool(loc["SETUP_DISPLAY_SOCIAL"]);
|
2018-03-18 21:25:11 -05:00
|
|
|
|
|
2018-05-07 23:58:46 -05:00
|
|
|
|
if (EnableSocialLink)
|
2018-05-05 17:52:04 -05:00
|
|
|
|
{
|
|
|
|
|
SocialLinkTitle = Utilities.PromptString(loc["SETUP_SOCIAL_TITLE"]);
|
2018-05-07 23:58:46 -05:00
|
|
|
|
SocialLinkAddress = Utilities.PromptString(loc["SETUP_SOCIAL_LINK"]);
|
2018-05-05 17:52:04 -05:00
|
|
|
|
}
|
2018-09-04 12:40:29 -05:00
|
|
|
|
|
2018-06-07 21:19:12 -05:00
|
|
|
|
RConPollRate = 5000;
|
2019-04-14 10:55:05 -05:00
|
|
|
|
AutoMessagePeriod = 60;
|
2018-03-18 21:25:11 -05:00
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-09 15:02:49 -05:00
|
|
|
|
public string Name()
|
|
|
|
|
{
|
|
|
|
|
return "ApplicationConfiguration";
|
|
|
|
|
}
|
2018-03-14 00:36:25 -05:00
|
|
|
|
}
|
2018-03-18 21:25:11 -05:00
|
|
|
|
}
|