コード例 #1
0
        static void Screens()
        {
            WriteLine("AVAILABLE SCREENS" + Underline);

            var j = 0;

            // First is Full Screen, Second is Screen Picker
            foreach (var screen in ScreenItem.Enumerate())
            {
                WriteLine($"{j.ToString().PadRight(2)}: {screen.Name}");

                ++j;
            }

            WriteLine();
        }
コード例 #2
0
ファイル: VideoViewModel.cs プロジェクト: sebasstrogg/Captura
        public void RefreshVideoSources()
        {
            AvailableVideoSources.Clear();

            switch (SelectedVideoSourceKind)
            {
            case VideoSourceKind.Window:
                // Desktop would be default
                AvailableVideoSources.Add(WindowItem.Desktop);
                AvailableVideoSources.Add(WindowItem.TaskBar);

                foreach (var win in Window.EnumerateVisible())
                {
                    AvailableVideoSources.Add(new WindowItem(win));
                }
                break;

            case VideoSourceKind.Screen:
                foreach (var screen in ScreenItem.Enumerate())
                {
                    AvailableVideoSources.Add(screen);
                }
                break;

            case VideoSourceKind.Region:
                AvailableVideoSources.Add(RegionItem.Instance);
                break;
            }

            // Set first source as default
            if (AvailableVideoSources.Count > 0)
            {
                SelectedVideoSource = AvailableVideoSources[0];
            }

            // RegionSelector should only be shown on Region Capture.
            if (SelectedVideoSourceKind == VideoSourceKind.Region)
            {
                RegionSelector.Instance.Show();
            }
            else
            {
                RegionSelector.Instance.Hide();
            }
        }
コード例 #3
0
        static void List()
        {
            Banner();

            var underline = $"\n{new string('-', 30)}";

            #region FFmpeg
            var ffmpegExists = FFmpegService.FFmpegExists;

            WriteLine($"FFmpeg Available: {(ffmpegExists ? "YES" : "NO")}");

            WriteLine();

            if (ffmpegExists)
            {
                WriteLine("FFmpeg ENCODERS" + underline);

                var writerProvider = ServiceProvider.Get <FFmpegWriterProvider>();

                var i = 0;

                foreach (var codec in writerProvider)
                {
                    WriteLine($"{i.ToString().PadRight(2)}: {codec}");
                    ++i;
                }

                WriteLine();
            }
            #endregion

            #region SharpAvi
            var sharpAviExists = ServiceProvider.FileExists("SharpAvi.dll");

            WriteLine($"SharpAvi Available: {(sharpAviExists ? "YES" : "NO")}");

            WriteLine();

            if (sharpAviExists)
            {
                WriteLine("SharpAvi ENCODERS" + underline);

                var writerProvider = ServiceProvider.Get <SharpAviWriterProvider>();

                var i = 0;

                foreach (var codec in writerProvider)
                {
                    WriteLine($"{i.ToString().PadRight(2)}: {codec}");
                    ++i;
                }

                WriteLine();
            }
            #endregion

            #region Windows
            WriteLine("AVAILABLE WINDOWS" + underline);

            // Window Picker is skipped automatically
            foreach (var source in Window.EnumerateVisible())
            {
                WriteLine($"{source.Handle.ToString().PadRight(10)}: {source.Title}");
            }

            WriteLine();
            #endregion

            #region Screens
            WriteLine("AVAILABLE SCREENS" + underline);

            var j = 0;

            // First is Full Screen, Second is Screen Picker
            foreach (var screen in ScreenItem.Enumerate())
            {
                WriteLine($"{j.ToString().PadRight(2)}: {screen.Name}");

                ++j;
            }

            WriteLine();
            #endregion

            var audio = ServiceProvider.Get <AudioSource>();

            WriteLine($"ManagedBass Available: {(audio is BassAudioSource ? "YES" : "NO")}");

            WriteLine();

            #region Microphones
            if (audio.AvailableRecordingSources.Count > 0)
            {
                WriteLine("AVAILABLE MICROPHONES" + underline);

                for (var i = 0; i < audio.AvailableRecordingSources.Count; ++i)
                {
                    WriteLine($"{i.ToString().PadRight(2)}: {audio.AvailableRecordingSources[i]}");
                }

                WriteLine();
            }
            #endregion

            #region Speaker
            if (audio.AvailableLoopbackSources.Count > 0)
            {
                WriteLine("AVAILABLE SPEAKER SOURCES" + underline);

                for (var i = 0; i < audio.AvailableLoopbackSources.Count; ++i)
                {
                    WriteLine($"{i.ToString().PadRight(2)}: {audio.AvailableLoopbackSources[i]}");
                }

                WriteLine();
            }
            #endregion

            #region Webcams
            var webcam = ServiceProvider.Get <IWebCamProvider>();

            if (webcam.AvailableCams.Count > 1)
            {
                WriteLine("AVAILABLE WEBCAMS" + underline);

                for (var i = 1; i < webcam.AvailableCams.Count; ++i)
                {
                    WriteLine($"{(i - 1).ToString().PadRight(2)}: {webcam.AvailableCams[i]}");
                }

                WriteLine();
            }
            #endregion
        }