コード例 #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
 private void loadRulesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (openRulesDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         try
         {
             _Rules = LOCLib.ReadCountingSizeRules(openRulesDialog.FileName);
             MessageBox.Show(this, "Rules loaded successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
             OpenRules();
         }
         catch
         {
             MessageBox.Show(this, "An error occurred trying to load the rules. Try another file.", "Ops", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
コード例 #3
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);
        }