Ejemplo n.º 1
0
        private IJsonValue ExportAreaConfigurationToJsonValue(IArea area)
        {
            var configuration = new JsonObject();

            configuration.SetNamedValue("settings", area.ExportConfigurationToJsonObject());

            var components = new JsonObject();

            foreach (var component in area.GetComponents())
            {
                components.SetNamedValue(component.Id.Value, component.ExportConfigurationToJsonObject());
            }

            configuration.SetNamedValue("components", components);

            var automations = new JsonObject();

            foreach (var automation in area.GetAutomations())
            {
                automations.SetNamedValue(automation.Id.Value, automation.ExportConfigurationAsJsonValue());
            }

            configuration.SetNamedValue("automations", automations);

            return(configuration);
        }
Ejemplo n.º 2
0
        private IJsonValue ExportAreaConfigurationToJsonValue(IArea area)
        {
            var configuration = new JsonObject();

            configuration.SetNamedValue("Settings", area.ExportConfigurationToJsonObject());

            var actuators = new JsonObject();

            foreach (var actuator in area.Actuators())
            {
                actuators.SetNamedValue(actuator.Id.Value, actuator.ExportConfigurationToJsonObject());
            }

            configuration.SetNamedValue("Actuators", actuators);

            var automations = new JsonObject();

            foreach (var automation in area.Automations())
            {
                automations.SetNamedValue(automation.Id.Value, automation.ExportConfigurationAsJsonValue());
            }

            configuration.SetNamedValue("Automations", automations);

            return(configuration);
        }