Пример #1
0
        private List <FileTopologyInfo> ParseProjects(IEnumerable <ProjectFileInfo> projects)
        {
            var topoInfos = new List <FileTopologyInfo>();

            foreach (var proj in projects)
            {
                var topo = new FileTopologyInfo();
                topo.ProjInfo = proj;
                foreach (var refer in proj.References)
                {
                    var p = projects.FirstOrDefault(i => i.AssemblyName == Path.GetFileNameWithoutExtension(refer.FullPath));
                    if (p != null)
                    {
                        topo.Descendants.Add(p);
                    }
                }

                foreach (var prefer in proj.ProjReferences)
                {
                    var p = projects.FirstOrDefault(i => prefer.Name == Path.GetFileNameWithoutExtension(i.FileFullPath));
                    if (p != null)
                    {
                        topo.Descendants.Add(p);
                    }
                }
                topoInfos.Add(topo);
            }
            return(topoInfos);
        }
Пример #2
0
        private void UpdateParentPoint(FileTopologyInfo child, IEnumerable <FileTopologyInfo> topologies)
        {
            var basePoint = child.PathPoint;

            foreach (var item in topologies)
            {
                var first = item.Descendants.FirstOrDefault(i => i.FileFullPath == child.ProjInfo.FileFullPath);
                if (first != null)
                {
                    var newPoint = basePoint + 1;
                    if (item.PathPoint < newPoint)
                    {
                        item.PathPoint = newPoint;
                    }
                    UpdateParentPoint(item, topologies);
                }
            }
        }