using System; using System.Xml.Serialization; using Global.Shared.Config; using Global.Shared.Logging; using Torch; using Torch.Views; using VRageMath; namespace Global.Config { [Serializable] public class WpfConfig : ViewModel, IPluginConfig { #region Base private bool _isEnabled = true; [Display(Name = "Enabled", Description = "Whether the plugin is enabled or not", GroupName = "Main")] public bool IsEnabled { get => _isEnabled; set => SetValue(ref _isEnabled, value); } #endregion #region Database private string _host = "localhost"; private int _port = 3306; private string _database = "torch"; private string _username = "root"; private string _password = ""; [Display(Name = "Host", Description = "Address where database is located", GroupName = "Database", Order = 1)] public string Host { get => _host; set => SetValue(ref _host, value); } [Display(Name = "Port", Description = "Port the database has access through", GroupName = "Database", Order = 2)] public int Port { get => _port; set => SetValue(ref _port, value); } [Display(Name = "Username", Description = "User to connect to the database with", GroupName = "Database", Order = 3)] public string Username { get => _username; set => SetValue(ref _username, value); } [Display(Name = "Password", Description = "Password for connection authentication", GroupName = "Database", Order = 4)] public string Password { get => _password; set => SetValue(ref _password, value); } [Display(Name = "Database", Description = "Which database you want to connect to", GroupName = "Database", Order = 5)] public string Database { get => _database; set => SetValue(ref _database, value); } #endregion #region Monitoring private bool _discordStatus; private string _heartbeatUrl; [Display(Name = "Send Discord Status", Description = "Whether to send a discord message when server is detected as crashed", GroupName = "Monitoring")] public bool SendDiscordStatus { get => _discordStatus; set => SetValue(ref _discordStatus, value); } [Display(Name = "Heartbeat URL", Description = "URL for heartbeat to be sent", GroupName = "Monitoring")] public string HeartbeatUrl { get => _heartbeatUrl; set => SetValue(ref _heartbeatUrl, value); } #endregion #region Logging private LoggingLevel _level = LoggingLevel.Info; [Display(Name = "Logging Level", Description = "")] public LoggingLevel Level { get => _level; set => SetValue(ref _level, value); } #endregion #region OcTree private int _size = 40000000; [Display(Name = "Size", Description = "Size of the OcTree", GroupName = "OcTree", Order = 1)] public int Size { get => _size; set => SetValue(ref _size, value); } private int _centerX = 0; [Display(Name = "Center X", Description = "X coordinate of the center of the OcTree", GroupName = "OcTree", Order = 2)] public int CenterX { get => _centerX; set => SetValue(ref _centerX, value); } private int _centerY = 0; [Display(Name = "Center Y", Description = "Y coordinate of the center of the OcTree", GroupName = "OcTree", Order = 3)] public int CenterY { get => _centerY; set => SetValue(ref _centerY, value); } private int _centerZ = 0; [Display(Name = "Center Z", Description = "Z coordinate of the center of the OcTree", GroupName = "OcTree", Order = 4)] public int CenterZ { get => _centerZ; set => SetValue(ref _centerZ, value); } [XmlIgnore] public Vector3I CenterPosition { get => new Vector3I(_centerX, _centerY, _centerZ); set { SetValue(ref _centerX, value.X); SetValue(ref _centerY, value.Y); SetValue(ref _centerZ, value.Z); } } private int _capacity = 10; [Display(Name = "Capacity", Description = "Capacity of the OcTree", GroupName = "OcTree", Order = 5)] public int Capacity { get => _capacity; set => SetValue(ref _capacity, value); } private int _maxDepth = 12; [Display(Name = "Max Depth", Description = "Max depth of the OcTree", GroupName = "OcTree", Order = 6)] public int MaxDepth { get => _maxDepth; set => SetValue(ref _maxDepth, value); } #endregion } }