Esempio n. 1
0
        private static Dictionary <Dep, List <Dep> > EraseExtraChildren(Dictionary <Dep, List <Dep> > configsGraph)
        {
            var vertices        = configsGraph.Select(e => e.Key).ToList();
            var deletedChildren = new List <Dep>();

            foreach (var parrent in vertices)
            {
                if (deletedChildren.Contains(parrent))
                {
                    continue;
                }
                var hierarchyManager       = new ConfigurationManager(parrent.Name, vertices.Where(v => v.Name == parrent.Name).ToArray());
                var childrenConfigurations = hierarchyManager.ProcessedChildrenConfigurations(parrent);
                foreach (var childConfig in childrenConfigurations)
                {
                    var child = new Dep(parrent.Name, null, childConfig);
                    if (deletedChildren.Contains(child))
                    {
                        continue;
                    }
                    var configsGraph2 = EraseChild(configsGraph, child, parrent);
                    try
                    {
                        GetTopologicallySortedGraph(configsGraph2, parrent.Name, parrent.Configuration, printCycle: false);
                        configsGraph = configsGraph2;
                        deletedChildren.Add(child);
                    }
                    catch (Exception)
                    {
                        // cycle
                    }
                }
            }
            return(configsGraph);
        }
Esempio n. 2
0
        public static List <string> GetSmallerCementConfigs(string modulePath, List <string> usedCementConfigs)
        {
            var configParser  = new ConfigurationYamlParser(new FileInfo(modulePath));
            var configManager = new ConfigurationManager(usedCementConfigs.Select(c => new Dep("", null, c)), configParser);

            return(usedCementConfigs
                   .Where(c => !configManager.ProcessedChildrenConfigurations(new Dep("", null, c)).Any())
                   .ToList());
        }