/// <summary> /// Read config settings for the given object /// </summary> /// <param name="ProjectDir">Path to the project directory</param> /// <param name="Platform">The platform being built</param> /// <param name="TargetObject">Object to receive the settings</param> /// <param name="Tracker">Tracks the set of config values that were retrieved. May be null.</param> internal static void ReadSettings(DirectoryReference ProjectDir, UnrealTargetPlatform Platform, object TargetObject, ConfigValueTracker Tracker) { List <ConfigField> Fields = FindConfigFieldsForType(TargetObject.GetType()); foreach (ConfigField Field in Fields) { // Read the hierarchy listed ConfigHierarchy Hierarchy = ReadHierarchy(Field.Attribute.ConfigType, ProjectDir, Platform); // Get the key name string KeyName = Field.Attribute.KeyName ?? Field.FieldInfo.Name; // Get the value(s) associated with this key IReadOnlyList <string> Values; Hierarchy.TryGetValues(Field.Attribute.SectionName, KeyName, out Values); // Parse the values from the config files and update the target object if (Field.AddElement == null) { if (Values != null && Values.Count == 1) { object Value; if (TryParseValue(Values[0], Field.FieldInfo.FieldType, out Value)) { Field.FieldInfo.SetValue(TargetObject, Value); } } } else { if (Values != null) { foreach (string Item in Values) { object Value; if (TryParseValue(Item, Field.ElementType, out Value)) { Field.AddElement(TargetObject, Value); } } } } // Save the dependency if (Tracker != null) { Tracker.Add(Field.Attribute.ConfigType, ProjectDir, Platform, Field.Attribute.SectionName, KeyName, Values); } } }