1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

start implementation of configuration via webfront

This commit is contained in:
RaidMax
2019-03-30 22:04:15 -05:00
parent f90da3b253
commit 186a5d00da
10 changed files with 262 additions and 17 deletions

View File

@ -1,34 +1,58 @@
using SharedLibraryCore.Interfaces;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace SharedLibraryCore.Configuration
{
public class ApplicationConfiguration : IBaseConfiguration
{
[LocalizedDisplayName("SETUP_ENABLE_WEBFRONT")]
public bool EnableWebFront { get; set; }
[LocalizedDisplayName("SETUP_ENABLE_MULTIOWN")]
public bool EnableMultipleOwners { get; set; }
[LocalizedDisplayName("SETUP_ENABLE_STEPPEDPRIV")]
public bool EnableSteppedHierarchy { get; set; }
[LocalizedDisplayName("SETUP_DISPLAY_SOCIAL")]
public bool EnableSocialLink { get; set; }
[LocalizedDisplayName("SETUP_ENABLE_CUSTOMSAY")]
public bool EnableCustomSayName { get; set; }
[LocalizedDisplayName("SETUP_SAY_NAME")]
public string CustomSayName { get; set; }
[LocalizedDisplayName("SETUP_SOCIAL_LINK")]
public string SocialLinkAddress { get; set; }
[LocalizedDisplayName("SETUP_SOCIAL_TITLE")]
public string SocialLinkTitle { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_BIND_URL")]
public string WebfrontBindUrl { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_MANUAL_URL")]
public string ManualWebfrontUrl { get; set; }
public string WebfrontUrl => string.IsNullOrEmpty(ManualWebfrontUrl) ? WebfrontBindUrl.Replace("0.0.0.0", "127.0.0.1") : ManualWebfrontUrl;
[LocalizedDisplayName("SETUP_USE_CUSTOMENCODING")]
public bool EnableCustomParserEncoding { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENCODING")]
public string CustomParserEncoding { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
public bool EnableCustomLocale { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
public string CustomLocale { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_DB_PROVIDER")]
public string DatabaseProvider { get; set; } = "sqlite";
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CONNECTION_STRING")]
public string ConnectionString { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_RCON_POLLRATE")]
public int RConPollRate { get; set; } = 5000;
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_IGNORE_BOTS")]
public bool IgnoreBots { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_MAX_TB")]
public TimeSpan MaximumTempBanTime { get; set; } = new TimeSpan(24 * 30, 0, 0);
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENABLE_WHITELIST")]
public bool EnableWebfrontConnectionWhitelist { get; set; }
public List<string> WebfrontConnectionWhitelist { get; set; }
public string Id { get; set; }
public List<ServerConfiguration> Servers { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_AUTOMESSAGE_PERIOD")]
public int AutoMessagePeriod { get; set; }
public List<string> AutoMessages { get; set; }
public List<string> GlobalRules { get; set; }

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace SharedLibraryCore.Configuration
{
class LocalizedDisplayNameAttribute : DisplayNameAttribute
{
private readonly string _localizationKey;
public LocalizedDisplayNameAttribute(string localizationKey)
{
_localizationKey = localizationKey;
}
public override string DisplayName => Utilities.CurrentLocalization.LocalizationIndex[_localizationKey];
}
}