1
0
mirror of synced 2024-11-14 17:33:49 +00:00
PettingZoo/Model/UserSettings.cs
2016-06-21 17:05:14 +02:00

59 lines
1.4 KiB
C#

namespace PettingZoo.Model
{
public interface IUserSettingsSerializer
{
void Read(UserSettings settings);
void Write(UserSettings settings);
}
public class ConnectionWindowSettings
{
public string LastHost { get; set; }
public string LastVirtualHost { get; set; }
public int LastPort { get; set; }
public string LastUsername { get; set; }
public string LastPassword { get; set; }
public string LastExchange { get; set; }
public string LastRoutingKey { get; set; }
public ConnectionWindowSettings()
{
LastHost = "localhost";
LastPort = 5672;
LastVirtualHost = "/";
LastUsername = "guest";
LastPassword = "guest";
LastExchange = "amqp";
LastRoutingKey = "#";
}
}
public class UserSettings
{
public ConnectionWindowSettings ConnectionWindow { get; private set; }
private readonly IUserSettingsSerializer serializer;
public UserSettings(IUserSettingsSerializer serializer)
{
ConnectionWindow = new ConnectionWindowSettings();
this.serializer = serializer;
serializer.Read(this);
}
public void Save()
{
serializer.Write(this);
}
}
}