コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RollController" /> class.
        /// </summary>
        /// <param name="provider">The CharacterProvider.</param>
        public RollController(ICharacterProvider provider, IStatisticProvider statProvider, IRollStrategy strategy)
        {
            _provider     = provider;
            _statProvider = statProvider;

            _strategy = strategy;
        }
コード例 #2
0
        public SynchronizationViewModel(IStatisticProvider frametimeStatisticProvider,
                                        IEventAggregator eventAggregator,
                                        IAppConfiguration appConfiguration)
        {
            _frametimeStatisticProvider = frametimeStatisticProvider;
            _eventAggregator            = eventAggregator;
            _appConfiguration           = appConfiguration;

            CopyUntilDisplayedTimesValuesCommand    = new DelegateCommand(OnCopyUntilDisplayedTimesValues);
            CopyDisplayTimesHistogramDataCommand    = new DelegateCommand(CopDisplayTimesHistogramData);
            CopyInputLagHistogramDataCommand        = new DelegateCommand(CopyInputLagHistogramData);
            CopyInputLagStatisticalParameterCommand = new DelegateCommand(CopyInputLagStatisticalParameter);

            InputLagParameterFormatter = value => value.ToString(string.Format("F{0}",
                                                                               _appConfiguration.FpsValuesRoundingDigits), CultureInfo.InvariantCulture);

            _syncRangeLower = _appConfiguration.SyncRangeLower;
            _syncRangeUpper = _appConfiguration.SyncRangeUpper;

            SubscribeToUpdateSession();

            SynchronizationModel = new PlotModel
            {
                PlotMargins         = new OxyThickness(40, 10, 0, 40),
                PlotAreaBorderColor = OxyColor.FromArgb(64, 204, 204, 204),
            };

            InputLagModel = new PlotModel
            {
                PlotMargins         = new OxyThickness(40, 10, 0, 40),
                PlotAreaBorderColor = OxyColor.FromArgb(64, 204, 204, 204),
            };
        }
コード例 #3
0
ファイル: ReportViewModel.cs プロジェクト: Phelagor/CapFrameX
        public ReportViewModel(IStatisticProvider frametimeStatisticProvider,
                               IEventAggregator eventAggregator,
                               IAppConfiguration appConfiguration,
                               RecordManager recordManager,
                               ILogger <ReportViewModel> logger)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            _frametimeStatisticProvider = frametimeStatisticProvider;
            _eventAggregator            = eventAggregator;
            _appConfiguration           = appConfiguration;
            _recordManager = recordManager;
            _logger        = logger;

            CopyTableDataCommand                    = new DelegateCommand(OnCopyTableData);
            RemoveAllReportEntriesCommand           = new DelegateCommand(() => ReportInfoCollection.Clear());
            ReportInfoCollection.CollectionChanged += new NotifyCollectionChangedEventHandler
                                                          ((sender, eventArg) => HasNoReportItems = !ReportInfoCollection.Any());

            SubscribeToSelectRecord();

            stopwatch.Stop();
            _logger.LogInformation(this.GetType().Name + " {initializationTime}s initialization time",
                                   Math.Round(stopwatch.ElapsedMilliseconds * 1E-03, 1));
        }
コード例 #4
0
        public DataViewModel(IStatisticProvider frametimeStatisticProvider,
                             IFrametimeAnalyzer frametimeAnalyzer,
                             IEventAggregator eventAggregator,
                             IAppConfiguration appConfiguration)
        {
            _frametimeStatisticProvider = frametimeStatisticProvider;
            _frametimeAnalyzer          = frametimeAnalyzer;
            _eventAggregator            = eventAggregator;
            _appConfiguration           = appConfiguration;

            SubscribeToUpdateSession();

            CopyStatisticalParameterCommand = new DelegateCommand(OnCopyStatisticalParameter);
            CopyLShapeQuantilesCommand      = new DelegateCommand(OnCopyQuantiles);
            CopySystemInfoCommand           = new DelegateCommand(OnCopySystemInfoCommand);
            AcceptParameterSettingsCommand  = new DelegateCommand(OnAcceptParameterSettings);

            ParameterFormatter = value => value.ToString(string.Format("F{0}",
                                                                       _appConfiguration.FpsValuesRoundingDigits), CultureInfo.InvariantCulture);
            _localRecordDataServer    = new LocalRecordDataServer();
            FrametimeGraphDataContext = new FrametimeGraphDataContext(_localRecordDataServer,
                                                                      _appConfiguration, _frametimeStatisticProvider);
            FpsGraphDataContext = new FpsGraphDataContext(_localRecordDataServer,
                                                          _appConfiguration, _frametimeStatisticProvider);

            MessageDialogContent = new ContitionalMessageDialog();

            InitializeStatisticParameter();
        }
コード例 #5
0
        public ComparisonViewModel(IStatisticProvider frametimeStatisticProvider,
                                   IFrametimeAnalyzer frametimeAnalyzer,
                                   IEventAggregator eventAggregator,
                                   IAppConfiguration appConfiguration, RecordManager recordManager)
        {
            _frametimeStatisticProvider = frametimeStatisticProvider;
            _frametimeAnalyzer          = frametimeAnalyzer;
            _eventAggregator            = eventAggregator;
            _appConfiguration           = appConfiguration;
            _recordManager = recordManager;
            RemoveAllComparisonsCommand = new DelegateCommand(OnRemoveAllComparisons);
            ComparisonLShapeCollection  = new SeriesCollection();
            MessageDialogContent        = new MessageDialog();

            ComparisonColumnChartFormatter = value => value.ToString(string.Format("F{0}",
                                                                                   _appConfiguration.FpsValuesRoundingDigits), CultureInfo.InvariantCulture);
            SelectedComparisonContext       = _appConfiguration.ComparisonContext.ConvertToEnum <EComparisonContext>();
            SelectedSecondComparisonContext = _appConfiguration.SecondComparisonContext.ConvertToEnum <EComparisonContext>();
            SelectedSecondMetric            = _appConfiguration.SecondMetric.ConvertToEnum <EMetric>();
            SelectedThirdMetric             = _appConfiguration.ThirdMetric.ConvertToEnum <EMetric>();

            SetRowSeries();
            SubscribeToSelectRecord();
            SubscribeToUpdateRecordInfos();
        }
コード例 #6
0
        public OverlayService(IStatisticProvider statisticProvider,
                              IRecordDataProvider recordDataProvider,
                              IOverlayEntryProvider overlayEntryProvider,
                              IAppConfiguration appConfiguration,
                              ILogger <OverlayService> logger)
            : base(ExceptionAction)
        {
            _statisticProvider    = statisticProvider;
            _recordDataProvider   = recordDataProvider;
            _overlayEntryProvider = overlayEntryProvider;
            _appConfiguration     = appConfiguration;
            _logger = logger;

            _refreshPeriod          = _appConfiguration.OSDRefreshPeriod;
            _numberOfRuns           = _appConfiguration.SelectedHistoryRuns;
            SecondMetric            = _appConfiguration.SecondMetricOverlay;
            ThirdMetric             = _appConfiguration.ThirdMetricOverlay;
            IsOverlayActiveStream   = new Subject <bool>();
            _runHistoryOutlierFlags = Enumerable.Repeat(false, _numberOfRuns).ToArray();

            _logger.LogDebug("{componentName} Ready", this.GetType().Name);
            SetOverlayEntries(overlayEntryProvider?.GetOverlayEntries());
            overlayEntryProvider.EntryUpdateStream.Subscribe(x =>
            {
                SetOverlayEntries(overlayEntryProvider?.GetOverlayEntries());
            });

            _runHistory = Enumerable.Repeat("N/A", _numberOfRuns).ToList();
            SetRunHistory(_runHistory.ToArray());
            SetRunHistoryAggregation(string.Empty);
            SetRunHistoryOutlierFlags(_runHistoryOutlierFlags);
            SetIsCaptureTimerActive(false);
        }
コード例 #7
0
 public GraphDataContextBase(IAppConfiguration appConfiguration,
                             IRecordDataServer recordDataServer, IStatisticProvider frametimesStatisticProvider)
 {
     AppConfiguration             = appConfiguration;
     RecordDataServer             = recordDataServer;
     FrrametimesStatisticProvider = frametimesStatisticProvider;
 }
コード例 #8
0
        public ComparisonDataViewModel(IStatisticProvider frametimeStatisticProvider,
                                       IFrametimeAnalyzer frametimeAnalyzer,
                                       IEventAggregator eventAggregator,
                                       IAppConfiguration appConfiguration)
        {
            _frametimeStatisticProvider = frametimeStatisticProvider;
            _frametimeAnalyzer          = frametimeAnalyzer;
            _eventAggregator            = eventAggregator;
            _appConfiguration           = appConfiguration;

            DateTimeContextCommand      = new DelegateCommand(OnDateTimeContext);
            CpuContextCommand           = new DelegateCommand(OnCpuContext);
            GpuContextCommand           = new DelegateCommand(OnGpuContex);
            CustomContextCommand        = new DelegateCommand(OnCustomContex);
            RemoveAllComparisonsCommand = new DelegateCommand(OnRemoveAllComparisons);
            AbsoluteModeCommand         = new DelegateCommand(OnAbsoluteMode);
            RelativeModeCommand         = new DelegateCommand(OnRelativeMode);

            ComparisonColumnChartFormatter = value => value.ToString(string.Format("F{0}",
                                                                                   _appConfiguration.FpsValuesRoundingDigits), CultureInfo.InvariantCulture);
            ComparisonLShapeCollection            = new SeriesCollection();
            ComparisonColumnChartSeriesCollection = new SeriesCollection
            {
                // Add ColumnSeries per parameter
                // Average
                new ColumnSeries
                {
                    Title  = "Average",
                    Values = new ChartValues <double>(),
                    // Kind of blue
                    Fill       = _comparisonBrushes[1],
                    DataLabels = true
                },

                //1% quantile
                new ColumnSeries
                {
                    Title  = "P1",
                    Values = new ChartValues <double>(),
                    // Kind of red
                    Fill       = _comparisonBrushes[2],
                    DataLabels = true
                },

                //0.1% quantile
                new LiveCharts.Wpf.ColumnSeries
                {
                    Title  = "P0.1",
                    Values = new ChartValues <double>(),
                    // Kind of dark red
                    Fill       = _comparisonBrushes[3],
                    DataLabels = true
                }
            };

            InitializePlotModel();
            SubscribeToSelectRecord();
        }
コード例 #9
0
 public StatsController(
     IRepositoryWrapper repository,
     IStatisticProvider statisticProvider,
     ILogger <StatsController> logger)
 {
     _repository        = repository;
     _statisticProvider = statisticProvider;
     _logger            = logger;
 }
コード例 #10
0
ファイル: EffectController.cs プロジェクト: MickMelon/FRAGS
 public EffectController(ICharacterProvider charProvider,
                         IEffectProvider effectProvider,
                         IStatisticProvider statProvider,
                         GeneralOptions options)
 {
     _charProvider   = charProvider;
     _effectProvider = effectProvider;
     _statProvider   = statProvider;
     _options        = options;
 }
コード例 #11
0
        public GraphDataContextBase(IAppConfiguration appConfiguration,
                                    IRecordDataServer recordDataServer,
                                    IStatisticProvider frametimesStatisticProvider,
                                    IEventAggregator eventAggregator)
        {
            AppConfiguration             = appConfiguration;
            RecordDataServer             = recordDataServer;
            _frametimesStatisticProvider = frametimesStatisticProvider;
            _eventAggregator             = eventAggregator;

            SubscribeToAggregatorEvents();
        }
コード例 #12
0
        public Workspace(OJContext context, WorkspaceStartup startup)
        {
            _context            = context;
            FileStoreRoot       = startup.FileStoreRoot;
            TestCaseStoreRoot   = Path.Join(FileStoreRoot, PD_Tests);
            SubmissionStoreRoot = Path.Join(FileStoreRoot, PD_Submissions);

            Problems    = new ProblemListProvider(this, _context);
            Submissions = new SubmissionListProvider(this, _context);
            Users       = new UserListProvider(this, _context);
            Roles       = new RoleListProvider(this, _context);
            Statistics  = new StatisticProvider(this, _context);
        }
コード例 #13
0
        public ReportViewModel(IStatisticProvider frametimeStatisticProvider,
                               IEventAggregator eventAggregator,
                               IAppConfiguration appConfiguration, RecordManager recordManager)
        {
            _frametimeStatisticProvider = frametimeStatisticProvider;
            _eventAggregator            = eventAggregator;
            _appConfiguration           = appConfiguration;
            _recordManager       = recordManager;
            CopyTableDataCommand = new DelegateCommand(OnCopyTableData);
            ReportInfoCollection.CollectionChanged += new NotifyCollectionChangedEventHandler
                                                          ((sender, eventArg) => HasNoReportItems = !ReportInfoCollection.Any());

            SubscribeToSelectRecord();
        }
コード例 #14
0
        public OverlayService(IStatisticProvider statisticProvider,
                              ISensorService sensorService,
                              IOverlayEntryProvider overlayEntryProvider,
                              IAppConfiguration appConfiguration,
                              ILogger <OverlayService> logger,
                              IRecordManager recordManager,
                              IRTSSService rTSSService)
        {
            _statisticProvider    = statisticProvider;
            _overlayEntryProvider = overlayEntryProvider;
            _appConfiguration     = appConfiguration;
            _logger                 = logger;
            _recordManager          = recordManager;
            _rTSSService            = rTSSService;
            _numberOfRuns           = _appConfiguration.SelectedHistoryRuns;
            SecondMetric            = _appConfiguration.SecondMetricOverlay;
            ThirdMetric             = _appConfiguration.ThirdMetricOverlay;
            IsOverlayActiveStream   = new BehaviorSubject <bool>(_appConfiguration.IsOverlayActive);
            _runHistoryOutlierFlags = Enumerable.Repeat(false, _numberOfRuns).ToArray();

            _logger.LogDebug("{componentName} Ready", this.GetType().Name);

            IsOverlayActiveStream.AsObservable()
            .Select(isActive =>
            {
                if (isActive)
                {
                    _rTSSService.ResetOSD();
                    return(sensorService.OnDictionaryUpdated
                           .SelectMany(_ => _overlayEntryProvider.GetOverlayEntries()));
                }
                else
                {
                    _rTSSService.ReleaseOSD();
                    return(Observable.Empty <IOverlayEntry[]>());
                }
            }).Switch()
            .Subscribe(entries =>
            {
                _rTSSService.SetOverlayEntries(entries);
                _rTSSService.CheckRTSSRunningAndRefresh();
            });

            _runHistory = Enumerable.Repeat("N/A", _numberOfRuns).ToList();
            _rTSSService.SetRunHistory(_runHistory.ToArray());
            _rTSSService.SetRunHistoryAggregation(string.Empty);
            _rTSSService.SetRunHistoryOutlierFlags(_runHistoryOutlierFlags);
            _rTSSService.SetIsCaptureTimerActive(false);
        }
コード例 #15
0
        public FpsGraphDataContext(IRecordDataServer recordDataServer,
                                   IAppConfiguration appConfiguration, IStatisticProvider frametimesStatisticProvider) :
            base(recordDataServer, appConfiguration, frametimesStatisticProvider)
        {
            CopyFpsValuesCommand = new DelegateCommand(OnCopyFpsValues);
            CopyFpsPointsCommand = new DelegateCommand(OnCopyFpsPoints);

            // Update Chart after changing index slider
            RecordDataServer.FpsPointDataStream.Subscribe(sequence =>
            {
                SetFpsChart(sequence);
            });

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

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

            //Y
            FpsModel.Axes.Add(new LinearAxis()
            {
                Key                    = "yAxis",
                Position               = AxisPosition.Left,
                Title                  = "FPS [1/s]",
                MajorGridlineStyle     = LineStyle.Solid,
                MajorGridlineThickness = 1,
                MajorGridlineColor     = OxyColor.FromArgb(64, 204, 204, 204),
                MinorTickSize          = 0,
                MajorTickSize          = 0
            });
        }
コード例 #16
0
        public OnlineMetricService(IStatisticProvider frametimeStatisticProvider,
                                   ICaptureService captureServive,
                                   IEventAggregator eventAggregator,
                                   IOverlayEntryCore oerlayEntryCore,
                                   ILogger <OnlineMetricService> logger)
        {
            _captureService   = captureServive;
            _eventAggregator  = eventAggregator;
            _overlayEntryCore = oerlayEntryCore;
            _logger           = logger;

            _frametimeStatisticProvider = frametimeStatisticProvider;

            SubscribeToUpdateSession();
            ConnectOnlineMetricDataStream();
        }
コード例 #17
0
        public AggregationViewModel(IStatisticProvider statisticProvider,
                                    IEventAggregator eventAggregator, IAppConfiguration appConfiguration, IRecordManager recordManager)
        {
            _statisticProvider      = statisticProvider;
            _eventAggregator        = eventAggregator;
            _appConfiguration       = appConfiguration;
            _recordManager          = recordManager;
            ClearTableCommand       = new DelegateCommand(OnClearTable);
            AggregateIncludeCommand = new DelegateCommand(OnAggregateInclude);
            AggregateExcludeCommand = new DelegateCommand(OnAggregateExclude);

            SubscribeToUpdateSession();

            AggregationEntries.CollectionChanged += new NotifyCollectionChangedEventHandler
                                                        ((sender, eventArg) => OnAggregationEntriesChanged());
        }
コード例 #18
0
ファイル: CloudViewModel.cs プロジェクト: sherief/CapFrameX
        public CloudViewModel(IStatisticProvider statisticProvider, IRecordManager recordManager,
                              IEventAggregator eventAggregator, IAppConfiguration appConfiguration, ILogger <CloudViewModel> logger, IAppVersionProvider appVersionProvider, LoginManager loginManager)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            _statisticProvider  = statisticProvider;
            _recordManager      = recordManager;
            _eventAggregator    = eventAggregator;
            _appConfiguration   = appConfiguration;
            _logger             = logger;
            _appVersionProvider = appVersionProvider;
            _loginManager       = loginManager;
            ClearTableCommand   = new DelegateCommand(OnClearTable);
            CopyURLCommand      = new DelegateCommand(() => Clipboard.SetText(_shareUrl));
            SwitchToDownloadDirectoryCommand = new DelegateCommand(OnSwitchToDownloadDirectory);
            _cloudFolderChanged  = eventAggregator.GetEvent <PubSubEvent <AppMessages.CloudFolderChanged> >();
            _selectCloudFolder   = eventAggregator.GetEvent <PubSubEvent <AppMessages.SelectCloudFolder> >();
            UploadRecordsCommand = new DelegateCommand(async() =>
            {
                await UploadRecords();
                OnClearTable();
            });

            DownloadRecordsCommand = new DelegateCommand(async() =>
            {
                await DownloadCaptureCollection(DownloadIDString);
            });


            SubscribeToUpdateSession();

            CloudEntries.CollectionChanged += new NotifyCollectionChangedEventHandler
                                                  ((sender, eventArg) => OnCloudEntriesChanged());

            IsLoggedIn = loginManager.State.Token != null;

            _eventAggregator.GetEvent <PubSubEvent <AppMessages.LoginState> >().Subscribe(state =>
            {
                IsLoggedIn = state.IsLoggedIn;
                RaisePropertyChanged(nameof(IsLoggedIn));
            });

            stopwatch.Stop();
            _logger.LogInformation(this.GetType().Name + " {initializationTime}s initialization time", Math.Round(stopwatch.ElapsedMilliseconds * 1E-03, 1));
        }
コード例 #19
0
        public SynchronizationViewModel(IStatisticProvider frametimeStatisticProvider,
                                        IEventAggregator eventAggregator,
                                        IAppConfiguration appConfiguration,
                                        ILogger <SynchronizationViewModel> logger)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            _frametimeStatisticProvider = frametimeStatisticProvider;
            _eventAggregator            = eventAggregator;
            _appConfiguration           = appConfiguration;
            _logger = logger;

            CopyUntilDisplayedTimesValuesCommand    = new DelegateCommand(OnCopyUntilDisplayedTimesValues);
            CopyDisplayTimesHistogramDataCommand    = new DelegateCommand(CopDisplayTimesHistogramData);
            CopyInputLagHistogramDataCommand        = new DelegateCommand(CopyInputLagHistogramData);
            CopyInputLagStatisticalParameterCommand = new DelegateCommand(CopyInputLagStatisticalParameter);
            SaveInputLagPlotAsSVG     = new DelegateCommand(() => OnSavePlotAsImage("inputlag", "svg"));
            SaveDisplayTimesPlotAsSVG = new DelegateCommand(() => OnSavePlotAsImage("displaytimes", "svg"));
            SaveInputLagPlotAsPNG     = new DelegateCommand(() => OnSavePlotAsImage("inputlag", "png"));
            SaveDisplayTimesPlotAsPNG = new DelegateCommand(() => OnSavePlotAsImage("displaytimes", "png"));

            InputLagParameterFormatter = value => value.ToString(string.Format("F{0}",
                                                                               _appConfiguration.FpsValuesRoundingDigits), CultureInfo.InvariantCulture);

            _syncRangeLower = _appConfiguration.SyncRangeLower;
            _syncRangeUpper = _appConfiguration.SyncRangeUpper;

            SubscribeToUpdateSession();

            SynchronizationModel = new PlotModel
            {
                PlotMargins         = new OxyThickness(40, 10, 0, 40),
                PlotAreaBorderColor = OxyColor.FromArgb(64, 204, 204, 204),
            };

            InputLagModel = new PlotModel
            {
                PlotMargins         = new OxyThickness(40, 10, 0, 40),
                PlotAreaBorderColor = OxyColor.FromArgb(64, 204, 204, 204),
            };

            stopwatch.Stop();
            _logger.LogInformation(this.GetType().Name + " {initializationTime}s initialization time", Math.Round(stopwatch.ElapsedMilliseconds * 1E-03, 1));
        }
コード例 #20
0
        public SynchronizationViewModel(IStatisticProvider frametimeStatisticProvider,
                                        IEventAggregator eventAggregator,
                                        IAppConfiguration appConfiguration)
        {
            _frametimeStatisticProvider = frametimeStatisticProvider;
            _eventAggregator            = eventAggregator;
            _appConfiguration           = appConfiguration;

            CopyDisplayChangeTimeValuesCommand = new DelegateCommand(OnCopyDisplayChangeTimeValues);
            CopyHistogramDataCommand           = new DelegateCommand(CopyHistogramData);

            _syncRangeLower = _appConfiguration.SyncRangeLower;
            _syncRangeUpper = _appConfiguration.SyncRangeUpper;

            SubscribeToUpdateSession();

            SynchronizationModel = new PlotModel
            {
                PlotMargins         = new OxyThickness(40, 10, 0, 40),
                PlotAreaBorderColor = OxyColor.FromArgb(64, 204, 204, 204),
            };
        }
コード例 #21
0
        public CloudViewModel(IStatisticProvider statisticProvider, IRecordManager recordManager,
                              IEventAggregator eventAggregator, IAppConfiguration appConfiguration, ILogger <CloudViewModel> logger, IAppVersionProvider appVersionProvider, LoginManager loginManager)
        {
            _statisticProvider   = statisticProvider;
            _recordManager       = recordManager;
            _eventAggregator     = eventAggregator;
            _appConfiguration    = appConfiguration;
            _logger              = logger;
            _appVersionProvider  = appVersionProvider;
            _loginManager        = loginManager;
            ClearTableCommand    = new DelegateCommand(OnClearTable);
            CopyURLCommand       = new DelegateCommand(() => Clipboard.SetText(_shareUrl));
            _cloudFolderChanged  = eventAggregator.GetEvent <PubSubEvent <AppMessages.CloudFolderChanged> >();
            UploadRecordsCommand = new DelegateCommand(async() =>
            {
                await UploadRecords();
                OnClearTable();
            });

            DownloadRecordsCommand = new DelegateCommand(async() =>
            {
                await DownloadCaptureCollection(DownloadIDString);
            });


            SubscribeToUpdateSession();

            CloudEntries.CollectionChanged += new NotifyCollectionChangedEventHandler
                                                  ((sender, eventArg) => OnCloudEntriesChanged());

            IsLoggedIn = loginManager.State.Token != null;

            _eventAggregator.GetEvent <PubSubEvent <AppMessages.LoginState> >().Subscribe(state =>
            {
                IsLoggedIn = state.IsLoggedIn;
                RaisePropertyChanged(nameof(IsLoggedIn));
            });
        }
コード例 #22
0
ファイル: PlotBuilder.cs プロジェクト: Phelagor/CapFrameX
 public PlotBuilder(IFrametimeStatisticProviderOptions options, IStatisticProvider frametimeStatisticProvider)
 {
     _frametimeStatisticProviderOptions = options;
     _frametimesStatisticProvider       = frametimeStatisticProvider;
 }
コード例 #23
0
 public HomeService(IReadOnlyList <CrimesServiceClient> agents, PositionCalculator calculator, IStatisticProvider statisticProvider)
 {
     this.agents            = agents;
     this.calculator        = calculator;
     this.statisticProvider = statisticProvider;
 }
コード例 #24
0
ファイル: OverlayService.cs プロジェクト: sherief/CapFrameX
        public OverlayService(IStatisticProvider statisticProvider,
                              ISensorService sensorService,
                              IOverlayEntryProvider overlayEntryProvider,
                              IAppConfiguration appConfiguration,
                              ILogger <OverlayService> logger,
                              IRecordManager recordManager,
                              IRTSSService rTSSService,
                              IOverlayEntryCore overlayEntryCore)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            _statisticProvider    = statisticProvider;
            _overlayEntryProvider = overlayEntryProvider;
            _appConfiguration     = appConfiguration;
            _logger           = logger;
            _recordManager    = recordManager;
            _sensorService    = sensorService;
            _rTSSService      = rTSSService;
            _overlayEntryCore = overlayEntryCore;

            _numberOfRuns           = _appConfiguration.SelectedHistoryRuns;
            SecondMetric            = _appConfiguration.RunHistorySecondMetric;
            ThirdMetric             = _appConfiguration.RunHistoryThirdMetric;
            IsOverlayActiveStream   = new BehaviorSubject <bool>(_appConfiguration.IsOverlayActive);
            _runHistoryOutlierFlags = Enumerable.Repeat(false, _numberOfRuns).ToArray();

            _logger.LogDebug("{componentName} Ready", this.GetType().Name);

            Task.Run(async() => await InitializeOverlayEntryDict())
            .ContinueWith(t =>
            {
                IsOverlayActiveStream
                .AsObservable()
                .Select(isActive =>
                {
                    if (isActive)
                    {
                        _rTSSService.CheckRTSSRunning().Wait();
                        _rTSSService.OnOSDOn();
                        _rTSSService.ClearOSD();
                        return(_onDictionaryUpdated.
                               SelectMany(_ => _overlayEntryProvider.GetOverlayEntries()));
                    }
                    else
                    {
                        _rTSSService.ReleaseOSD();
                        return(Observable.Empty <IOverlayEntry[]>());
                    }
                })
                .Switch()
                .Subscribe(async entries =>
                {
                    _rTSSService.SetOverlayEntries(entries);
                    await _rTSSService.CheckRTSSRunningAndRefresh();
                });
            });



            _sensorService.SensorSnapshotStream
            .Sample(_sensorService.OsdUpdateStream.Select(timespan => Observable.Concat(Observable.Return(-1L), Observable.Interval(timespan))).Switch())
            .Where((_, idx) => idx == 0 || IsOverlayActive)
            .SubscribeOn(Scheduler.Default)
            .Subscribe(sensorData =>
            {
                UpdateOverlayEntries(sensorData.Item2);
                _onDictionaryUpdated.OnNext(_overlayEntryCore.OverlayEntryDict.Values.ToArray());
            });

            _runHistory = Enumerable.Repeat("N/A", _numberOfRuns).ToList();
            _rTSSService.SetRunHistory(_runHistory.ToArray());
            _rTSSService.SetRunHistoryAggregation(string.Empty);
            _rTSSService.SetRunHistoryOutlierFlags(_runHistoryOutlierFlags);
            _rTSSService.SetIsCaptureTimerActive(false);

            stopwatch.Stop();
            _logger.LogInformation(GetType().Name + " {initializationTime}s initialization time", Math.Round(stopwatch.ElapsedMilliseconds * 1E-03, 1));
        }
コード例 #25
0
        public OverlayService(IStatisticProvider statisticProvider,
                              ISensorService sensorService,
                              IOverlayEntryProvider overlayEntryProvider,
                              IAppConfiguration appConfiguration,
                              ILogger <OverlayService> logger,
                              IRecordManager recordManager,
                              IRTSSService rTSSService)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            _statisticProvider    = statisticProvider;
            _overlayEntryProvider = overlayEntryProvider;
            _appConfiguration     = appConfiguration;
            _logger                 = logger;
            _recordManager          = recordManager;
            _rTSSService            = rTSSService;
            _numberOfRuns           = _appConfiguration.SelectedHistoryRuns;
            SecondMetric            = _appConfiguration.SecondMetricOverlay;
            ThirdMetric             = _appConfiguration.ThirdMetricOverlay;
            IsOverlayActiveStream   = new BehaviorSubject <bool>(_appConfiguration.IsOverlayActive);
            _runHistoryOutlierFlags = Enumerable.Repeat(false, _numberOfRuns).ToArray();

            _logger.LogDebug("{componentName} Ready", this.GetType().Name);

            IsOverlayActiveStream.AsObservable()
            .Select(isActive =>
            {
                if (isActive)
                {
                    TryCloseRTSS();
                    _rTSSService.CheckRTSSRunning().Wait();
                    _rTSSService.ResetOSD();
                    return(sensorService.OnDictionaryUpdated
                           .SelectMany(_ => _overlayEntryProvider.GetOverlayEntries()));
                }
                else
                {
                    // OSD status logging
                    Task.Run(async() =>
                    {
                        var processId = await _rTSSService.ProcessIdStream.Take(1);
                        try
                        {
                            _logger.LogInformation("Is process {detectedProcess} detected: {isDetected}", processId, _rTSSService.IsProcessDetected(processId));
                        }
                        catch
                        {
                            _logger.LogError("Error while checking RTSS core process detection");
                        }

                        //try
                        //{
                        //    _logger.LogInformation("Is OS locked: {isLocked}", _rTSSService.IsOSDLocked());
                        //}
                        //catch
                        //{
                        //    _logger.LogError("Error while checking RTSS core OSD lock status");
                        //}
                    }).Wait();

                    _rTSSService.ReleaseOSD();
                    return(Observable.Empty <IOverlayEntry[]>());
                }
            }).Switch()
            .SubscribeOn(Scheduler.Default)
            .Subscribe(async entries =>
            {
                _rTSSService.SetOverlayEntries(entries);
                await _rTSSService.CheckRTSSRunningAndRefresh();
            });

            _runHistory = Enumerable.Repeat("N/A", _numberOfRuns).ToList();
            _rTSSService.SetRunHistory(_runHistory.ToArray());
            _rTSSService.SetRunHistoryAggregation(string.Empty);
            _rTSSService.SetRunHistoryOutlierFlags(_runHistoryOutlierFlags);
            _rTSSService.SetIsCaptureTimerActive(false);

            stopwatch.Stop();
            _logger.LogInformation(GetType().Name + " {initializationTime}s initialization time", Math.Round(stopwatch.ElapsedMilliseconds * 1E-03, 1));
        }
コード例 #26
0
ファイル: Session.cs プロジェクト: DJMajorRush/CapFrameX
 public Session()
 {
     _frametimeStatisticProvider = new FrametimeStatisticProvider(new CapFrameXConfiguration());
 }
コード例 #27
0
 public FrametimePlotBuilder(IFrametimeStatisticProviderOptions options, IStatisticProvider frametimeStatisticProvider) : base(options, frametimeStatisticProvider)
 {
 }
コード例 #28
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
            });
        }
コード例 #29
0
 public StatisticController(ICharacterProvider charProvider, IStatisticProvider statProvider, IProgressionStrategy strategy)
 {
     _charProvider = charProvider;
     _statProvider = statProvider;
     _strategy     = strategy;
 }
コード例 #30
0
 public GenericProgressionStrategy(IStatisticProvider statProvider, StatisticOptions statOptions)
 {
     _statProvider = statProvider;
     _statOptions  = statOptions;
 }