diff --git a/Helper.cs b/Helper.cs
index 495b590..5424ecc 100644
--- a/Helper.cs
+++ b/Helper.cs
@@ -178,6 +178,23 @@ public static bool checkFFmpegFontConfig()
}
}
+ ///
+ /// Converts input to HH:MM:SS format.
+ /// 1 -> 00:00:01
+ /// 11 -> 00:00:11
+ /// 1:11 -> 00:01:11
+ /// 11:11 -> 00:11:11
+ /// 1:11:11 -> 01:11:11
+ /// 11:11:11 -> 11:11:11
+ ///
+ /// input text
+ ///
+ public static string fillMissingZeroes(string timeInput)
+ {
+ string zeroes = "00:00:00";
+ return zeroes.Substring(0, zeroes.Length - timeInput.Length) + timeInput;
+ }
+
///
/// Verifies the version of the program.
/// It will prompt the user if the program is
diff --git a/formMain.cs b/formMain.cs
index e64c54c..ff45b32 100644
--- a/formMain.cs
+++ b/formMain.cs
@@ -17,7 +17,7 @@ public partial class formMain : Form
private String runningDirectory = AppDomain.CurrentDomain.BaseDirectory; // Obtains the root directory
Regex verifyLength = new Regex(@"^\d{1,3}"); // Regex to verify if txtLength is properly typed in
- Regex verifyTimeStart = new Regex(@"^[0-6]\d:[0-6]\d:[0-6]\d"); // Regex to verify if txtStartTime is properly typed in
+ Regex verifyTimeStart = new Regex(@"^(([0-6]?\d\D+)?[0-6]?\d\D+)?[0-6]?\d");// Regex to verify if txtStartTime is properly typed in
Regex verifyWidth = new Regex(@"^\d{1,4}"); // Regex to verify if txtWidth is properly typed in
Regex verifyMaxSize = new Regex(@"^\d{1,4}"); // Regex to verify if txtMaxSize is properly typed in
Regex verifyCrop = new Regex(@"^\d{1,4}:\d{1,4}:\d{1,4}:\d{1,4}"); // Regex to verify if txtCrop is properly typed in
@@ -95,6 +95,13 @@ private void btnConvert_Click(object sender, EventArgs e)
}
else
{
+ if (txtTimeStart.Text.Length < 8)
+ {
+ // Input is valid against regex, but maybe we have to add missing zeroes
+ string correctedTimeInput = Helper.fillMissingZeroes(txtTimeStart.Text);
+ txtTimeStart.Text = correctedTimeInput;
+ }
+
// Calculates the seconds from the time-code
double seconds = Helper.convertToSeconds(txtTimeStart.Text);