Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,23 @@ public static bool checkFFmpegFontConfig()
}
}

/// <summary>
/// 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
/// </summary>
/// <param name="timeInput">input text</param>
/// <returns></returns>
public static string fillMissingZeroes(string timeInput)
{
string zeroes = "00:00:00";
return zeroes.Substring(0, zeroes.Length - timeInput.Length) + timeInput;
}

/// <summary>
/// Verifies the version of the program.
/// It will prompt the user if the program is
Expand Down
9 changes: 8 additions & 1 deletion formMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down