/* Converters.cs $ This file is part of the HandBrake source code. Homepage: . It may be used under the terms of the GNU General Public License. */ namespace HandBrake.ApplicationServices.Functions { using System; using System.Text.RegularExpressions; /// /// A class to convert various things to native C# objects /// public class Converters { /// /// Convert HandBrakes time remaining into a TimeSpan /// /// /// The time remaining for the encode. /// /// /// A TimepSpan object /// public static TimeSpan EncodeToTimespan(string time) { TimeSpan converted = new TimeSpan(0, 0, 0, 0); Match m = Regex.Match(time.Trim(), @"^([0-9]{2}:[0-9]{2}:[0-9]{2})"); if (m.Success) { TimeSpan.TryParse(m.Groups[0].Value, out converted); } return converted; } } }