예제 #1
0
        public List <LOCClassInfo> Read()
        {
            var pathBase = LOCLib.GetPath(FilePath);
            List <ProjectReader> projects = new List <ProjectReader>();

            // Identify projects in the solution
            using (StreamReader reader = new StreamReader(FilePath))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    if (line.StartsWith("Project("))
                    {
                        var values = line.Split(',');
                        projects.Add(new ProjectReader(pathBase + values[1].ToString().Replace("\"", "").Trim()));
                    }
                    else if (line.Equals("Global"))
                    {
                        break;
                    }
                }
            }

            // Read the project to identify their classes
            List <LOCClassInfo> listOfClasses = new List <LOCClassInfo>();

            foreach (var proj in projects)
            {
                listOfClasses.AddRange(proj.Read());
            }

            return(listOfClasses);
        }
예제 #2
0
        public List <LOCClassInfo> Read()
        {
            List <FileReader> classes = new List <FileReader>();
            var pathBase = LOCLib.GetPath(FilePath);

            XDocument xmlDoc     = XDocument.Load(FilePath);
            var       xmlClasses = xmlDoc.Descendants().Elements().Where(x => x.Name.ToString().Contains("Compile"));

            foreach (var xmlClass in xmlClasses)
            {
                var classPath = xmlClass.Attribute("Include").Value;
                classes.Add(new FileReader(pathBase + classPath));
            }

            List <LOCClassInfo> listOfClasses = new List <LOCClassInfo>();

            foreach (var file in classes)
            {
                listOfClasses.AddRange(file.Read());
            }

            return(listOfClasses);
        }