Ejemplo n.º 1
0
 public AlertHandler(AlertHandlerConfiguration alertHandlerConfiguration)
 {
     _memoryStream            = new MemoryStream();
     _binaryReader            = new CKBinaryReader(_memoryStream, Encoding.UTF8, true);
     _alertAlertSenderManager = new AlertSenderManager();
     _alertTableMock          = new AlertTableMock(alertHandlerConfiguration.DatabasePath);
     InitializeAlerts(alertHandlerConfiguration);
 }
Ejemplo n.º 2
0
        public AlertService(IOptions <TcpControlChannelConfiguration> tcpConfiguration, IOptions <DatabaseConfiguration> databaseConfiguration)
        {
            _tcpConfiguration         = tcpConfiguration.Value;
            _tcpConfiguration.AppName = typeof(AlertService).Assembly.GetName().Name;
            _tcpConfiguration.PresentEnvironmentVariables          = true;
            _tcpConfiguration.PresentMonitoringAssemblyInformation = true;
            _tcpConfiguration.HandleSystemActivityMonitorErrors    = false;

            _controlChannelClient = new ControlChannelClient(
                _tcpConfiguration.Host,
                _tcpConfiguration.Port,
                _tcpConfiguration.BuildAuthData(),
                _tcpConfiguration.IsSecure
                );

            _controlChannelClient.OpenAsync().GetAwaiter().GetResult();

            _memoryStream = new MemoryStream();
            _formatter    = new BinaryFormatter();

            _databaseConfiguration = databaseConfiguration.Value;
            _alertTableMock        = new AlertTableMock(_databaseConfiguration.Path.GetPathWithSpecialFolders());
        }