Use ArgumentException.ThrowIfNullOrEmpty

This commit is contained in:
Bond_009
2022-10-13 19:08:00 +02:00
parent 93fd462b58
commit b366dc2e6e
58 changed files with 130 additions and 549 deletions

View File

@@ -9,10 +9,7 @@ namespace MediaBrowser.Model.Dlna
{
public SearchCriteria(string search)
{
if (search.Length == 0)
{
throw new ArgumentException("String can't be empty.", nameof(search));
}
ArgumentException.ThrowIfNullOrEmpty(search);
SearchType = SearchType.Unknown;

View File

@@ -1496,10 +1496,7 @@ namespace MediaBrowser.Model.Dlna
throw new ArgumentException("ItemId is required");
}
if (string.IsNullOrEmpty(options.DeviceId))
{
throw new ArgumentException("DeviceId is required");
}
ArgumentException.ThrowIfNullOrEmpty(options.DeviceId);
if (options.Profile is null)
{

View File

@@ -620,10 +620,7 @@ namespace MediaBrowser.Model.Dlna
public string ToUrl(string baseUrl, string accessToken)
{
if (string.IsNullOrEmpty(baseUrl))
{
throw new ArgumentNullException(nameof(baseUrl));
}
ArgumentException.ThrowIfNullOrEmpty(baseUrl);
var list = new List<string>();
foreach (NameValuePair pair in BuildParams(this, accessToken))
@@ -664,10 +661,7 @@ namespace MediaBrowser.Model.Dlna
private string GetUrl(string baseUrl, string queryString)
{
if (string.IsNullOrEmpty(baseUrl))
{
throw new ArgumentNullException(nameof(baseUrl));
}
ArgumentException.ThrowIfNullOrEmpty(baseUrl);
string extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container;