public override List <ITunableFieldOption> GetOptions() { Array array = (Array)mField.GetValue(true); List <ITunableFieldOption> results = new List <ITunableFieldOption>(); for (int i = 0; i < array.Length; i++) { object obj = array.GetValue(i); if (obj == null) { continue; } ITunableConvertOption arrayOption = TunableTypeOption.GetFieldOption(obj.GetType()); if (arrayOption == null) { results.Add(new TunableUnhandledOption(new ArrayFieldInfo(mField, i))); } else { results.Add(arrayOption.Clone(new ArrayFieldInfo(mField, i))); } } return(results); }
public override void Import(Persistence.Lookup settings) { base.Import(settings); FieldInfo field = GetFieldInfo(); if (field != null) { ITunableConvertOption converter = TunableTypeOption.GetFieldOption(GetParsingType(field)); if (converter != null) { mValue = converter.Clone(GetTunableFieldInfo()).Convert(settings.GetString("Value"), false); } } }
public override List <ITunableFieldOption> GetOptions() { List <ITunableFieldOption> results = new List <ITunableFieldOption>(); if (mField.Depth < 10) { foreach (FieldInfo field in mField.Field.FieldType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { ITunableConvertOption option = TunableTypeOption.GetFieldOption(field.FieldType); if (option == null) { continue; } results.Add(option.Clone(new TunableFieldInfo(field, mField))); } } return(results); }
public bool ParseValue(XmlDbRow row) { if (!row.Exists("Value")) { BooterLogger.AddError("Value missing for " + mParentType + "." + mFieldName); return(false); } FieldInfo field = GetFieldInfo(); if (field == null) { BooterLogger.AddError("Unknown Field for " + mParentType + "." + mFieldName); return(false); } ITunableConvertOption fieldOption = TunableTypeOption.GetFieldOption(GetParsingType(field)); if (fieldOption != null) { try { mValue = fieldOption.Clone(GetTunableFieldInfo()).Convert(row.GetString("Value"), true); return(true); } catch (Exception e) { Common.Exception(mParentType + "." + mFieldName + Common.NewLine + row.GetString("Value"), e); return(false); } } else { BooterLogger.AddError("Unhandled Field type : " + field.FieldType + " (" + mParentType + "." + mFieldName + ")"); return(false); } }