public ProcessingUnit CreateOne()
 {
     ProcessingUnit pu = new ProcessingUnit();
       pu.OnDataReceived += pu_OnDataReceived;
       units.Add(pu);
       return pu;
 }
        public ProcessingUnit CreateOne()
        {
            ProcessingUnit pu = new ProcessingUnit();

            pu.OnDataReceived += pu_OnDataReceived;
            units.Add(pu);
            return(pu);
        }
        protected override void pu_OnDataReceived(object sender, ProcessingUnitDataReceivedEventArgs e)
        {
            if (e.Data == null)
            {
                return;
            }

            Match match = TimeFromLine.Match(e.Data);

            if (match.Success)
            {
                string value = match.Groups[1].Value;
                double d     = TimeSpan.ParseExact(value, "hh\\:mm\\:ss\\.ff", CultureInfo.InvariantCulture).TotalSeconds;
                double perc  = 100 * d / TotalSeconds;

                ProcessingUnit pu = sender as ProcessingUnit;
                Console.SetCursorPosition(0, units.IndexOf(pu));
                string str = String.Format("{0:0.00}%", perc);
                Console.WriteLine(str);
            }
        }
Example #4
0
 static void ExecuteFFMPEG(string args, ProcessingUnit pu)
 {
     Process proc = new Process();
       proc.StartInfo.FileName = "ffmpeg.exe";
       proc.StartInfo.Arguments = args;
       proc.StartInfo.UseShellExecute = false;
       proc.StartInfo.RedirectStandardOutput = true;
       proc.StartInfo.RedirectStandardError = true;
       proc.ErrorDataReceived += pu.DataReceived;
       proc.OutputDataReceived += pu.DataReceived;
       pu.Write("\n\n" + args + "\n\n");
       proc.Start();
       proc.PriorityClass = ProcessPriorityClass.Idle;
       proc.BeginOutputReadLine();
       proc.BeginErrorReadLine();
       proc.WaitForExit();
       proc.Close();
 }
 public void Destroy(ProcessingUnit pu)
 {
     pu.OnDataReceived -= pu_OnDataReceived;
       units.Remove(pu);
 }
 public void Destroy(ProcessingUnit pu)
 {
     pu.OnDataReceived -= pu_OnDataReceived;
     units.Remove(pu);
 }