Beispiel #1
0
        public string Serialize()
        {
            StringBuilder builder = new StringBuilder();

            AddVar(builder, " Error", Error.ToString(), true);
            AddVar(builder, " ErrorString", ErrorString);
            AddVar(builder, " LTouchVersion", ((int)LTouchVersion).ToString());
            if (XEXCRC != null)
            {
                AddVar(builder, " XEXCRC", ((int)XEXCRC.Status).ToString() + "|" + XEXCRC.Crc.ToString("X8"));
            }
            if (VideoCRC != null)
            {
                AddVar(builder, " VideoCRC", ((int)VideoCRC.Status).ToString() + "|" + VideoCRC.Crc.ToString("X8"));
            }
            if (V0CRC != null)
            {
                AddVar(builder, " V0CRC", ((int)V0CRC.Status).ToString() + "|" + V0CRC.Crc.ToString("X8"));
            }
            if (V1CRC != null)
            {
                AddVar(builder, " V1CRC", ((int)V1CRC.Status).ToString() + "|" + V1CRC.Crc.ToString("X8"));
            }
            if (PFICRC != null)
            {
                AddVar(builder, " PFICRC", ((int)PFICRC.Status).ToString() + "|" + PFICRC.Crc.ToString("X8"));
            }
            if (DMICRC != null)
            {
                AddVar(builder, " DMICRC", ((int)DMICRC.Status).ToString() + "|" + DMICRC.Crc.ToString("X8"));
            }
            if (SSCRC != null)
            {
                AddVar(builder, " SSCRC", ((int)SSCRC.Status).ToString() + "|" + SSCRC.Crc.ToString("X8"));
            }
            if (GameCRC != null)
            {
                AddVar(builder, " GameCRC", ((int)GameCRC.Status).ToString() + "|" + GameCRC.Crc.ToString("X8"));
            }
            AddVar(builder, " RAWSS", RAWSS.ToString("X8"));
            AddVar(builder, " RegionCode", RegionCode.ToString("X8"));
            AddVar(builder, " MediaId", MediaId);
            AddVar(builder, " AnyDVDCorruption", AnyDVDCorruption.ToString());
            AddVar(builder, " MinKernel", MinKernel);
            AddVar(builder, " LastCheck", LastCheck.ToString());
            AddVar(builder, " Wave", Wave);
            AddVar(builder, " Size", Size.ToString());
            return(builder.ToString());
        }
        public ConsistencyMonitor(MonitorSettings monitorSettings,
                                  IConsistencyService consistencyService,
                                  IMtSlackNotificationsSender slackNotificationsSender,
                                  ICheckResultRepository checkResultRepository,
                                  IBalanceAndTransactionAmountRepository balanceAndTransactionAmountRepository,
                                  IBalanceAndOrderClosedRepository balanceAndOrderClosedRepository,
                                  IOrdersReportAndOrderClosedOpenedRepository ordersReportAndOrderClosedOpenedRepository,
                                  IPriceCandlesConsistencyRepository priceCandlesConsistencyRepository,
                                  IMarginEventsAccountStatusRepository marginEventsAccountStatusRepository,
                                  IHedgingServiceRepository hedgingServiceRepository,
                                  IAlertSeverityLevelService alertSeverityLevelService,
                                  ILog log)
        {
            _log                   = log;
            _monitorSettings       = monitorSettings;
            _consistencyService    = consistencyService;
            MonitorInterval        = _monitorSettings.ConsistencyCheckInterval;
            _checkResultRepository = checkResultRepository;
            _balanceAndTransactionAmountRepository      = balanceAndTransactionAmountRepository;
            _balanceAndOrderClosedRepository            = balanceAndOrderClosedRepository;
            _ordersReportAndOrderClosedOpenedRepository = ordersReportAndOrderClosedOpenedRepository;
            _priceCandlesConsistencyRepository          = priceCandlesConsistencyRepository;
            _marginEventsAccountStatusRepository        = marginEventsAccountStatusRepository;
            _hedgingServiceRepository  = hedgingServiceRepository;
            _alertSeverityLevelService = alertSeverityLevelService;
            _slackNotificationsSender  = slackNotificationsSender;

            var lastCheckResult = Task.Run(async() => await _checkResultRepository.GetLastAsync()).Result;

            if (lastCheckResult == null)
            {
                LastCheck = null;
            }
            else
            {
                LastCheck = lastCheckResult.DateTo;
            }

            _log.WriteInfo(nameof(ConsistencyMonitor), null, $"Consistency Monitor Started. LastCheck:[{LastCheck?.ToString("u")}]");
        }