Beispiel #1
0
        private async void RunSnipVideo(string[] args, IProgress <ReportPacket> progress)
        {
            SetIsWorking(true);
            {
                await Task.Run(() =>
                {
                    string filepath = Path.GetTempFileName();
                    try
                    {
                        File.WriteAllBytes(filepath, Resources.ffmpeg);
                        foreach (var arg in args)
                        {
                            string output = arg.Split(' ').Last();
                            output        = output.Replace("\"", "");
                            output        = Path.GetFileName(output);
                            progress.Report(ReportPacket.MakeText(output));

                            var info             = new ProcessStartInfo(filepath, arg);
                            info.UseShellExecute = false;
                            info.CreateNoWindow  = true;
                            Process.Start(info).WaitForExit();
                            progress.Report(ReportPacket.MakeIncrement());
                        }
                    }
                    finally
                    {
                        File.Delete(filepath);
                    }
                });
            }
            SetIsWorking(false);
        }
Beispiel #2
0
 private void AcceptPacket(ReportPacket packet)
 {
     if (packet.Increment)
     {
         progStatus.Increment(1);
     }
     else
     {
         progStatus.Text = packet.Text;
         progStatus.Refresh();
     }
 }