diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-02-06 07:44:08 -0600 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-02-06 07:44:08 -0600 |
| commit | 1172af00d2b4068c525b4c1d6f05d5b5badcf5a3 (patch) | |
| tree | 91bc641d20287d21019087ef19d407daf150be1f /src | |
| parent | b3050a57263c0b21688296ea9ea37b45eb9fb90f (diff) | |
| download | slskd-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( |
