Exemple #1
0
        public void Compose(UscProject project)
        {
            var btnStart = mainWindow.FindFirstDescendant(cf => cf.ByClassName("Button").And(cf.ByName("Start...")))?.AsButton();

            btnStart?.Click();

            Thread.Sleep(1000);
            var actionCombo = mainWindow.FindFirstDescendant(cf => cf.ByAutomationId("1355"))?.AsComboBox();

            actionCombo.Select(2);

            var btnStart2 = mainWindow.FindFirstDescendant(cf => cf.ByClassName("Button").And(cf.ByName("Start")))?.AsButton();

            btnStart2?.Click();

            while (!btnStart2.IsEnabled)
            {
                Thread.Sleep(1000);
            }

            var btnClose = mainWindow.FindFirstDescendant(cf => cf.ByClassName("Button").And(cf.ByName("Close")))?.AsButton();

            btnClose?.Click();

            if (!string.IsNullOrEmpty(project.Output))
            {
                var projectOutput = project.ProjectOutput;
                File.Copy(projectOutput, project.Output, true);
            }
        }
Exemple #2
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 =>
     {
     });
 }
Exemple #3
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;
            }
        }