diff options
author | sr55 <[email protected]> | 2012-05-27 17:50:01 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-05-27 17:50:01 +0000 |
commit | f5800c40e1c834fa5fc6de1432aea4cb86523950 (patch) | |
tree | 2c2d30a1d18d9d83f70878fecffca8dd9530db46 /win/CS/HandBrake.ApplicationServices | |
parent | b225737b50c5cf584f9099c90dbcad939c2d6067 (diff) |
WinGui: Fix a bug in chapter duration calculation.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4708 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Parsing/Title.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs index 4bb47f201..7bce41669 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs @@ -9,6 +9,7 @@ namespace HandBrake.ApplicationServices.Parsing using System.Collections.Generic;
using System.Globalization;
using System.IO;
+ using System.Linq;
using System.Text.RegularExpressions;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -244,12 +245,11 @@ namespace HandBrake.ApplicationServices.Parsing /// <returns>A Timespan</returns>
public TimeSpan CalculateDuration(int startPoint, int endPoint)
{
+ IEnumerable<Chapter> chapers =
+ this.Chapters.Where(c => c.ChapterNumber >= startPoint && c.ChapterNumber <= endPoint);
+
TimeSpan duration = TimeSpan.FromSeconds(0.0);
- if (endPoint <= this.Chapters.Count)
- {
- for (int i = startPoint; i <= endPoint; i++)
- duration += this.Chapters[i].Duration;
- }
+ duration = chapers.Aggregate(duration, (current, chapter) => current + chapter.Duration);
return duration;
}
|