private bool ConfigPropertyIsImportType(DymeConfigProperty property) { Regex match = new Regex(_regexMatchForSpecialPropertyConfigReference); return(match.IsMatch(property.Name)); }
private IEnumerable <ValueNode> LeafNodesFromConfigProperty(IEnumerable <DymeConfig> configLibrary, DymeConfigProperty configProperty) { var leafNodes = new List <ValueNode>(); for (var i = 0; i < configProperty.Values.Count(); i++) { var value = configProperty.Values.ElementAt(i); var leafNode = new ValueNode(value, NodeTypeEnum.ValueNode); leafNode.LeafType = ValueTypeEnum.Text; leafNode.ValueIndex = i; if (ConfigPropertyIsImportType(configProperty)) { leafNode.LeafType = ValueTypeEnum.ImportedSetup; var matchingLibraryConfig = configLibrary.SingleOrDefault(c => c.Name == value); if (matchingLibraryConfig == null) { throw new Exception($"You are attempting to reference a config \"{value}\", which does not exist in your config library"); } leafNode.Children = PropertyNodesFromConfig(matchingLibraryConfig, configLibrary).Select(n => n as Node).ToList(); } leafNodes.Add(leafNode); } return(leafNodes); }