From abd251048b392e86041325c1561e7a9dcd8067c3 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 27 Mar 2011 20:08:33 +0000 Subject: WinGui: - Some move re factoring to push the logic code into the service library. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3885 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../HandBrake.ApplicationServices/Parsing/Title.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'win/CS/HandBrake.ApplicationServices/Parsing') diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs index 3a9e6a56a..7f4bf9b78 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs @@ -222,6 +222,26 @@ namespace HandBrake.ApplicationServices.Parsing return titles.ToArray(); } + /// + /// Calcuate the Duration + /// + /// The Start Point (Chapters) + /// The End Point (Chapters) + /// A Timespan + public TimeSpan CalculateDuration(int startPoint, int endPoint) + { + TimeSpan duration = TimeSpan.FromSeconds(0.0); + startPoint++; + endPoint++; + if (startPoint != 0 && endPoint != 0 && endPoint <= this.Chapters.Count) + { + for (int i = startPoint; i <= endPoint; i++) + duration += this.Chapters[i - 1].Duration; + } + + return duration; + } + /// /// Override of the ToString method to provide an easy way to use this object in the UI /// -- cgit v1.2.3