private void OnConsoleConfigCommand(string arguments, object userData) { Config.Parameter parameter = (Config.Parameter)userData; if (string.IsNullOrEmpty(arguments)) { object value = parameter.GetValue(); Print(string.Format("Value: \"{0}\", Default value: \"{1}\"", value != null ? value : "(null)", parameter.DefaultValue)); return; } try { if (parameter.Field != null) { object value = SimpleTypesUtils.GetSimpleTypeValue(parameter.Field.FieldType, arguments); if (value == null) { throw new Exception("Not simple type"); } parameter.Field.SetValue(null, value); } else if (parameter.Property != null) { object value = SimpleTypesUtils.GetSimpleTypeValue(parameter.Property.PropertyType, arguments); if (value == null) { throw new Exception("Not simple type"); } parameter.Property.SetValue(null, value, null); } } catch (FormatException e) { string s = ""; if (parameter.Field != null) { s = parameter.Field.FieldType.ToString(); } else if (parameter.Property != null) { s = parameter.Property.PropertyType.ToString(); } Print(string.Format("Config : Invalid parameter format \"{0}\" {1}", s, e.Message), new ColorValue(1, 0, 0)); } }