/// <summary>
        /// Parses a project entry in a solution file.
        /// </summary>
        /// <param name="data">Project("Solution_GUID") = "Project_Name", "Project_Path", "Project_GUID"</param>
        /// <returns></returns>
        public static VsSolutionProjectPart Parse(string data)
        {
            try
            {
                VsSolutionProjectPart proj = new VsSolutionProjectPart();

                data = data.Substring(data.IndexOf("=") + 1);
                string[] split = data.Split(',');

                proj._name = split[0].Trim().Trim('\"');
                proj._path = split[1].Trim().Trim('\"');
                proj._guid = split[2].Trim().Trim('\"');

                return(proj);
            }
            catch
            {
                throw (new FormatException("Project data was not in correct format."));
            }
        }
Exemplo n.º 2
0
        public static VsSolution Parse(string[] data)
        {
            try
            {
                VsSolution solution = new VsSolution();
                solution._linkedProjects = new VsSolutionProjectPart[0];

                foreach (string each in data)
                {
                    if (each.StartsWith("Project(\"{"))
                    {
                        Array.Resize(ref solution._linkedProjects, solution._linkedProjects.Length + 1);
                        solution._linkedProjects[solution._linkedProjects.Length - 1] = VsSolutionProjectPart.Parse(each);
                    }
                }

                return(solution);
            }
            catch
            {
                throw (new FormatException("Solution data was not in correct format."));
            }
        }