Ejemplo n.º 1
0
        /// <summary>
        ///     Get output file
        /// </summary>
        private string GetOutputFile()
        {
            var file = Path.Combine(
                Settings.Default.VideoLoc, "ScreenCapture"
                );

            if (File.Exists(file))
            {
                //create unique name
                var index = 1;
                while (true)
                {
                    file = Path.Combine(
                        Settings.Default.VideoLoc, string.Format("ScreenCapture({0})", index)
                        );

                    if (!File.Exists(file)) break;
                    index++;
                }
            }

            if (string.IsNullOrEmpty(Path.GetExtension(file)))
            {
                file = Path.ChangeExtension(file, Settings.Default.VideoType.ToString());
            }

            VariablesParser.PushVariable("VIDEO_LOCATION", file);

            return file;
        }
Ejemplo n.º 2
0
 public void ParseVariablesWithRepeatlyVariables()
 {
     var input = "x*x*y";
                 var result = new KeyCountCollection<string>();
                 var parser = new VariablesParser();
                 var multipliers = parser.GetVariables(input);
                 result.AddRange(multipliers);
                 Assert.IsTrue(result.Count() == 2);
                 Assert.AreEqual(result.First(x => x.Key == "x").Value, 2);
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     Execute
        /// </summary>
        public void Execute()
        {
            var avMaker = new Process(); //Audio-Video maker process

            avMaker.StartInfo.FileName = Path.Combine(WorkingDir, Executable);

            //TODO: ask If output.mp4 need to be overwritten?

#if DEBUG
            avMaker.StartInfo.UseShellExecute = false;
            avMaker.StartInfo.CreateNoWindow = false;
#else 
            avMaker.StartInfo.UseShellExecute = false;
            avMaker.StartInfo.CreateNoWindow = true;
#endif

            var outFile = GetOutputFile();

            //avMaker.StartInfo.Arguments = String.Format(@"-i bitmaps\{0} -vcodec huffyuv output.avi", pngLoc);
            //avMaker.StartInfo.Arguments = String.Format(@"-i bitmaps\{0} -r 20 output.mp4", pngLoc);

            avMaker.StartInfo.Arguments = VariablesParser.ExpandVariables(Arguments);
            // String.Format(@"-i {0} -r {2} -c:v libx264 -preset slow -crf 21 {1}", ifile, outFile, Settings.Default.FramesPerSec);
            // avMaker.StartInfo.Arguments = String.Format(@" -r 20 -i bitmaps\{0} -c:v libx264 -r 20 -pix_fmt yuv420p output.mp4", pngLoc);

            if (!avMaker.Start())
            {
                Console.WriteLine(Resources.AVError);
                return;
            }

            //output
            // log.Info(avMaker.StandardOutput.ReadToEnd());
            //errors
            //log.Error(avMaker.StandardError.ReadToEnd());

            avMaker.WaitForExit();
            avMaker.Close();
        }