The line:
currentFrameInt = System.Convert.ToInt32(currentFramestr);
In this case i see in currentFramestr the value " 9f" Including three spaces in the start of the string.
The currentFramestr is part of updating a progressBar1:
if (strFFOUT.Contains("frame="))
{
currentFramestr = strFFOUT.Substring(7, 6);
currentFramestr = currentFramestr.Trim();
currentFrameInt = System.Convert.ToInt32(currentFramestr, 16);
}
string percentage = System.Convert.ToInt32((ProgressBar1.Value / ProgressBar1.Maximum * 100)).ToString() + "%";
ProgressBar1.Maximum = FCount + 1000;
ProgressBar1.Value = (currentFrameInt);
What i want to do is to update the progressBar value.
Maybe the whole method code will give more clue of what i want and the using with currentFramestr. In general i want to update the progressBar1 value.
private void Convert()
{
Control.CheckForIllegalCrossThreadCalls = false;
if (ComboBox1.SelectedIndex == 3)
{
strFFCMD = " -i \"" + InputFile + "\" \"" + OutputFile + "\"";
}
if (ComboBox1.SelectedIndex == 2)
{
strFFCMD = " -i " + (char)34 + InputFile + (char)34 +
" -c:v libx264 -s 1280x720 -pix_fmt yuv420p -qp 20 -profile high444-c:a libvo_aacenc -b:a 128k -ar 44100 -ac 2 " + OutputFile;
}
psiProcInfo.FileName = exepath;
psiProcInfo.Arguments = strFFCMD;
psiProcInfo.UseShellExecute = false;
psiProcInfo.WindowStyle = ProcessWindowStyle.Hidden;
psiProcInfo.RedirectStandardError = true;
psiProcInfo.RedirectStandardOutput = true;
psiProcInfo.CreateNoWindow = true;
prcFFMPEG.StartInfo = psiProcInfo;
prcFFMPEG.Start();
ffReader = prcFFMPEG.StandardError;
do
{
if (Bgw1.CancellationPending)
{
return;
}
Button5.Enabled = true;
Button3.Enabled = false;
strFFOUT = ffReader.ReadLine();
RichTextBox1.Text = strFFOUT;
if (strFFOUT.Contains("frame="))
{
currentFramestr = strFFOUT.Substring(7, 6);
currentFramestr = currentFramestr.Trim();
currentFrameInt = System.Convert.ToInt32(currentFramestr, 16);
}
string percentage = System.Convert.ToInt32((ProgressBar1.Value / ProgressBar1.Maximum * 100)).ToString() + "%";
ProgressBar1.Maximum = FCount + 1000;
ProgressBar1.Value = (currentFrameInt);
Label12.Text = "Current Encoded Frame: " + currentFrameInt;
Label11.Text = percentage;
} while (!(prcFFMPEG.HasExited || string.IsNullOrEmpty(strFFOUT)));
}