예제 #1
0
        public frmMain()
        {
            InitializeComponent();

            DateTime dt = DateTime.Now;

            barStaticRunTime.Caption = dt.ToLongDateString() + " " + dt.ToLongTimeString();

            EventPublisher.ShowBookmarkEvent += EventPublisher_ShowBookmarkEvent;
            EventPublisher.WarnDataEvent     += new EventHandler <TSDataEventArgs>(EventPublisher_WarnDataEvent);

            InitialTray();               // 托盘图标
            ShowMainCtrl();              // 显示地球界面
            //SQLiteHelper.CreateDB();     // 检查、创建数据库
            GXStroreClient storeClient = new GXStroreClient();

            warnInfoFrm         = new frmWarnInfo(MainCtrl.GlobeMapContainer.globeCtrl.globeBusiness, MainCtrl.GlobeMapContainer.gmapCtrl.mapBusiness);
            warnInfoFrm.Visible = false;

            _BookmarkManager = new BookmarkManager(MainCtrl.GlobeMapContainer.globeCtrl.axGlobeControl1);

            barButtonItem16.ItemClick += BarButtonItem16_ItemClick;
            barButtonItem17.ItemClick += BarButtonItem16_ItemClick;
            barButtonItem18.ItemClick += BarButtonItem16_ItemClick;
            barButtonItem48.ItemClick += BarButtonItem16_ItemClick;
            barButtonItem49.ItemClick += BarButtonItem16_ItemClick;
            barButtonItem50.ItemClick += BarButtonItem16_ItemClick;

            EventPublisher.ChangedToHistoryEvent += new EventHandler <EventArgs>(EventPublisher_ChangedToHistoryEvent);
        }
        public WindowsEventPollingSource(string id, string logName, string query, IBookmarkManager bookmarkManager,
                                         WindowsEventLogPollingSourceOptions options, IPlugInContext context)
            : base(id, logName, query, bookmarkManager, context)
        {
            _options = options;

            InitialPosition          = options.InitialPosition;
            InitialPositionTimestamp = options.InitialPositionTimestamp;
        }
        public void InitializeTest()
        {
            this.bookmark1 = TestHelper.CreateMockBookmark("1");
            this.bookmark2 = TestHelper.CreateMockBookmark("2");
            this.bookmark3 = TestHelper.CreateMockBookmark("3");
            this.bookmark4 = TestHelper.CreateMockBookmark("4");

            this.mockDocument = TestHelper.CreateMockDocument(this.bookmark1, this.bookmark2, this.bookmark3);
            this.sut          = new BookmarkManager(this.mockDocument.Object);
        }
 protected WindowsEventLogSourceBase(string id, string logName, string query,
                                     IBookmarkManager bookmarkManager, IPlugInContext context) : base(new EventLogDependency(logName), context)
 {
     Guard.ArgumentNotNull(id, nameof(id));
     Guard.ArgumentNotNull(logName, nameof(logName));
     Id               = id;
     _logName         = logName;
     _query           = query;
     _bookmarkManager = bookmarkManager;
 }
        public EventLogSource(string id, string logName, string query, IBookmarkManager bookmarkManager, WindowsEventLogSourceOptions options, IPlugInContext context)
            : base(id, logName, query, bookmarkManager, context)
        {
            Id       = id;
            _options = options;

            _eventLogQuery = string.IsNullOrWhiteSpace(query)
                ? new EventLogQuery(_logName, PathType.LogName)
                : new EventLogQuery(_logName, PathType.LogName, _query);

            InitialPosition          = options.InitialPosition;
            InitialPositionTimestamp = options.InitialPositionTimestamp;
        }
예제 #6
0
        public AWSBufferedSink(string id, string sessionName,
                               IAppDataFileProvider appDataFileProvider,
                               ILogger logger,
                               IMetrics metrics,
                               IBookmarkManager bookmarkManager,
                               NetworkStatus networkStatus,
                               AWSBufferedSinkOptions options)
        {
            Id                        = id;
            _logger                   = logger;
            _metrics                  = metrics;
            _bookmarkManager          = bookmarkManager;
            _networkStatus            = networkStatus;
            _bufferIntervalMs         = options.BufferIntervalMs;
            _format                   = options.Format;
            _maxSecondaryQueueBatches = options.QueueMaxBatches;
            var secondaryQueue = CreateSecondaryQueue(options, sessionName, appDataFileProvider, logger);

            _queue = new AsyncBatchQueue <Envelope <T> >(options.QueueSizeItems,
                                                         new long[] { options.MaxBatchSize, options.MaxBatchBytes },
                                                         new Func <Envelope <T>, long>[] { r => 1, GetRecordSize },
                                                         secondaryQueue);

            _maxAttempts             = options.MaxAttempts;
            _jittingFactor           = options.JittingFactor;
            _backoffFactor           = options.BackoffFactor;
            _recoveryFactor          = options.RecoveryFactor;
            _minRateAdjustmentFactor = options.MinRateAdjustmentFactor;
            _uploadNetworkPriority   = options.UploadNetworkPriority;

            if (options.TextDecoration is not null)
            {
                _textDecorationEvaluator = new TextDecorationEvaluator(options.TextDecoration, ResolveRecordVariables);
            }

            if (options.TextDecorationEx is not null)
            {
                _textDecorationEvaluator = new TextDecorationExEvaluator(options.TextDecorationEx, EvaluateVariable, ResolveRecordVariable, logger);
            }

            if (options.ObjectDecoration is not null)
            {
                _objectDecorationEvaluator = new ObjectDecorationEvaluator(options.ObjectDecoration, ResolveRecordVariables);
            }

            if (options.ObjectDecorationEx is not null)
            {
                _objectDecorationEvaluator = new ObjectDecorationExEvaluator(options.ObjectDecorationEx, EvaluateVariable, ResolveRecordVariable, logger);
            }
        }
예제 #7
0
        public EventLogTest(ITestOutputHelper output)
        {
            _output    = output;
            _logSource = Guid.NewGuid().ToString();
            var mockBookmarkManager = new Mock <IBookmarkManager>();

            _bookmarkManager = mockBookmarkManager.Object;

            if (EventLog.SourceExists(_logSource))
            {
                EventLog.DeleteEventSource(_logSource);
            }
            EventLog.CreateEventSource(_logSource, LogName);
        }
 public PluginContext(
     IConfiguration config,
     ILogger logger,
     IMetrics metrics,
     IBookmarkManager bookmarkManager,
     IDictionary <string, ICredentialProvider> credentialProviders,
     IParameterStore parameterStore)
 {
     Configuration        = config;
     Logger               = logger;
     Metrics              = metrics;
     BookmarkManager      = bookmarkManager;
     _credentialProviders = credentialProviders;
     ParameterStore       = parameterStore;
 }
예제 #9
0
 public AsyncCloudWatchLogsSink(string id, string sessionName, string logGroup, string logStream,
                                IAmazonCloudWatchLogs cloudWatchLogsClient,
                                IAppDataFileProvider appDataFileProvider,
                                ILogger logger,
                                IMetrics metrics,
                                IBookmarkManager bookmarkManager,
                                NetworkStatus networkStatus,
                                AWSBufferedSinkOptions options)
     : base(id, sessionName, appDataFileProvider, logger, metrics, bookmarkManager, networkStatus, options)
 {
     Id                    = id;
     _logGroup             = logGroup;
     _logStream            = logStream;
     _cloudWatchLogsClient = cloudWatchLogsClient;
     // Set throttle at 5 requests per second
     _throttle = new AdaptiveThrottle(new TokenBucket(1, 5), _backoffFactor, _recoveryFactor, _minRateAdjustmentFactor);
 }
        public ApplicationMain()
        {
            InitializeComponent();
            stationFeedService = CastleWindsorFrameworkHelper.New<IStationFeedService>();
            StationConnectionChecker stationConnectionChecker = new StationConnectionChecker(stationFeedService, CastleWindsorFrameworkHelper.New<IConfigurationService>());
            bookmarkManager = CastleWindsorFrameworkHelper.New<IBookmarkManager>();

            bookmarksListView.ItemsSource =
                new ReadOnlySynchronizedObservableCollection<Station>(bookmarkManager.GetBookmarkedStations());

            try
            {
                genreComboBox.ItemsSource = stationFeedService.GetGenreList();
            }
            catch (Exception)
            {
                OfflineMessageBox();
            }
        }
예제 #11
0
        public Session(
            string name,
            IConfiguration config,
            IMetrics metrics,
            IServiceProvider services,
            bool validated)
        {
            Name        = name;
            StartTime   = DateTime.Now;
            IsValidated = validated;

            if (IsDefault && validated)
            {
                throw new ArgumentException("The default session cannot be validated");
            }

            _config         = config;
            _metrics        = metrics;
            _services       = services;
            _loggerFactory  = services.GetService <ILoggerFactory>();
            _parameterStore = services.GetService <IParameterStore>();
            _networkStatus  = new NetworkStatus(services.GetService <INetworkStatusProvider>());
            _logger         = _loggerFactory.CreateLogger(DisplayName);
            _logger.LogDebug("Configuration is validated: {0}", IsValidated);
            _bookmarkManager = new FileBookmarkManager(Utility.GetBookmarkDirectory(name),
                                                       _loggerFactory.CreateLogger($"{DisplayName}:{nameof(IBookmarkManager)}"),
                                                       services.GetService <IAppDataFileProvider>());

            var factoryCatalogs = services.GetService <FactoryCatalogs>();

            _sourceFactoryCatalog             = factoryCatalogs.SourceFactoryCatalog;
            _sinkFactoryCatalog               = factoryCatalogs.SinkFactoryCatalog;
            _credentialProviderFactoryCatalog = factoryCatalogs.CredentialProviderFactoryCatalog;
            _genericPluginFactoryCatalog      = factoryCatalogs.GenericPluginFactoryCatalog;
            _pipeFactoryCatalog               = factoryCatalogs.PipeFactoryCatalog;
            _recordParserCatalog              = factoryCatalogs.RecordParserCatalog;
        }
 public ThrottledListEventSink(ILogger logger, IBookmarkManager bookmarkManager)
 {
     _logger          = logger;
     _bookmarkManager = bookmarkManager;
 }
 public ThrottledListEventSink(IBookmarkManager bookmarkManager) : this(NullLogger.Instance, bookmarkManager)
 {
 }
예제 #14
0
 public BookmarksController(IBookmarkManager bookmarkManager) => _bookmarkManager = bookmarkManager;