/// <summary> /// See interface. /// </summary> /// <returns></returns> public virtual object Clone() { var result = (ServerConfigJson)Activator.CreateInstance(GetType()); result.GoogleMapsApiKey = GoogleMapsApiKey; result.InitialDistanceUnit = InitialDistanceUnit; result.InitialHeightUnit = InitialHeightUnit; result.InitialLatitude = InitialLatitude; result.InitialLongitude = InitialLongitude; result.InitialMapType = InitialMapType; result.InitialSettings = InitialSettings; result.InitialSpeedUnit = InitialSpeedUnit; result.InitialZoom = InitialZoom; result.InternetClientCanRunReports = InternetClientCanRunReports; result.InternetClientCanShowPinText = InternetClientCanShowPinText; result.InternetClientsCanPlayAudio = InternetClientsCanPlayAudio; result.InternetClientsCanSubmitRoutes = InternetClientsCanSubmitRoutes; result.InternetClientTimeoutMinutes = InternetClientTimeoutMinutes; result.InternetClientsCanSeeAircraftPictures = InternetClientsCanSeeAircraftPictures; result.InternetClientsCanSeePolarPlots = InternetClientsCanSeePolarPlots; result.IsAudioEnabled = IsAudioEnabled; result.IsLocalAddress = IsLocalAddress; result.IsMono = IsMono; result.MinimumRefreshSeconds = MinimumRefreshSeconds; result.RefreshSeconds = RefreshSeconds; result.Receivers.AddRange(Receivers.Select(r => (ServerReceiverJson)r.Clone())); result.UseMarkerLabels = UseMarkerLabels; result.UseSvgGraphics = UseSvgGraphics; result.VrsVersion = VrsVersion; return(result); }
public override async Task Execute() { var arv = new SyncReceiverMultiple(Receivers.Select(it => it.Value).ToArray()); await arv.LoadData(); IRow[] data = arv.valuesRead; await TransformAndSendData(association, data); }
/// <summary> /// See interface. /// </summary> /// <returns></returns> public virtual object Clone() { var result = (ServerConfigJson)MemberwiseClone(); result.Receivers = new List <ServerReceiverJson>(); result.Receivers.AddRange(Receivers.Select(r => (ServerReceiverJson)r.Clone())); result.TileServerSettings = (TileServerSettings)TileServerSettings?.Clone(); result.TileServerLayers = new List <TileServerSettings>(); result.TileServerLayers.AddRange(TileServerLayers.Select(r => (TileServerSettings)r.Clone())); return(result); }
internal void SetupInfrastructure(string[] sendingQueues) { using (var connection = connectionFactory.CreateAdministrationConnection()) using (var channel = connection.CreateModel()) { DelayInfrastructure.Build(channel); var receivingQueues = Receivers.Select(r => r.Value.ReceiveAddress).ToArray(); routingTopology.Initialize(channel, receivingQueues, sendingQueues); foreach (string receivingAddress in receivingQueues) { routingTopology.BindToDelayInfrastructure(channel, receivingAddress, DelayInfrastructure.DeliveryExchange, DelayInfrastructure.BindingKey(receivingAddress)); } } }
public override async Task Execute() { IReceive arv = null; if (Receivers?.Count == 1) { arv = Receivers[0]; } if (arv == null) { if (AllReceiversAsync) { arv = new AsyncReceiverMultiple(Receivers.Select(it => it.Value).ToArray()); } else { arv = new SyncReceiverMultiple(Receivers.Select(it => it.Value).ToArray()); } } await arv.LoadData(); bool existsVar = (RuntimeParameters?.Length ?? 0) > 0; string[] nameObjectsWithVariables = null; if (existsVar) { nameObjectsWithVariables = RuntimeParameters .SelectMany(it => it.NameObjectsToApplyTo) .Select(it => it.NameObjectToApplyTo.ToLowerInvariant()) .Distinct() .ToArray(); } IRow[] data = arv.valuesRead; foreach (var filterKV in FiltersAndTransformers) { var var = filterKV.Value as TransformIntoVariable; if (var != null) { if (!existsVar) { //TODO:log continue; } var param = RuntimeParameters.FirstOrDefault(it => it.VariableName == var.VariableName); if (param == null) { throw new ArgumentException($"in runtime parameters I cannot find variable {var.VariableName}"); } await var.Run(); variables[param] = var.Result; continue; } bool hasVar = (nameObjectsWithVariables?.Length > 0) && (nameObjectsWithVariables.Contains(filterKV.Value.Name.ToLowerInvariant())); if (hasVar) { TransformPropertyFromVar(filterKV.Value); } //TODO: see also IFilterTransformer var transform = filterKV.Value as ITransform; if (transform != null) { transform.valuesRead = data; await transform.Run(); data = transform.valuesTransformed; continue; } var filter = filterKV.Value as IFilter; if (filter != null) { filter.valuesRead = data; await filter.Run(); data = filter.valuesTransformed; continue; } Debug.Assert(false, "base object is not found"); //@class.Log(LogLevel.Error,0,$"base object is not found",null,null); Debug.Assert(false, "filter is not found"); } //await SenderData(data); if (Senders.Count == 0) { return; } ISend send = null; if (Senders.Count == 1) { send = Senders[0]; } if (send == null) { if (AllSendersAsync) { send = new ASyncSenderMultiple(Senders.Select(it => it.Value).ToArray()); } else { send = new SyncSenderMultiple(Senders.Select(it => it.Value).ToArray()); } } send.valuesToBeSent = data; await send.Send(); }
private async Task <Message[]> SendNotification(string notification) => await Task.WhenAll( Receivers.Select(receiver => _client.SendTextMessageAsync(int.Parse(receiver), notification)) );