diff options
| author | Erwin de Haan <EraYaN@users.noreply.github.com> | 2019-01-13 21:46:33 +0100 |
|---|---|---|
| committer | Erwin de Haan <EraYaN@users.noreply.github.com> | 2019-01-13 21:46:33 +0100 |
| commit | e8674464373c3635243953cded42fcd2aa87d196 (patch) | |
| tree | 8087e1c5d47a525b04f3ae7e99183f68391bb410 /MediaBrowser.Controller | |
| parent | 65bd052f3e8682d177520af57db1c8ef5cb33262 (diff) | |
ReSharper format: conform inline 'out' parameters.
Diffstat (limited to 'MediaBrowser.Controller')
9 files changed, 19 insertions, 46 deletions
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index c56dc04ec..91cfcd0ce 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -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; diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index bbee594f6..b40bccde6 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -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); diff --git a/MediaBrowser.Controller/Entities/Year.cs b/MediaBrowser.Controller/Entities/Year.cs index 643c0ddcf..cad5ed863 100644 --- a/MediaBrowser.Controller/Entities/Year.cs +++ b/MediaBrowser.Controller/Entities/Year.cs @@ -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; } diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index 223761654..3080143ce 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -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[] { diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 3bc43143f..edc43ef46 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -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) { diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs index bb09d365e..ea8a79306 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs @@ -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; } diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs index 625f0b389..ff54bb393 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs @@ -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; } diff --git a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs index a379efafa..b812a8ddc 100644 --- a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs +++ b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs @@ -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); } diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 622bba637..ab3196aba 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -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(); |
