configuration rework

This commit is contained in:
rootdarkarchon
2023-02-04 15:53:23 +01:00
parent f389bed4e1
commit 7c97d1994c
50 changed files with 722 additions and 275 deletions

View File

@@ -0,0 +1,9 @@
namespace MareSynchronos.MareConfiguration.Models;
[Serializable]
public record Authentication
{
public string CharacterName { get; set; } = string.Empty;
public uint WorldId { get; set; } = 0;
public int SecretKeyIdx { get; set; } = -1;
}

View File

@@ -0,0 +1,9 @@
namespace MareSynchronos.MareConfiguration.Models;
public enum NotificationLocation
{
Nowhere,
Chat,
Toast,
Both
}

View File

@@ -0,0 +1,29 @@
namespace MareSynchronos.MareConfiguration.Models;
[Serializable]
[Obsolete("Deprecated, use ServerStorage")]
public class ServerStorageV0
{
public string ServerUri { get; set; } = string.Empty;
public string ServerName { get; set; } = string.Empty;
public List<Authentication> Authentications { get; set; } = new();
public Dictionary<string, string> UidServerComments { get; set; } = new(StringComparer.Ordinal);
public Dictionary<string, string> GidServerComments { get; set; } = new(StringComparer.Ordinal);
public Dictionary<string, List<string>> UidServerPairedUserTags = new(StringComparer.Ordinal);
public HashSet<string> ServerAvailablePairTags { get; set; } = new(StringComparer.Ordinal);
public HashSet<string> OpenPairTags { get; set; } = new(StringComparer.Ordinal);
public Dictionary<int, SecretKey> SecretKeys { get; set; } = new();
public bool FullPause { get; set; } = false;
public ServerStorage ToV1()
{
return new ServerStorage()
{
ServerUri = this.ServerUri,
ServerName = this.ServerName,
Authentications = this.Authentications.ToList(),
FullPause = this.FullPause,
SecretKeys = this.SecretKeys.ToDictionary(p => p.Key, p => p.Value)
};
}
}

View File

@@ -0,0 +1,8 @@
namespace MareSynchronos.MareConfiguration.Models;
[Serializable]
public class SecretKey
{
public string Key { get; set; } = string.Empty;
public string FriendlyName { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,11 @@
namespace MareSynchronos.MareConfiguration.Models;
[Serializable]
public class ServerStorage
{
public string ServerUri { get; set; } = string.Empty;
public string ServerName { get; set; } = string.Empty;
public List<Authentication> Authentications { get; set; } = new();
public Dictionary<int, SecretKey> SecretKeys { get; set; } = new();
public bool FullPause { get; set; } = false;
}

View File

@@ -0,0 +1,9 @@
namespace MareSynchronos.MareConfiguration.Models;
[Serializable]
public class ServerTagStorage
{
public Dictionary<string, List<string>> UidServerPairedUserTags = new(StringComparer.Ordinal);
public HashSet<string> ServerAvailablePairTags { get; set; } = new(StringComparer.Ordinal);
public HashSet<string> OpenPairTags { get; set; } = new(StringComparer.Ordinal);
}

View File

@@ -0,0 +1,7 @@
namespace MareSynchronos.MareConfiguration.Models;
public class ServerNotesStorage
{
public Dictionary<string, string> UidServerComments { get; set; } = new(StringComparer.Ordinal);
public Dictionary<string, string> GidServerComments { get; set; } = new(StringComparer.Ordinal);
}