Ejemplo n.º 1
0
        private void RemovePropertyCommand(ParameterTokenSet tokens, DroneFlags flags)
        {
            var config = this.droneService.LoadConfig(flags.ConfigFileName);
            var key = tokens.TryGetAt(0);

            if (key != null)
            {
                if (config.Props.Remove(key.Value))
                    this.log.Info("property '{0}' removed", key.Value);
            }

            this.droneService.SaveConfig(config);
        }
Ejemplo n.º 2
0
        private void GetPropertyCommand(ParameterTokenSet tokens, DroneFlags flags)
        {
            var config = this.droneService.LoadConfig(flags.ConfigFileName);

            var key = tokens.TryGetAt(0);

            if (key == null)
            {
                foreach (var prop in config.Props)
                {
                    this.log.Info("{0}: {1}", prop.Key, prop.Value);
                }
            }
            else
            {
                var token = null as JToken;
                if (!config.Props.TryGetValue(key.Value, out token))
                    return;

                this.log.Info("{0}: {1}", key.Value, token);
            }
        }