//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.ClientLauncher;
using System.ComponentModel;
using System.Runtime.CompilerServices;
///
/// Settings for one server.
///
public class ServerHostSettings : INotifyPropertyChanged
{
private string? _description;
private string? _address;
private int _port;
///
public event PropertyChangedEventHandler? PropertyChanged;
///
/// Gets or sets the name of the configuration.
///
public string? Description
{
get => this._description;
set
{
if (value == this._description)
{
return;
}
this._description = value;
this.RaisePropertyChanged();
}
}
///
/// Gets or sets the host ip.
///
public string? Address
{
get => this._address;
set
{
if (value == this._address)
{
return;
}
this._address = value;
this.RaisePropertyChanged();
}
}
///
/// Gets or sets the host port.
///
public int Port
{
get => this._port;
set
{
if (value == this._port)
{
return;
}
this._port = value;
this.RaisePropertyChanged();
}
}
///
public override string ToString()
{
return $"{this.Description} ({this.Address}:{this.Port})";
}
///
/// Raises the event for the specified property.
///
/// The name of the property.
protected virtual void RaisePropertyChanged([CallerMemberName] string? propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}