/// <summary> /// Initialises the parser. /// </summary> private void Initialise() { if (_StandingDataManager == null) { _StandingDataManager = Factory.Singleton.Resolve <IStandingDataManager>().Singleton; } }
/// <summary> /// See base docs. /// </summary> protected override void DoInitialise() { _AutoConfigDatabase = Factory.Singleton.Resolve <IAutoConfigBaseStationDatabase>().Singleton; _AutoConfigDatabase.Database.AircraftUpdated += BaseStationDatabase_AircraftUpdated; _AutoConfigDatabase.Database.FileNameChanged += BaseStationDatabase_FileNameChanged; _AircraftOnlineLookupManager = Factory.Singleton.Resolve <IAircraftOnlineLookupManager>().Singleton; _AircraftOnlineLookupManager.AircraftFetched += AircraftOnlineLookupManager_AircraftFetched; _PictureManager = Factory.Singleton.Resolve <IAircraftPictureManager>().Singleton; var autoConfigurationPictureFolderCache = Factory.Singleton.Resolve <IAutoConfigPictureFolderCache>().Singleton; _PictureFolderCache = autoConfigurationPictureFolderCache.DirectoryCache; autoConfigurationPictureFolderCache.CacheConfigurationChanged += AutoConfigPictureFolderCache_CacheConfigurationChanged; _StandingDataManager = Factory.Singleton.Resolve <IStandingDataManager>().Singleton; _StandingDataManager.LoadCompleted += StandingDataManager_LoadCompleted; if (_PictureLookupThread == null) { _PictureLookupThread = new BackgroundThreadQueue <LookupPictureDetail>("PictureLookup", BackgroundThreadQueueMechanism.ThreadPool); _PictureLookupThread.MaximumParallelThreads = 10; _PictureLookupThread.StartBackgroundThread(PictureLookupThread_ProcessLookup, PictureLookupThread_ProcessException); } base.DoInitialise(); }
/// <summary> /// See base docs. /// </summary> protected override void DoInitialise() { _StandingDataManager = Factory.Singleton.Resolve <IStandingDataManager>().Singleton; _StandingDataManager.LoadCompleted += StandingDataManager_LoadCompleted; _CallsignParser = Factory.Singleton.Resolve <ICallsignParser>(); base.DoInitialise(); }
/// <summary> /// See interface docs. /// </summary> /// <param name="parameters"></param> public void Startup(PluginStartupParameters parameters) { lock (_SyncLock) { var optionsStorage = new OptionsStorage(); _Options = optionsStorage.Load(this); _Database = Factory.Singleton.Resolve <IAutoConfigBaseStationDatabase>().Singleton.Database; _Database.FileNameChanging += BaseStationDatabase_FileNameChanging; _Database.FileNameChanged += BaseStationDatabase_FileNameChanged; _StandingDataManager = Factory.Singleton.Resolve <IStandingDataManager>().Singleton; _StandingDataManager.LoadCompleted += StandingDataManager_LoadCompleted; StartSession(); // If we process messages on the same thread as IAutoConfigListener raises the message received event on then we // will be running on the same thread as the aircraft list. Our processing can take some time, particularly if many // database writes have to happen simultaneously on startup, so to avoid blocking the update of the aircraft list // we create a background thread and process the messages on that. _BackgroundThreadMessageQueue = new BackgroundThreadQueue <BaseStationMessageEventArgs>("BaseStationDatabaseWriterMessageQueue"); _BackgroundThreadMessageQueue.StartBackgroundThread(MessageQueue_MessageReceived, MessageQueue_ExceptionCaught); var listener = Factory.Singleton.Resolve <IAutoConfigListener>().Singleton.Listener; listener.Port30003MessageReceived += MessageListener_MessageReceived; listener.SourceChanged += MessageListener_SourceChanged; Factory.Singleton.Resolve <IHeartbeatService>().Singleton.SlowTick += Heartbeat_SlowTick; } }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton <IRuntimeEnvironment>(); _RuntimeEnvironment.Setup(r => r.IsMono).Returns(false); _ConfigurationStorage = TestUtilities.CreateMockSingleton <IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(r => r.Load()).Returns(_Configuration); _ConfigurationStorage.Setup(r => r.Folder).Returns(Path.Combine(TestContext.TestDeploymentDir, "StandingDataTest")); _Implementation = Factory.Singleton.Resolve <IStandingDataManager>(); _Provider = new Mock <IStandingDataManagerProvider>(); _Implementation.Provider = _Provider.Object; _FileExists = new Dictionary <string, bool>(); _FileExists.Add(DatabaseFileName, true); _FileExists.Add(FlightNumberCoverageFileName, true); _Provider.Setup(p => p.FileExists(It.IsAny <string>())).Returns((string fileName) => { return(_FileExists[Path.GetFileName(fileName).ToUpper()]); }); _ReadAllLines = new Dictionary <string, List <string> >(); _ReadAllLines.Add(FlightNumberCoverageFileName, new List <string>()); _Provider.Setup(p => p.ReadAllLines(It.IsAny <string>())).Returns((string fileName) => { return(_ReadAllLines[Path.GetFileName(fileName).ToUpper()].ToArray()); }); _ReadAllLines[FlightNumberCoverageFileName].Add("A,B,C,D,E"); _ReadAllLines[FlightNumberCoverageFileName].Add("2001-02-01,2002-12-31,1000,X,X"); }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _RuntimeEnvironment.Setup(r => r.IsMono).Returns(false); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(r => r.Load()).Returns(_Configuration); _ConfigurationStorage.Setup(r => r.Folder).Returns(Path.Combine(TestContext.TestDeploymentDir, "StandingDataTest")); _Implementation = Factory.Singleton.Resolve<IStandingDataManager>(); _Provider = new Mock<IStandingDataManagerProvider>(); _Implementation.Provider = _Provider.Object; _FileExists = new Dictionary<string,bool>(); _FileExists.Add(DatabaseFileName, true); _FileExists.Add(FlightNumberCoverageFileName, true); _Provider.Setup(p => p.FileExists(It.IsAny<string>())).Returns((string fileName) => { return _FileExists[Path.GetFileName(fileName).ToUpper()]; }); _ReadAllLines = new Dictionary<string,List<string>>(); _ReadAllLines.Add(FlightNumberCoverageFileName, new List<string>()); _Provider.Setup(p => p.ReadAllLines(It.IsAny<string>())).Returns((string fileName) => { return _ReadAllLines[Path.GetFileName(fileName).ToUpper()].ToArray(); }); _ReadAllLines[FlightNumberCoverageFileName].Add("A,B,C,D,E"); _ReadAllLines[FlightNumberCoverageFileName].Add("2001-02-01,2002-12-31,1000,X,X"); }
/// <summary> /// See interface docs. /// </summary> /// <param name="parameters"></param> public void Startup(PluginStartupParameters parameters) { Singleton = this; lock (_SyncLock) { var optionsStorage = new OptionsStorage(); _Options = optionsStorage.Load(); _Database = Factory.Singleton.Resolve <IAutoConfigBaseStationDatabase>().Singleton.Database; _Database.FileNameChanging += BaseStationDatabase_FileNameChanging; _Database.FileNameChanged += BaseStationDatabase_FileNameChanged; _StandingDataManager = Factory.Singleton.Resolve <IStandingDataManager>().Singleton; _StandingDataManager.LoadCompleted += StandingDataManager_LoadCompleted; var feedManager = Factory.Singleton.Resolve <IFeedManager>().Singleton; feedManager.FeedsChanged += FeedManager_FeedsChanged; _OnlineLookupCache = Provider.CreateOnlineLookupCache(); _OnlineLookupCache.Database = _Database; _OnlineLookupCache.RefreshOutOfDateAircraft = _Options.RefreshOutOfDateAircraft; _OnlineLookupCache.EnabledChanged += OnlineLookupCache_EnabledChanged; StartSession(); var onlineLookupManager = Factory.Singleton.Resolve <IAircraftOnlineLookupManager>().Singleton; onlineLookupManager.RegisterCache(_OnlineLookupCache, 100, letManagerControlLifetime: false); // If we process messages on the same thread as the listener raises the message received event on then we // will be running on the same thread as the aircraft list. Our processing can take some time, particularly if many // database writes have to happen simultaneously on startup, so to avoid blocking the update of the aircraft list // we create a background thread and process the messages on that. _BackgroundThreadMessageQueue = new BackgroundThreadQueue <BaseStationMessageEventArgs>("BaseStationDatabaseWriterMessageQueue", 200000); _BackgroundThreadMessageQueue.StartBackgroundThread(MessageQueue_MessageReceived, MessageQueue_ExceptionCaught); HookFeed(); _HeartbeatService = Factory.Singleton.Resolve <IHeartbeatService>(); _HeartbeatService.SlowTick += Heartbeat_SlowTick; _HeartbeatService.Start(); } }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton <IRuntimeEnvironment>(); _RuntimeEnvironment.Setup(r => r.IsMono).Returns(false); _Log = TestUtilities.CreateMockSingleton <ILog>(); _LogLines = new List <string>(); _Log.Setup(r => r.WriteLine(It.IsAny <string>())).Callback((string line) => { _LogLines.Add(line); }); _Log.Setup(r => r.WriteLine(It.IsAny <string>(), It.IsAny <object[]>())).Callback((string format, object[] args) => { _LogLines.Add(String.Format(format, args)); }); _ConfigurationStorage = TestUtilities.CreateMockSingleton <IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(r => r.Load()).Returns(_Configuration); _ConfigurationStorage.Setup(r => r.Folder).Returns(Path.Combine(TestContext.TestDeploymentDir, "StandingDataTest")); _Implementation = Factory.Singleton.Resolve <IStandingDataManager>(); _Provider = new Mock <IStandingDataManagerProvider>(); _Implementation.Provider = _Provider.Object; _FileExists = new Dictionary <string, bool>(); _FileExists.Add(DatabaseFileName, true); _FileExists.Add(FlightNumberCoverageFileName, true); _Provider.Setup(p => p.FileExists(It.IsAny <string>())).Returns((string fileName) => { var key = String.IsNullOrEmpty(fileName) ? null : Path.GetFileName(fileName).ToUpper(); return(key != null && _FileExists.ContainsKey(key) ? _FileExists[key] : false); }); _ReadAllLines = new Dictionary <string, List <string> >(); _ReadAllLines.Add(FlightNumberCoverageFileName, new List <string>()); _Provider.Setup(p => p.ReadAllLines(It.IsAny <string>())).Returns((string fileName) => { return(_ReadAllLines[Path.GetFileName(fileName).ToUpper()].ToArray()); }); _ReadAllLines[FlightNumberCoverageFileName].Add("A,B,C,D,E"); _ReadAllLines[FlightNumberCoverageFileName].Add("2001-02-01,2002-12-31,1000,X,X"); }
/// <summary> /// Creates a new object. /// </summary> public OnlineLookupCache() { _StandingDataManager = Factory.Singleton.ResolveSingleton <IStandingDataManager>(); }
/// <summary> /// Creates a new object. /// </summary> public RawMessageTranslator() { Provider = new DefaultProvider(); _StandingDataManager = Factory.Singleton.Resolve<IStandingDataManager>().Singleton; _Statistics = Factory.Singleton.Resolve<IStatistics>().Singleton; GlobalDecodeAirborneThresholdMilliseconds = 10000; GlobalDecodeFastSurfaceThresholdMilliseconds = 25000; GlobalDecodeSlowSurfaceThresholdMilliseconds = 50000; LocalDecodeMaxSpeedAirborne = 15.0; LocalDecodeMaxSpeedTransition = 5.0; LocalDecodeMaxSpeedSurface = 3.0; ReceiverRangeKilometres = 650; TrackingTimeoutSeconds = 600; AcceptIcaoInPI0Count = 1; AcceptIcaoInPI0Milliseconds = 1000; _CompactPositionReporting = Factory.Singleton.Resolve<ICompactPositionReporting>(); _HeartbeatService = Factory.Singleton.Resolve<IHeartbeatService>().Singleton; _HeartbeatService.SlowTick += Heartbeat_SlowTick; }
/// <summary> /// See interface docs. /// </summary> /// <param name="parameters"></param> public void Startup(PluginStartupParameters parameters) { lock(_SyncLock) { var optionsStorage = new OptionsStorage(); _Options = optionsStorage.Load(this); _Database = Factory.Singleton.Resolve<IAutoConfigBaseStationDatabase>().Singleton.Database; _Database.FileNameChanging += BaseStationDatabase_FileNameChanging; _Database.FileNameChanged += BaseStationDatabase_FileNameChanged; _StandingDataManager = Factory.Singleton.Resolve<IStandingDataManager>().Singleton; _StandingDataManager.LoadCompleted += StandingDataManager_LoadCompleted; StartSession(); // If we process messages on the same thread as IAutoConfigListener raises the message received event on then we // will be running on the same thread as the aircraft list. Our processing can take some time, particularly if many // database writes have to happen simultaneously on startup, so to avoid blocking the update of the aircraft list // we create a background thread and process the messages on that. _BackgroundThreadMessageQueue = new BackgroundThreadQueue<BaseStationMessageEventArgs>("BaseStationDatabaseWriterMessageQueue"); _BackgroundThreadMessageQueue.StartBackgroundThread(MessageQueue_MessageReceived, MessageQueue_ExceptionCaught); var listener = Factory.Singleton.Resolve<IAutoConfigListener>().Singleton.Listener; listener.Port30003MessageReceived += MessageListener_MessageReceived; listener.SourceChanged += MessageListener_SourceChanged; Factory.Singleton.Resolve<IHeartbeatService>().Singleton.SlowTick += Heartbeat_SlowTick; } }