Skip to content

Commit

Permalink
Merge branch 'hotfix-1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterOfWebM committed Apr 16, 2014
2 parents 3dd0e07 + 086b2de commit 1a5e852
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 19 deletions.
16 changes: 16 additions & 0 deletions Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,21 @@ public static void checkUpdate()
}
}
}

/// <summary>
/// Checks if a subtitle (subs.ass | subs.srt) exists
/// and deletes it.
/// </summary>
public static void subsCheck()
{
if(File.Exists("subs.ass"))
{
File.Delete("subs.ass");
}
else if (File.Exists("subs.srt"))
{
File.Delete("subs.srt");
}
}
}
}
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
1 change: 1 addition & 0 deletions formMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 39 additions & 17 deletions formMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ private void txtTimeStart_Leave(object sender, EventArgs e)

private void btnConvert_Click(object sender, EventArgs e)
{
// Delete any existing temp subtitle file
Helper.subsCheck();

// Disable btnConvert so user's cant click on it multiple times
btnConvert.Enabled = false;

Expand Down Expand Up @@ -128,6 +131,22 @@ private void btnConvert_Click(object sender, EventArgs e)
baseCommand = baseCommand.Replace("{length}", txtLength.Text);
}

// Validates if the user input a value for txtCrop
if (!verifyCrop.IsMatch(txtCrop.Text))
{
if (txtCrop.Text != "o_w:o_h:x:y")
{
verified = false;
MessageBox.Show("The crop field is not properly set\nSyntax:\nout_x:out_y:x:y\n\nout_x & out_y is the output size\nx & y are where you begin your crop",
"Verification Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
filters = true;
filterCommands += filterCommands == null ? "crop=" + txtCrop.Text : ",crop=" + txtCrop.Text;
}

// Check if we need to add subtitles
if (txtSubs.Text != "")
{
Expand All @@ -146,22 +165,6 @@ private void btnConvert_Click(object sender, EventArgs e)
}
}

// Validates if the user input a value for txtCrop
if (!verifyCrop.IsMatch(txtCrop.Text))
{
if (txtCrop.Text != "o_w:o_h:x:y")
{
verified = false;
MessageBox.Show("The crop field is not properly set\nSyntax:\nout_x:out_y:x:y\n\nout_x & out_y is the output size\nx & y are where you begin your crop",
"Verification Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
filters = true;
filterCommands += filterCommands == null ? "crop=" + txtCrop.Text : ",crop=" + txtCrop.Text;
}

// Validates if the user input a value for txtWidth
if (!verifyWidth.IsMatch(txtWidth.Text))
{
Expand All @@ -185,7 +188,14 @@ private void btnConvert_Click(object sender, EventArgs e)
}
else
{
bitrate = Helper.calcBitrate(txtMaxSize.Text, txtLength.Text);
try
{
bitrate = Helper.calcBitrate(txtMaxSize.Text, txtLength.Text);
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}

// If audio is requested
if (checkAudio.Checked)
Expand Down Expand Up @@ -365,6 +375,7 @@ private void txtCrop_Enter(object sender, EventArgs e)
{
txtCrop.Left -= 46;
txtCrop.Size = new System.Drawing.Size(115, 20);
txtCrop.ForeColor = Color.Black;

if (txtCrop.Text == "o_w:o_h:x:y")
{
Expand All @@ -381,6 +392,7 @@ private void txtCrop_Leave(object sender, EventArgs e)
if (txtCrop.Text == "")
{
txtCrop.Text = "o_w:o_h:x:y";
txtCrop.ForeColor = Color.Silver;
}
}

Expand All @@ -401,6 +413,16 @@ private void btnClear_Click(object sender, EventArgs e)
txtCrop.Text = "o_w:o_h:x:y";
txtCrop.ForeColor = Color.Silver;
comboQuality.SelectedIndex = 0;
checkAudio.Checked = false;
}

private void comboQuality_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboQuality.Text == "Ultra")
MessageBox.Show("Ultra quality will try getting just under your\n" +
"'Max Size'. This program will run ffmpeg up to 11 \n" +
"times and currently there is no way of stopping it.\n\n" +
"USE AT YOUR OWN RISK.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}

0 comments on commit 1a5e852

Please sign in to comment.