Ejemplo 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();
            }));
        }
Ejemplo n.º 2
0
 private ICaptureServiceConfiguration GetRedirectedServiceConfig()
 {
     return(new PresentMonServiceConfiguration
     {
         RedirectOutputStream = true,
         ExcludeProcesses = CaptureServiceConfiguration.GetProcessIgnoreList().ToList()
     });
 }
Ejemplo n.º 3
0
        private string GetOutputFilename(string processName)
        {
            var    filename          = CaptureServiceConfiguration.GetCaptureFilename(processName);
            string observedDirectory = RecordDirectoryObserver
                                       .GetInitialObservedDirectory(_appConfiguration.ObservedDirectory);

            return(Path.Combine(observedDirectory, filename));
        }
Ejemplo n.º 4
0
 private void SubscribeToUpdateProcessIgnoreList()
 {
     _eventAggregator.GetEvent <PubSubEvent <ViewMessages.UpdateProcessIgnoreList> >()
     .Subscribe(msg =>
     {
         ProcessesToIgnore.Clear();
         ProcessesToIgnore.AddRange(CaptureServiceConfiguration.GetProcessIgnoreList());
     });
 }
Ejemplo n.º 5
0
        private void StartCaptureService()
        {
            var serviceConfig = GetRedirectedServiceConfig();
            var startInfo     = CaptureServiceConfiguration
                                .GetServiceStartInfo(serviceConfig.ConfigParameterToArguments());

            _captureService.StartCaptureService(startInfo);

            StartFillArchive();
        }
Ejemplo n.º 6
0
        private void OnAddToProcessList()
        {
            if (SelectedProcessToIgnore == null)
            {
                return;
            }

            StopCaptureService();
            CaptureServiceConfiguration.RemoveProcessFromIgnoreList(SelectedProcessToIgnore);
            ProcessesToIgnore.Clear();
            ProcessesToIgnore.AddRange(CaptureServiceConfiguration.GetProcessIgnoreList());
            StartCaptureService();
        }
Ejemplo n.º 7
0
        private bool StartCaptureService()
        {
            bool success;
            var  serviceConfig = GetRedirectedServiceConfig();
            var  startInfo     = CaptureServiceConfiguration
                                 .GetServiceStartInfo(serviceConfig.ConfigParameterToArguments());

            success = _captureService.StartCaptureService(startInfo);

            StartFillArchive();

            return(success);
        }
Ejemplo n.º 8
0
        private void OnAddToIgnoreList()
        {
            if (!RecordInfoList.Any())
            {
                return;
            }

            CaptureServiceConfiguration.AddProcessToIgnoreList(SelectedRecordInfo.GameName);
            _updateProcessIgnoreListEvent.Publish(new ViewMessages.UpdateProcessIgnoreList());

            SelectedRecordInfo = null;
            RecordInfoList.Clear();
            LoadRecordList();
        }
Ejemplo n.º 9
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));
            }
        }
Ejemplo n.º 10
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());
        }
Ejemplo n.º 11
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();
            }));
        }
Ejemplo n.º 12
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
            });
        }