Beispiel #1
0
        public static void Behavioral_CommandDemo2()
        {
            //var videoEditor = new VideoEditor();
            //videoEditor.SetText("demo2 video text");
            //videoEditor.SetContrast(0.7f);
            //var result = videoEditor.ToString();
            //Console.WriteLine(result);

            var videoEditor = new VideoEditor();
            var history     = new Command.Demo2.History();

            var setTextCommand = new SetTextCommand("Video Title", videoEditor, history);

            setTextCommand.Execute();
            Console.WriteLine("TEXT: " + videoEditor);

            var setContrast = new SetContrastCommand(1, videoEditor, history);

            setContrast.Execute();
            Console.WriteLine("CONTRAST: " + videoEditor);

            var undoCommand = new UndoCommand(history);

            undoCommand.Execute();
            Console.WriteLine("UNDO: " + videoEditor);

            undoCommand.Execute();
            Console.WriteLine("UNDO: " + videoEditor);

            undoCommand.Execute();
            Console.WriteLine("UNDO: " + videoEditor);
        }
        static void Main()
        {
            Console.WriteLine("Service is running.");

            String envName  = "GOOGLE_APPLICATION_CREDENTIALS";
            String envValue = @"..\..\..\Credentials\json1.json";

            if (Environment.GetEnvironmentVariable(envName) == null)
            {
                Environment.SetEnvironmentVariable(envName, envValue);
            }

            var client  = VideoIntelligenceServiceClient.Create();
            var request = new AnnotateVideoRequest()
            {
                InputContent = Google.Protobuf.ByteString.CopyFrom(File.ReadAllBytes(@"..\..\..\Videos\InputVideo\testInput.mp4")),
                Features     = { Feature.LabelDetection }
            };

            var op = client.AnnotateVideo(request).PollUntilCompleted();

            TimeDetails timeDetails = ConsumeJsonFile.ReturnTimeOffsets("person", op.Result.AnnotationResults);

            string duration = (timeDetails.EndTime - timeDetails.StartTime).ToString();

            VideoEditor.CutVideo(@"..\..\..\Videos\InputVideo\testInput.mp4", timeDetails.StartTime.ToString(), duration, @"..\..\..\Videos\OutputVideo\Output.mp4");

            Console.WriteLine("Video is edited. Press key to exit.");

            Console.ReadKey();
        }
Beispiel #3
0
        static async Task Main(string[] args)
        {
            var ffmpeg   = new FileInfo(@"C:\Users\james\AppData\Local\Programs\Python\Python38\Scripts\ffmpeg.exe");
            var ffprobe  = new FileInfo(@"C:\Users\james\AppData\Local\Programs\Python\Python38\Scripts\ffprobe.exe");
            var testFile = new FileInfo(@"C:\Users\james\Desktop\AudioFiles\BabyElephantWalk60.wav");
            var editor   = new VideoEditor(ffmpeg, ffprobe, testFile);

            var res = await editor.GetAudioLoudnessInfo();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            var addCustomerCommand = new AddCustomerCommand(new CustomerService());
            var button             = new Button(addCustomerCommand);

            button.Click();

            // Because we are representing each individual task using a command object,
            // we can combine these commands inside a composite object and re-execute them later on.
            var compositeCommand = new CompositeCommand();

            compositeCommand.Add(new ResizeCommand());
            compositeCommand.Add(new BlackAndWhiteCommand());

            compositeCommand.Execute();

            var history      = new Solution.UndoableCommands.History();
            var htmlDocument = new HtmlDocument();

            htmlDocument.Content = "Hello World!";

            var boldCommand = new BoldCommand(htmlDocument, history);

            boldCommand.Execute();

            Console.WriteLine(htmlDocument.Content);

            //boldCommand.Unexecute();
            var undoCommand = new Solution.UndoableCommands.UndoCommand(history);

            undoCommand.Execute();

            Console.WriteLine(htmlDocument.Content);

            Console.WriteLine("--- Exercise ---");

            var exeHistory  = new Exercise.End.History();
            var videoEditor = new VideoEditor();

            var setTextCommand = new SetTextCommand("Hello World!", videoEditor, exeHistory);

            setTextCommand.Execute();

            Console.WriteLine(videoEditor.Text);

            //setTextCommand.Undo();
            var exeUndoCommand = new Exercise.End.UndoCommand(exeHistory);

            exeUndoCommand.Execute();

            Console.WriteLine(videoEditor.Text);

            Console.ReadLine();
        }
Beispiel #5
0
 public SetTextCommand(string text, VideoEditor videoEditor, History history)
 {
     this.text        = text;
     this.videoEditor = videoEditor;
     this.history     = history;
 }
Beispiel #6
0
 public LabelCommand(string text, History history, VideoEditor videoEditor) : base(history, videoEditor)
 {
     this.previousText = videoEditor.getText();
     this.text         = text;
     this.videoEditor  = videoEditor;
 }
Beispiel #7
0
 public AbstractUndoableCommand(History history, VideoEditor videoEditor)
 {
     this.history     = history;
     this.videoEditor = videoEditor;
 }
 public ContrastCommand(float contrast, History history, VideoEditor videoEditor) : base(history, videoEditor)
 {
     this.previousContrast = videoEditor.getContrast();
     this.contrast         = contrast;
     this.videoEditor      = videoEditor;
 }