/// <summary> /// See interface docs. /// </summary> public void HookFeed() { if (_Connector != null) { UnhookFeed(); } if (_AircraftListJsonBuilder == null) { _AircraftListJsonBuilder = Factory.Singleton.Resolve <IAircraftListJsonBuilder>(); var provider = Factory.Singleton.Resolve <IWebSiteProvider>(); _AircraftListJsonBuilder.Initialise(provider); } if (_AircraftListJsonContractResolver == null) { _AircraftListJsonContractResolver = new AircraftListJsonContractResolver(); _AircraftListJsonSerialiserSettings = new JsonSerializerSettings() { ContractResolver = _AircraftListJsonContractResolver, }; } _Connector = RebroadcastServer.Connector; _Connector.AddingConnection += Connector_AddingConnection; }
/// <summary> /// Sends the appropriate AircraftList.json content in response to the request passed across. /// </summary> /// <param name="args"></param> /// <param name="feedId"></param> /// <param name="aircraftList"></param> /// <param name="isFlightSimulator"></param> /// <returns>Always returns true - this just helps to make the caller's code a little more compact.</returns> private bool HandleAircraftListJson(RequestReceivedEventArgs args, int feedId, IAircraftList aircraftList, bool isFlightSimulator) { if (_Builder == null) { _Builder = Factory.Singleton.Resolve <IAircraftListJsonBuilder>(); _Builder.Initialise(Provider); } var buildArgs = ConstructBuildArgs(args, feedId, aircraftList, isFlightSimulator); var json = _Builder.Build(buildArgs); if (buildArgs.ServerTimeTicks > -1 && buildArgs.ServerTimeTicks <= _ConfigurationChangedTick) { json.ServerConfigChanged = true; } Responder.SendJson(args.Request, args.Response, json, args.QueryString["callback"], null); args.Classification = ContentClassification.Json; return(true); }