mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-01 11:23:36 +02:00
Inline out variable declaration
This commit is contained in:
parent
6ae1903453
commit
c051736c80
|
@ -1866,8 +1866,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
await writer.WriteStartDocumentAsync(true).ConfigureAwait(false);
|
||||
await writer.WriteStartElementAsync(null, "tvshow", null).ConfigureAwait(false);
|
||||
string id;
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProvider.Tvdb.ToString(), out id))
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProvider.Tvdb.ToString(), out var id))
|
||||
{
|
||||
await writer.WriteElementStringAsync(null, "id", null, id).ConfigureAwait(false);
|
||||
}
|
||||
|
|
|
@ -170,9 +170,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
|||
var nameInExtInf = nameParts.Length > 1 ? nameParts[^1].AsSpan().Trim() : ReadOnlySpan<char>.Empty;
|
||||
|
||||
string numberString = null;
|
||||
string attributeValue;
|
||||
|
||||
if (attributes.TryGetValue("tvg-chno", out attributeValue)
|
||||
if (attributes.TryGetValue("tvg-chno", out var attributeValue)
|
||||
&& double.TryParse(attributeValue, CultureInfo.InvariantCulture, out _))
|
||||
{
|
||||
numberString = attributeValue;
|
||||
|
|
|
@ -64,8 +64,7 @@ namespace Rssdp.Infrastructure
|
|||
}
|
||||
|
||||
message.Method = new HttpMethod(parts[0].Trim());
|
||||
Uri requestUri;
|
||||
if (Uri.TryCreate(parts[1].Trim(), UriKind.RelativeOrAbsolute, out requestUri))
|
||||
if (Uri.TryCreate(parts[1].Trim(), UriKind.RelativeOrAbsolute, out var requestUri))
|
||||
{
|
||||
message.RequestUri = requestUri;
|
||||
}
|
||||
|
|
|
@ -77,8 +77,7 @@ namespace Rssdp.Infrastructure
|
|||
|
||||
message.Version = ParseHttpVersion(parts[0].Trim());
|
||||
|
||||
int statusCode = -1;
|
||||
if (!Int32.TryParse(parts[1].Trim(), out statusCode))
|
||||
if (!Int32.TryParse(parts[1].Trim(), out var statusCode))
|
||||
{
|
||||
throw new ArgumentException("data status line is invalid. Status code is not a valid integer.", nameof(data));
|
||||
}
|
||||
|
|
|
@ -483,8 +483,7 @@ namespace Rssdp.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
Uri retVal;
|
||||
Uri.TryCreate(value, UriKind.RelativeOrAbsolute, out retVal);
|
||||
Uri.TryCreate(value, UriKind.RelativeOrAbsolute, out var retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
@ -501,8 +500,7 @@ namespace Rssdp.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
Uri retVal;
|
||||
Uri.TryCreate(value, UriKind.RelativeOrAbsolute, out retVal);
|
||||
Uri.TryCreate(value, UriKind.RelativeOrAbsolute, out var retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,7 +244,6 @@ namespace Rssdp.Infrastructure
|
|||
// Wait on random interval up to MX, as per SSDP spec.
|
||||
// Also, as per UPnP 1.1/SSDP spec ignore missing/bank MX header. If over 120, assume random value between 0 and 120.
|
||||
// Using 16 as minimum as that's often the minimum system clock frequency anyway.
|
||||
int maxWaitInterval = 0;
|
||||
if (String.IsNullOrEmpty(mx))
|
||||
{
|
||||
// Windows Explorer is poorly behaved and doesn't supply an MX header value.
|
||||
|
@ -254,7 +253,7 @@ namespace Rssdp.Infrastructure
|
|||
// return;
|
||||
}
|
||||
|
||||
if (!Int32.TryParse(mx, out maxWaitInterval) || maxWaitInterval <= 0)
|
||||
if (!Int32.TryParse(mx, out var maxWaitInterval) || maxWaitInterval <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -581,8 +580,7 @@ namespace Rssdp.Infrastructure
|
|||
private string GetFirstHeaderValue(System.Net.Http.Headers.HttpRequestHeaders httpRequestHeaders, string headerName)
|
||||
{
|
||||
string retVal = null;
|
||||
IEnumerable<String> values = null;
|
||||
if (httpRequestHeaders.TryGetValues(headerName, out values) && values != null)
|
||||
if (httpRequestHeaders.TryGetValues(headerName, out var values) && values != null)
|
||||
{
|
||||
retVal = values.FirstOrDefault();
|
||||
}
|
||||
|
|
|
@ -238,9 +238,6 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
}
|
||||
};
|
||||
|
||||
object? result;
|
||||
List<PersonInfo> actual;
|
||||
|
||||
// overwrite provider id
|
||||
var overwriteNewValue = new List<PersonInfo>
|
||||
{
|
||||
|
@ -249,9 +246,9 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
Name = "Name 2"
|
||||
}
|
||||
};
|
||||
Assert.False(TestMergeBaseItemDataPerson(GetOldValue(), overwriteNewValue, null, false, out result));
|
||||
Assert.False(TestMergeBaseItemDataPerson(GetOldValue(), overwriteNewValue, null, false, out var result));
|
||||
// People not already in target are not merged into it from source
|
||||
actual = (List<PersonInfo>)result!;
|
||||
List<PersonInfo> actual = (List<PersonInfo>)result!;
|
||||
Assert.Single(actual);
|
||||
Assert.Equal("Name 1", actual[0].Name);
|
||||
|
||||
|
|
Loading…
Reference in a new issue