public void Add(ObjectTree tree) { foreach (string objectPath in tree.GetAllPaths()) { object objectReference = tree.GetObject(objectPath); foreach (FieldInfo field in objectReference.GetType().GetFields()) { foreach (object attribute in field.GetCustomAttributes(typeof(ParameterAttribute), true)) { ParameterValue parameter = new ParameterValue(objectPath, tree, field); ByPath[parameter.FieldPath] = parameter; } } } }
public void Initialize(ObjectTree tree) { Parameters.Clear(); foreach (string path in tree.GetAllPaths()) { object nested = tree.GetObject(path); foreach (FieldInfo field in nested.GetType().GetFields()) { foreach (object attribute in field.GetCustomAttributes(typeof(DpiAdjustedAttribute), true)) { Parameter parameter = new Parameter(); parameter.Value = new ParameterValue(path, tree, field); parameter.OriginalValue = parameter.Value.Value.Double; parameter.Attribute = attribute as DpiAdjustedAttribute; Parameters.Add(parameter); } } } }