Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     Parser.Default.ParseArguments <Options>(args)
     .WithParsed <Options>(opts =>
     {
         UscProject proj = null;
         var robot       = new UscRobot(opts.Executable);
         try
         {
             robot.Launch();
             proj = robot.CreateNewProject(opts.ClipName, opts.ClipDescription, opts.ProjectName, opts.ProjectDescription, opts.Output);
             robot.AddVideoStream(Path.GetFullPath(opts.Video));
             robot.AddAudioStream(Path.GetFullPath(opts.Audio));
             robot.Compose(proj);
         }
         finally
         {
             robot.Close();
             proj?.Delete();
         }
     })
     .WithNotParsed(errors =>
     {
     });
 }
Ejemplo n.º 2
0
        public UscProject CreateNewProject(string clipName, string clipDesc = null, string projName = null, string projDesc = null, string output = null)
        {
            UscProject proj = new UscProject(clipName, clipDesc, projName, projDesc, output);

            try
            {
                OpenCreateNewDialog();
                var newProjDialog = mainWindow.FindFirstDescendant(cf => cf.ByName("Create new clip"))?.AsWindow();
                var edits         = newProjDialog.FindAllDescendants(cf => cf.ByClassName("Edit"));
                edits[0].AsTextBox().Enter(clipName);
                edits[1].AsTextBox().Enter(clipDesc);
                edits[2].AsTextBox().Enter(projName);
                edits[3].AsTextBox().Enter(projDesc);


                using (Keyboard.Pressing(VirtualKeyShort.ALT))
                {
                    Keyboard.Press(VirtualKeyShort.KEY_N);
                }
                Thread.Sleep(TimeSpan.FromSeconds(1));


                var allBtn = newProjDialog.FindAllDescendants(cf => cf.ByClassName("Button"));
                var cbPsp  = allBtn.FirstOrDefault(e => e.Name == "PSP Movie Format (for game)")?.AsCheckBox();
                if (cbPsp != null)
                {
                    cbPsp.IsChecked = true;
                }

                var btnFin = allBtn.FirstOrDefault(e => e.Properties.AutomationId.IsSupported && e.AutomationId == "12325")?.AsButton();
                if (btnFin != null)
                {
                    btnFin.Click();
                }

                Thread.Sleep(1000);
                return(proj);
            }
            catch (Exception ex)
            {
                proj.Delete();
                throw ex;
            }
        }