mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 09:33:52 -07:00
Replaced manual argument validations with Ensure.
This commit is contained in:
parent
b055fc5ade
commit
76bc4aaa9c
4 changed files with 9 additions and 17 deletions
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Core.Configuration.Events;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||
|
@ -305,9 +306,11 @@ namespace NzbDrone.Core.Configuration
|
|||
|
||||
public string GetValue(string key, object defaultValue, bool persist = false)
|
||||
{
|
||||
key = key.ToLowerInvariant();
|
||||
Ensure.That(key, () => key).IsNotNullOrWhiteSpace();
|
||||
|
||||
EnsureCache();
|
||||
|
||||
key = key.ToLowerInvariant();
|
||||
string dbValue;
|
||||
|
||||
if (_cache.TryGetValue(key, out dbValue) && dbValue != null && !String.IsNullOrEmpty(dbValue))
|
||||
|
@ -336,11 +339,6 @@ namespace NzbDrone.Core.Configuration
|
|||
{
|
||||
key = key.ToLowerInvariant();
|
||||
|
||||
if (String.IsNullOrEmpty(key))
|
||||
throw new ArgumentOutOfRangeException("key");
|
||||
if (value == null)
|
||||
throw new ArgumentNullException("key");
|
||||
|
||||
_logger.Trace("Writing Setting to file. Key:'{0}' Value:'{1}'", key, value);
|
||||
|
||||
var dbValue = _repository.Get(key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue