mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-04 06:48:35 +01:00
ReSharper format: conform inline 'out' parameters.
This commit is contained in:
@@ -103,8 +103,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
lock (LibraryOptions)
|
||||
{
|
||||
LibraryOptions options;
|
||||
if (!LibraryOptions.TryGetValue(path, out options))
|
||||
if (!LibraryOptions.TryGetValue(path, out var options))
|
||||
{
|
||||
options = LoadLibraryOptions(path);
|
||||
LibraryOptions[path] = options;
|
||||
|
||||
@@ -331,9 +331,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
foreach (var child in nonCachedChildren)
|
||||
{
|
||||
BaseItem currentChild;
|
||||
|
||||
if (currentChildren.TryGetValue(child.Id, out currentChild))
|
||||
if (currentChildren.TryGetValue(child.Id, out var currentChild))
|
||||
{
|
||||
validChildren.Add(currentChild);
|
||||
|
||||
|
||||
@@ -50,11 +50,9 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public IList<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
||||
{
|
||||
int year;
|
||||
|
||||
var usCulture = new CultureInfo("en-US");
|
||||
|
||||
if (!int.TryParse(Name, NumberStyles.Integer, usCulture, out year))
|
||||
if (!int.TryParse(Name, NumberStyles.Integer, usCulture, out var year))
|
||||
{
|
||||
return new List<BaseItem>();
|
||||
}
|
||||
@@ -66,9 +64,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public int? GetYearValue()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (int.TryParse(Name, NumberStyles.Integer, CultureInfo.InvariantCulture, out i))
|
||||
if (int.TryParse(Name, NumberStyles.Integer, CultureInfo.InvariantCulture, out var i))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,7 @@ namespace MediaBrowser.Controller.Library
|
||||
};
|
||||
}
|
||||
|
||||
DayOfWeek value;
|
||||
|
||||
if (Enum.TryParse(day, true, out value))
|
||||
if (Enum.TryParse(day, true, out DayOfWeek value))
|
||||
{
|
||||
return new DayOfWeek[]
|
||||
{
|
||||
|
||||
@@ -943,9 +943,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var level = state.GetRequestedLevel(videoStream.Codec);
|
||||
if (!string.IsNullOrEmpty(level))
|
||||
{
|
||||
double requestLevel;
|
||||
|
||||
if (double.TryParse(level, NumberStyles.Any, _usCulture, out requestLevel))
|
||||
if (double.TryParse(level, NumberStyles.Any, _usCulture, out var requestLevel))
|
||||
{
|
||||
if (!videoStream.Level.HasValue)
|
||||
{
|
||||
|
||||
@@ -193,8 +193,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
if (!string.IsNullOrEmpty(codec))
|
||||
{
|
||||
var value = BaseRequest.GetOption(codec, "maxrefframes");
|
||||
int result;
|
||||
if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
|
||||
if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@@ -213,8 +212,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
if (!string.IsNullOrEmpty(codec))
|
||||
{
|
||||
var value = BaseRequest.GetOption(codec, "videobitdepth");
|
||||
int result;
|
||||
if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
|
||||
if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@@ -233,8 +231,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
if (!string.IsNullOrEmpty(codec))
|
||||
{
|
||||
var value = BaseRequest.GetOption(codec, "audiobitdepth");
|
||||
int result;
|
||||
if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
|
||||
if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@@ -257,8 +254,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
if (!string.IsNullOrEmpty(codec))
|
||||
{
|
||||
var value = BaseRequest.GetOption(codec, "audiochannels");
|
||||
int result;
|
||||
if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
|
||||
if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@@ -419,8 +415,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
|
||||
var level = GetRequestedLevel(ActualOutputVideoCodec);
|
||||
double result;
|
||||
if (!string.IsNullOrEmpty(level) && double.TryParse(level, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
|
||||
if (!string.IsNullOrEmpty(level) && double.TryParse(level, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -228,8 +228,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
public string GetOption(string name)
|
||||
{
|
||||
string value;
|
||||
if (StreamOptions.TryGetValue(name, out value))
|
||||
if (StreamOptions.TryGetValue(name, out var value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -74,9 +74,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
(i + 1 < parts.Length))
|
||||
{
|
||||
var rate = parts[i + 1];
|
||||
float val;
|
||||
|
||||
if (float.TryParse(rate, NumberStyles.Any, _usCulture, out val))
|
||||
if (float.TryParse(rate, NumberStyles.Any, _usCulture, out var val))
|
||||
{
|
||||
framerate = val;
|
||||
}
|
||||
@@ -85,9 +84,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
part.StartsWith("time=", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var time = part.Split(new[] { '=' }, 2).Last();
|
||||
TimeSpan val;
|
||||
|
||||
if (TimeSpan.TryParse(time, _usCulture, out val))
|
||||
if (TimeSpan.TryParse(time, _usCulture, out var val))
|
||||
{
|
||||
var currentMs = startMs + val.TotalMilliseconds;
|
||||
|
||||
@@ -110,9 +108,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
if (scale.HasValue)
|
||||
{
|
||||
long val;
|
||||
|
||||
if (long.TryParse(size, NumberStyles.Any, _usCulture, out val))
|
||||
if (long.TryParse(size, NumberStyles.Any, _usCulture, out var val))
|
||||
{
|
||||
bytesTranscoded = val * scale.Value;
|
||||
}
|
||||
@@ -131,9 +127,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
if (scale.HasValue)
|
||||
{
|
||||
float val;
|
||||
|
||||
if (float.TryParse(rate, NumberStyles.Any, _usCulture, out val))
|
||||
if (float.TryParse(rate, NumberStyles.Any, _usCulture, out var val))
|
||||
{
|
||||
bitRate = (int)Math.Ceiling(val * scale.Value);
|
||||
}
|
||||
|
||||
@@ -25,9 +25,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
public FileSystemMetadata[] GetFileSystemEntries(string path)
|
||||
{
|
||||
FileSystemMetadata[] entries;
|
||||
|
||||
if (!_cache.TryGetValue(path, out entries))
|
||||
if (!_cache.TryGetValue(path, out var entries))
|
||||
{
|
||||
//_logger.LogDebug("Getting files for " + path);
|
||||
|
||||
@@ -56,8 +54,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
public FileSystemMetadata GetFile(string path)
|
||||
{
|
||||
FileSystemMetadata file;
|
||||
if (!_fileCache.TryGetValue(path, out file))
|
||||
if (!_fileCache.TryGetValue(path, out var file))
|
||||
{
|
||||
file = _fileSystem.GetFileInfo(path);
|
||||
|
||||
@@ -83,8 +80,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
public List<string> GetFilePaths(string path, bool clearCache)
|
||||
{
|
||||
List<string> result;
|
||||
if (clearCache || !_filePathCache.TryGetValue(path, out result))
|
||||
if (clearCache || !_filePathCache.TryGetValue(path, out var result))
|
||||
{
|
||||
result = _fileSystem.GetFilePaths(path).ToList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user