@@ -69,7 +69,17 @@ private void ProcessOnErrorDataReceived(object sender, DataReceivedEventArgs arg
6969 if ( args . Data != null && ! args . Data . Contains ( "AVOption" ) )
7070 {
7171 if ( DataContainsProgress ( args . Data ) )
72- ParseAndUpdateProgress ( args . Data ) ;
72+ {
73+ try
74+ {
75+ ParseAndUpdateProgress ( args . Data ) ;
76+ }
77+ catch ( Exception ex )
78+ {
79+ boxOutput . AppendText ( $ "An error happened { ex . Message } ") ;
80+ }
81+ }
82+
7383 else
7484 boxOutput . InvokeIfRequired ( ( ) => boxOutput . AppendText ( Environment . NewLine + args . Data ) ) ;
7585 }
@@ -90,11 +100,11 @@ private bool DataContainsProgress(string data)
90100
91101 private void ParseAndUpdateProgress ( string input )
92102 {
93- var r = new Regex ( @"time=([^ ]+) " ) ;
103+ var r = new Regex ( @"time=\d\d:\d\d:\d\d.\d\d " ) ;
94104 var m = r . Match ( input ) ;
95105 if ( m . Success )
96106 {
97- var time = TimeSpan . Parse ( m . Groups [ 1 ] . Value ) ; // happens to be the same format as TimeSpan so yay
107+ var time = TimeSpan . Parse ( m . Value . Split ( '=' ) [ 1 ] ) ; // happens to be the same format as TimeSpan so yay
98108 var progress = Math . Abs ( ( float ) time . TotalSeconds / _induration ) ; // sometimes the progress is negative, breaking the progressBar
99109 progress = Math . Min ( progress , 1 ) ; // sometimes progress becomes more than 100%, which breaks the progressBar
100110 progressBar . InvokeIfRequired ( ( ) =>
@@ -470,6 +480,7 @@ private void ExitedMerge(object sender, EventArgs eventArgs)
470480 }
471481 else
472482 {
483+ taskbarManager . SetProgressValue ( 1000 , 1000 ) ;
473484 boxOutput . AppendText ( $ "{ Environment . NewLine } { Environment . NewLine } Video converted succesfully!") ;
474485 GetFileSize ( ) ;
475486 pictureStatus . BackgroundImage = StatusImages . Images [ "Success" ] ;
0 commit comments