using System.ComponentModel; using JD.Remoting.WPF.Module.Serialization; using Newtonsoft.Json; using Plume.WPF.Mvvm; namespace JD.Remoting.WPF.Module.Settings { [TypeConverter(typeof(ExpandableObjectConverter))] [JsonConverter(typeof(NoTypeConverterJsonConverter))] public class EngineConnection : BindableBase { private string _name; private string _ip = "127.0.0.1"; private int _port = 1001; public EngineConnection() { } [Browsable(true), Description("Name of the connection")] public string Name { get => _name; set => SetProperty(ref _name, value); } [Browsable(true), DefaultValue("127.0.0.1"), Description("Ip of the console to connect to (e.g. 127.0.0.1)")] public string Ip { get => _ip; set => SetProperty(ref _ip, value); } [Browsable(true), DefaultValue(1001), Description("Port of the console to connect to (e.g. 1001)")] public int Port { get => _port; set => SetProperty(ref _port, value); } /// public override string ToString() { if (string.IsNullOrEmpty(Name)) { return $"{Ip}:{Port}"; } return $"{Name} - {Ip}:{Port}"; } public static EngineConnection Default { get; } = new EngineConnection {Name = "localhost", Ip = "127.0.0.1", Port = 1001}; } }