aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Options.cs (renamed from src/slskd/Common/Configuration/Options.cs)16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/slskd/Common/Configuration/Options.cs b/src/slskd/Options.cs
index 25c89688..2fc92d5c 100644
--- a/src/slskd/Common/Configuration/Options.cs
+++ b/src/slskd/Options.cs
@@ -1,4 +1,4 @@
-namespace slskd.Configuration
+namespace slskd
{
using slskd.Validation;
using Soulseek.Diagnostics;
@@ -139,6 +139,20 @@
}
}
+ public bool TryValidate(out CompositeValidationResult result)
+ {
+ result = null;
+ var results = new List<ValidationResult>();
+
+ if (!Validator.TryValidateObject(this, new ValidationContext(this), results, true))
+ {
+ result = new CompositeValidationResult("Invalid configuration", results);
+ return false;
+ }
+
+ return true;
+ }
+
public static IEnumerable<Option> Map => new Option[]
{
new(