public bool Load(string filename) { if (!File.Exists(filename)) { return(false); } m_filename = filename; m_workPath = Path.GetDirectoryName(m_filename); try { using (StreamReader sr = new StreamReader(filename)) { while (!sr.EndOfStream) { m_solution.Add(sr.ReadLine()); } } foreach (String line in m_solution) { if (line.StartsWith("Project(")) { // get name and id string[] parts = line.Split(','); string id = parts[parts.Length - 1].Remove(0, parts[parts.Length - 1].IndexOf('{') + 1); id = id.Remove(id.IndexOf('}')); string name = line.Remove(0, line.IndexOf('=') + 3); name = name.Remove(name.IndexOf('\"')); String projfile = line.Remove(0, line.IndexOf(',') + 3); projfile = projfile.Remove(projfile.IndexOf('\"')); if (!projfile.Contains(".csproj")) { continue; } projfile = m_workPath + "\\" + projfile; if (!m_projects.ContainsKey(name)) { CCSProj proj = new CCSProj(); if (proj.Load(projfile)) { proj.ProjectLine = line; proj.Name = name; proj.ID = id; m_projectList.Add(proj); m_projects.Add(name, id); } else { m_missingProjects.Add(projfile); } } } } } catch (Exception ex) { string msg = "Can't load solution file " + filename + ":" + Environment.NewLine + ex.Message; if (ex.InnerException != null) { msg += Environment.NewLine + ex.InnerException.Message; } Console.WriteLine(msg); return(false); } return(true); }