示例#1
0
        static void HandleVideoSource(MainViewModel ViewModel, CommonCmdOptions CommonOptions)
        {
            // Desktop
            if (CommonOptions.Source == null || CommonOptions.Source == "desktop")
            {
                return;
            }

            var video = ViewModel.VideoViewModel;

            // Region
            if (Regex.IsMatch(CommonOptions.Source, @"^\d+,\d+,\d+,\d+$"))
            {
                if (MainViewModel.RectangleConverter.ConvertFromInvariantString(CommonOptions.Source) is Rectangle rect)
                {
                    FakeRegionProvider.Instance.SelectedRegion = rect.Even();
                    video.SelectedVideoSourceKind = ServiceProvider.Get <RegionSourceProvider>();
                }
            }

            // Screen
            else if (Regex.IsMatch(CommonOptions.Source, @"^screen:\d+$"))
            {
                var index = int.Parse(CommonOptions.Source.Substring(7));

                if (index < ScreenItem.Count)
                {
                    video.SelectedVideoSourceKind = ServiceProvider.Get <ScreenSourceProvider>();

                    // First item is Full Screen
                    video.SelectedVideoSource = video.AvailableVideoSources[index + 1];
                }
            }

            // Desktop Duplication
            else if (CommonOptions is StartCmdOptions && Regex.IsMatch(CommonOptions.Source, @"^deskdupl:\d+$"))
            {
                var index = int.Parse(CommonOptions.Source.Substring(9));

                if (index < ScreenItem.Count)
                {
                    video.SelectedVideoSourceKind = ServiceProvider.Get <DeskDuplSourceProvider>();

                    video.SelectedVideoSource = video.AvailableVideoSources[index];
                }
            }

            // No Video for Start
            else if (CommonOptions is StartCmdOptions && CommonOptions.Source == "none")
            {
                video.SelectedVideoSourceKind = ServiceProvider.Get <NoVideoSourceProvider>();
            }
        }
示例#2
0
        void HandleVideoSource(CommonCmdOptions CommonOptions)
        {
            if (CommonOptions.Source == null)
            {
                return;
            }

            var provider = _videoSourceProviders.FirstOrDefault(M => M.ParseCli(CommonOptions.Source));

            if (provider != null)
            {
                _videoSourcesViewModel.RestoreSourceKind(provider);
            }
        }
示例#3
0
        static void HandleVideoSource(VideoSourcesViewModel VideoSourcesViewModel, CommonCmdOptions CommonOptions)
        {
            if (CommonOptions.Source == null)
            {
                return;
            }

            var providers = ServiceProvider.Get <IEnumerable <IVideoSourceProvider> >();

            var provider = providers.FirstOrDefault(M => M.ParseCli(CommonOptions.Source));

            if (provider != null)
            {
                VideoSourcesViewModel.RestoreSourceKind(provider);
            }
        }
示例#4
0
        IVideoSourceProvider HandleVideoSource(CommonCmdOptions CommonOptions)
        {
            var provider = _videoSourceProviders.FirstOrDefault(M => M.ParseCli(CommonOptions.Source));

            return(provider);
        }
示例#5
0
        static void HandleVideoSource(MainViewModel ViewModel, CommonCmdOptions CommonOptions)
        {
            // Desktop
            if (CommonOptions.Source == null || CommonOptions.Source == "desktop")
            {
                return;
            }

            var video = ViewModel.VideoViewModel;

            // Region
            if (Regex.IsMatch(CommonOptions.Source, @"^\d+,\d+,\d+,\d+$"))
            {
                if (MainViewModel.RectangleConverter.ConvertFromInvariantString(CommonOptions.Source) is Rectangle rect)
                {
                    FakeRegionProvider.Instance.SelectedRegion = rect.Even();
                    video.SelectedVideoSourceKind = ServiceProvider.Get <RegionSourceProvider>();
                }
            }

            // Screen
            else if (Regex.IsMatch(CommonOptions.Source, @"^screen:\d+$"))
            {
                var index = int.Parse(CommonOptions.Source.Substring(7));

                if (index < ScreenItem.Count)
                {
                    video.SelectedVideoSourceKind = ServiceProvider.Get <ScreenSourceProvider>();

                    // First item is Full Screen, Second is Screen Picker
                    video.SelectedVideoSource = video.AvailableVideoSources[index + 2];
                }
            }

            // Window
            else if (Regex.IsMatch(CommonOptions.Source, @"^win:\d+$"))
            {
                var handle = new IntPtr(int.Parse(CommonOptions.Source.Substring(4)));

                var winProvider = ServiceProvider.Get <WindowSourceProvider>();

                var matchingWin = winProvider.OfType <WindowItem>().FirstOrDefault(M => M.Window.Handle == handle);

                if (matchingWin != null)
                {
                    video.SelectedVideoSourceKind = winProvider;

                    video.SelectedVideoSource = matchingWin;
                }
            }

            // Start command only
            else if (CommonOptions is StartCmdOptions)
            {
                // Desktop Duplication
                if (Regex.IsMatch(CommonOptions.Source, @"^deskdupl:\d+$"))
                {
                    var index = int.Parse(CommonOptions.Source.Substring(9));

                    if (index < ScreenItem.Count)
                    {
                        video.SelectedVideoSourceKind = ServiceProvider.Get <DeskDuplSourceProvider>();

                        video.SelectedVideoSource = video.AvailableVideoSources[index];
                    }
                }

                // No Video for Start
                else if (CommonOptions.Source == "none")
                {
                    video.SelectedVideoSourceKind = ServiceProvider.Get <NoVideoSourceProvider>();
                }
            }
        }
示例#6
0
        static void HandleVideoSource(MainViewModel ViewModel, CommonCmdOptions CommonOptions)
        {
            // Desktop
            if (CommonOptions.Source == null || CommonOptions.Source == "desktop")
            {
                return;
            }

            var video = ViewModel.VideoViewModel;

            // Region
            if (Regex.IsMatch(CommonOptions.Source, @"^\d+,\d+,\d+,\d+$"))
            {
                if (MainViewModel.RectangleConverter.ConvertFromInvariantString(CommonOptions.Source) is Rectangle rect)
                {
                    FakeRegionProvider.Instance.SelectedRegion = rect.Even();
                    video.SelectedVideoSourceKind = ServiceProvider.Get <RegionSourceProvider>();
                }
            }

            // Screen
            else if (Regex.IsMatch(CommonOptions.Source, @"^screen:\d+$"))
            {
                var index = int.Parse(CommonOptions.Source.Substring(7));

                if (index < ScreenItem.Count)
                {
                    var screenSourceProvider = ServiceProvider.Get <ScreenSourceProvider>();

                    screenSourceProvider.Set(index);

                    video.RestoreSourceKind(screenSourceProvider);
                }
            }

            // Window
            else if (Regex.IsMatch(CommonOptions.Source, @"^win:\d+$"))
            {
                var handle = new IntPtr(int.Parse(CommonOptions.Source.Substring(4)));

                var winProvider = ServiceProvider.Get <WindowSourceProvider>();

                winProvider.Set(handle);

                video.RestoreSourceKind(winProvider);
            }

            // Start command only
            else if (CommonOptions is StartCmdOptions)
            {
                // Desktop Duplication
                if (Regex.IsMatch(CommonOptions.Source, @"^deskdupl:\d+$"))
                {
                    var index = int.Parse(CommonOptions.Source.Substring(9));

                    if (index < ScreenItem.Count)
                    {
                        var deskDuplSourceProvider = ServiceProvider.Get <DeskDuplSourceProvider>();

                        deskDuplSourceProvider.Set(new ScreenWrapper(Screen.AllScreens[index]));

                        video.RestoreSourceKind(deskDuplSourceProvider);
                    }
                }

                // No Video for Start
                else if (CommonOptions.Source == "none")
                {
                    video.SelectedVideoSourceKind = ServiceProvider.Get <NoVideoSourceProvider>();
                }
            }
        }