aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-02-06 07:44:08 -0600
committerJP Dillingham <jpdillingham@gmail.com>2021-02-06 07:44:08 -0600
commit1172af00d2b4068c525b4c1d6f05d5b5badcf5a3 (patch)
tree91bc641d20287d21019087ef19d407daf150be1f /src
parentb3050a57263c0b21688296ea9ea37b45eb9fb90f (diff)
downloadslskd-1172af00d2b4068c525b4c1d6f05d5b5badcf5a3.tar.gz
move Options
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(