public void OnProgress(TimeOfProgress args) { EventHandler<TimeOfProgress> handler = Progress; if (handler != null) { handler(this, args); } }
private void ProcessOutput(string output) { if (output == null) return; if (inputDurationTotalSeconds < 0) { Match durationMatch = ffmpegDurationRegex.Match(output); if (durationMatch.Success) { inputDurationTotalSeconds = Convert.ToDateTime(durationMatch.Groups[1].Value).TimeOfDay.TotalSeconds; } } else { Match progressMatch = ffmpegProgressRegex.Match(output); if (progressMatch.Success) { DateTime dateTime = Convert.ToDateTime(progressMatch.Groups[4].Value); TimeOfProgress TOP = new TimeOfProgress { Second = dateTime.TimeOfDay.TotalSeconds, DonePercentage = 100 / inputDurationTotalSeconds * dateTime.TimeOfDay.TotalSeconds }; OnProgress(TOP); } Match finishedMatch = ffmpegSuccessfullyDoneRegex.Match(output); if (finishedMatch.Success) { FinishedGood = true; } } }