diff options
author | Sverrir Sigmundarson <[email protected]> | 2015-11-20 01:00:13 +0100 |
---|---|---|
committer | Sverrir Sigmundarson <[email protected]> | 2015-11-23 14:39:32 +0100 |
commit | 4137a887b8fad760eb0c90d3ca90303aa3674740 (patch) | |
tree | ea381f573d587170d3664b716e67b232e0c92703 /win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs | |
parent | ec2474b1e9024d053915f9d91cf2da84f1f4fafe (diff) |
Adding support for ChapterDb.org input formats (XML and TXT) files. Minor refactorings to accomodate the parsing of the new input formats.
Diffstat (limited to 'win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs b/win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs new file mode 100644 index 000000000..94d7629b9 --- /dev/null +++ b/win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HandBrakeWPF.Helpers +{ + using System.Globalization; + + /// <summary> + /// Helper functions for handling <see cref="TimeSpan"/> structures + /// </summary> + internal static class TimeSpanHelper + { + /// <summary> + /// Parses chapter time start value from a chapter marker input file. + /// </summary> + /// <param name="chapterStartRaw">The raw string value parsed from the input file</param> + internal static TimeSpan ParseChapterTimeStart(string chapterStartRaw) + { + //Format: 02:35:05 and 02:35:05.2957333 + return TimeSpan.ParseExact(chapterStartRaw, + new[] + { + @"hh\:mm\:ss", // Handle whole seconds + @"hh\:mm\:ss\.FFFFFFF" // Handle fraction seconds + }, CultureInfo.InvariantCulture); + } + } +} |