diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2019-03-04 00:27:48 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-04 00:27:48 -0500 |
| commit | aba22b92bc01659f80159bf3e2624aa5a30e1399 (patch) | |
| tree | b579992f28f9e84bb0bbb9158f9b5b4c151be839 /DvdLib/Ifo/Dvd.cs | |
| parent | 5982cdad90d834a785afcec37efb0bfd3f4f83a9 (diff) | |
| parent | 9993dafe54fe4310d1008434405198d822ef51cc (diff) | |
Merge pull request #735 from Bond-009/loop
Readability changes
Diffstat (limited to 'DvdLib/Ifo/Dvd.cs')
| -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); |
