Exemplo n.º 1
0
        private void UpdateProcessToCaptureList()
        {
            var selectedProcessToCapture = SelectedProcessToCapture;
            var backupProcessList        = new List <string>(ProcessesToCapture);

            ProcessesToCapture.Clear();
            var filter      = CaptureServiceConfiguration.GetProcessIgnoreList();
            var processList = _captureService.GetAllFilteredProcesses(filter).Distinct();

            ProcessesToCapture.AddRange(processList);

            // fire update global hook if new process is detected
            if (backupProcessList.Count != ProcessesToCapture.Count)
            {
                UpdateGlobalHookEvent();
            }

            if (!processList.Contains(selectedProcessToCapture))
            {
                SelectedProcessToCapture = null;
            }
            else
            {
                SelectedProcessToCapture = selectedProcessToCapture;
            }

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                UpdateCaptureStateInfo();
            }));
        }
Exemplo n.º 2
0
 private ICaptureServiceConfiguration GetRedirectedServiceConfig()
 {
     return(new PresentMonServiceConfiguration
     {
         RedirectOutputStream = true,
         ExcludeProcesses = CaptureServiceConfiguration.GetProcessIgnoreList().ToList()
     });
 }
Exemplo n.º 3
0
 private void SubscribeToUpdateProcessIgnoreList()
 {
     _eventAggregator.GetEvent <PubSubEvent <ViewMessages.UpdateProcessIgnoreList> >()
     .Subscribe(msg =>
     {
         ProcessesToIgnore.Clear();
         ProcessesToIgnore.AddRange(CaptureServiceConfiguration.GetProcessIgnoreList());
     });
 }
Exemplo n.º 4
0
        private void OnAddToProcessList()
        {
            if (SelectedProcessToIgnore == null)
            {
                return;
            }

            StopCaptureService();
            CaptureServiceConfiguration.RemoveProcessFromIgnoreList(SelectedProcessToIgnore);
            ProcessesToIgnore.Clear();
            ProcessesToIgnore.AddRange(CaptureServiceConfiguration.GetProcessIgnoreList());
            StartCaptureService();
        }
Exemplo n.º 5
0
        private void WriteCaptureDataToFile()
        {
            // explicit hook, only one process
            if (!string.IsNullOrWhiteSpace(SelectedProcessToCapture))
            {
                Task.Run(() => WriteExtractedCaptureDataToFile(SelectedProcessToCapture));
            }
            // auto hook with filtered process list
            else
            {
                var filter  = CaptureServiceConfiguration.GetProcessIgnoreList();
                var process = ProcessesToCapture.FirstOrDefault();

                Task.Run(() => WriteExtractedCaptureDataToFile(process));
            }
        }
Exemplo n.º 6
0
        public IList <IFileRecordInfo> GetFileRecordInfoList()
        {
            var filterList = CaptureServiceConfiguration.GetProcessIgnoreList();

            if (filterList.Contains("CapFrameX"))
            {
                filterList.Remove("CapFrameX");
            }

            return(_recordObserver.GetAllRecordFileInfo()
                   .Select(fileInfo => GetFileRecordInfo(fileInfo))
                   .Where(fileRecordInfo => fileRecordInfo != null)
                   .Where(fileRecordInfo => CheckNotContains(filterList, fileRecordInfo.ProcessName))
                   .OrderBy(fileRecordInfo => fileRecordInfo.GameName)
                   .ToList());
        }
Exemplo n.º 7
0
        private void UpdateProcessToCaptureList()
        {
            var selectedProcessToCapture = SelectedProcessToCapture;
            var backupProcessList        = new List <string>(ProcessesToCapture);

            ProcessesToCapture.Clear();
            var filter      = CaptureServiceConfiguration.GetProcessIgnoreList();
            var processList = _captureService.GetAllFilteredProcesses(filter).Distinct();

            ProcessesToCapture.AddRange(processList);

            if (ProcessesToCapture.Any() && !string.IsNullOrWhiteSpace(_lastCapturedProcess))
            {
                if (!ProcessesToCapture.Contains(_lastCapturedProcess) ||
                    (selectedProcessToCapture != null &&
                     selectedProcessToCapture != _lastCapturedProcess))
                {
                    _overlayService.ResetHistory();
                }
            }

            // fire update global hook if new process is detected
            if (backupProcessList.Count != ProcessesToCapture.Count)
            {
                UpdateGlobalCaptureHookEvent();
            }

            if (!processList.Contains(selectedProcessToCapture))
            {
                SelectedProcessToCapture = null;
            }
            else
            {
                SelectedProcessToCapture = selectedProcessToCapture;
            }

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                UpdateCaptureStateInfo();
            }));
        }
Exemplo n.º 8
0
        public CaptureViewModel(IAppConfiguration appConfiguration,
                                ICaptureService captureService,
                                IEventAggregator eventAggregator,
                                IRecordDataProvider recordDataProvider,
                                IOverlayService overlayService,
                                IStatisticProvider statisticProvider,
                                ILogger <CaptureViewModel> logger)
        {
            _appConfiguration   = appConfiguration;
            _captureService     = captureService;
            _eventAggregator    = eventAggregator;
            _recordDataProvider = recordDataProvider;
            _overlayService     = overlayService;
            _statisticProvider  = statisticProvider;
            _logger             = logger;

            AddToIgonreListCommand     = new DelegateCommand(OnAddToIgonreList);
            AddToProcessListCommand    = new DelegateCommand(OnAddToProcessList);
            ResetCaptureProcessCommand = new DelegateCommand(OnResetCaptureProcess);

            _logger.LogDebug("{viewName} Ready", this.GetType().Name);
            CaptureStateInfo = "Service ready..." + Environment.NewLine +
                               $"Press {CaptureHotkeyString} to start capture of the running process.";
            SelectedSoundMode = _appConfiguration.HotkeySoundMode;
            CaptureTimeString = _appConfiguration.CaptureTime.ToString();

            ProcessesToIgnore.AddRange(CaptureServiceConfiguration.GetProcessIgnoreList());
            _disposableHeartBeat = GetListUpdatHeartBeat();
            _frametimeStream     = new Subject <string>();

            SubscribeToUpdateProcessIgnoreList();
            SubscribeToGlobalCaptureHookEvent();

            bool captureServiceStarted = StartCaptureService();

            if (captureServiceStarted)
            {
                _overlayService.SetCaptureServiceStatus("Capture service ready...");
            }


            _captureService.IsCaptureModeActiveStream.OnNext(false);

            FrametimeModel = new PlotModel
            {
                PlotMargins         = new OxyThickness(40, 0, 0, 40),
                PlotAreaBorderColor = OxyColor.FromArgb(64, 204, 204, 204),
                LegendPosition      = LegendPosition.TopCenter,
                LegendOrientation   = LegendOrientation.Horizontal
            };

            //Axes
            //X
            FrametimeModel.Axes.Add(new LinearAxis()
            {
                Key                    = "xAxis",
                Position               = AxisPosition.Bottom,
                Title                  = "Samples",
                MajorGridlineStyle     = LineStyle.Solid,
                MajorGridlineThickness = 1,
                MajorGridlineColor     = OxyColor.FromArgb(64, 204, 204, 204),
                MinorTickSize          = 0,
                MajorTickSize          = 0
            });

            //Y
            FrametimeModel.Axes.Add(new LinearAxis()
            {
                Key                    = "yAxis",
                Position               = AxisPosition.Left,
                Title                  = "Frametime [ms]",
                MajorGridlineStyle     = LineStyle.Solid,
                MajorGridlineThickness = 1,
                MajorGridlineColor     = OxyColor.FromArgb(64, 204, 204, 204),
                MinorTickSize          = 0,
                MajorTickSize          = 0
            });
        }