コード例 #1
0
        private bool RtSetValue(SetValueParam[] toSets)
        {
            if (toSets.Any(t => RtTagExpression.IsExpression(t.Topic)))
            {
                return(false);
            }

            logger.LogInformation("RtSetValue {@toSets}", System.Text.Json.JsonSerializer.Serialize(toSets));

            return(toSets.All(t =>
            {
                if (t.Value.ValueKind == JsonValueKind.Number)
                {
                    return connector.SetNumeric(t.Topic, t.Value.GetDouble());
                }
                else if (t.Value.ValueKind == JsonValueKind.Array || t.Value.ValueKind == JsonValueKind.Object)
                {
                    return connector.SetJson(t.Topic, t.Value);
                }
                else
                {
                    return connector.SetText(t.Topic, t.Value.ToString());
                }
            }));
        }
コード例 #2
0
        private void ShiftScopedPublishShiftCrew(object sender, ShiftCrewDto shiftCrew)
        {
            logger.LogInformation("PublishShiftCrew {@shiftCrew}", shiftCrew);
            var profile = GetShiftProfile(shiftCrew.NameShiftProfile);

            if (profile != null && connector != null && !string.IsNullOrWhiteSpace(profile.TagPublish))
            {
                connector.SetJson(profile.TagPublish, shiftCrew);
            }

            PublishShiftCrew?.Invoke(this, shiftCrew);
            notification?.OnUpdateShiftCrew(shiftCrew);
        }