diff options
| author | Bond-009 <bond.009@outlook.com> | 2019-03-01 17:12:22 +0100 |
|---|---|---|
| committer | Bond-009 <bond.009@outlook.com> | 2019-03-01 17:12:22 +0100 |
| commit | 9993dafe54fe4310d1008434405198d822ef51cc (patch) | |
| tree | bb0ee1c270956acae13c73cd8b6df8f9469e3632 /DvdLib | |
| parent | 594b2713832dfd56b70a505d25288467003805af (diff) | |
Don't mix LINQ and roreach loops for readability
Diffstat (limited to 'DvdLib')
| -rw-r--r-- | DvdLib/Ifo/Dvd.cs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/DvdLib/Ifo/Dvd.cs b/DvdLib/Ifo/Dvd.cs index f784be83e..90125fa3e 100644 --- a/DvdLib/Ifo/Dvd.cs +++ b/DvdLib/Ifo/Dvd.cs @@ -26,17 +26,17 @@ namespace DvdLib.Ifo if (vmgPath == null) { - var allIfos = allFiles.Where(i => string.Equals(i.Extension, ".ifo", StringComparison.OrdinalIgnoreCase)); - - foreach (var ifo in allIfos) + foreach (var ifo in allFiles) { - var num = ifo.Name.Split('_').ElementAtOrDefault(1); - var numbersRead = new List<ushort>(); + if (!string.Equals(ifo.Extension, ".ifo", StringComparison.OrdinalIgnoreCase)) + { + continue; + } - if (!string.IsNullOrEmpty(num) && ushort.TryParse(num, out var ifoNumber) && !numbersRead.Contains(ifoNumber)) + var nums = ifo.Name.Split(new [] { '_' }, StringSplitOptions.RemoveEmptyEntries); + if (nums.Length >= 2 && ushort.TryParse(nums[1], out var ifoNumber)) { ReadVTS(ifoNumber, ifo.FullName); - numbersRead.Add(ifoNumber); } } } @@ -76,7 +76,7 @@ namespace DvdLib.Ifo } } - private void ReadVTS(ushort vtsNum, List<FileSystemMetadata> allFiles) + private void ReadVTS(ushort vtsNum, IEnumerable<FileSystemMetadata> allFiles) { var filename = string.Format("VTS_{0:00}_0.IFO", vtsNum); |
