protected void ParseVirtualDirectory(XmlNode virtualDirectoryNode, CodeLiteProject project)
        {
            foreach (XmlNode fileNode in virtualDirectoryNode.SelectNodes("File"))
            {
                project.CodeFiles.Add(fileNode.Attributes.GetNamedItem("Name").Value);
            }

            foreach (XmlNode directoryNode in virtualDirectoryNode.SelectNodes("VirtualDirectory"))
            {
                ParseVirtualDirectory(directoryNode, project);
            }
        }
        public CodeLiteWorkspace ParseWorkspace(string workspacePath)
        {
            // WORKSPACE
            XmlDocument workspaceReader = new XmlDocument();
            workspaceReader.Load(workspacePath);

            CodeLiteWorkspace workspace = new CodeLiteWorkspace();
            workspace.Name = workspaceReader.SelectSingleNode("CodeLite_Workspace").Attributes.GetNamedItem("Name").Value;

            // Configurations
            XmlNode buildMatrixNode = workspaceReader.SelectSingleNode("CodeLite_Workspace/BuildMatrix");
            workspace.Configurations = new List<WorkspaceConfiguration>();

            foreach (XmlNode configurationNode in buildMatrixNode.SelectNodes("WorkspaceConfiguration"))
            {
                WorkspaceConfiguration workspaceConfig = new WorkspaceConfiguration();
                workspace.Configurations.Add(workspaceConfig);
                workspaceConfig.Name = configurationNode.Attributes.GetNamedItem("Name").Value;

                workspaceConfig.Projects = new List<WorkspaceConfigurationProject>();

                foreach (XmlNode projectInConfigNode in configurationNode.SelectNodes("Project"))
                {
                    WorkspaceConfigurationProject projectConfiguration = new WorkspaceConfigurationProject();
                    workspaceConfig.Projects.Add(projectConfiguration);
                    projectConfiguration.Name = projectInConfigNode.Attributes.GetNamedItem("Name").Value;
                    projectConfiguration.ConfigName = projectInConfigNode.Attributes.GetNamedItem("ConfigName").Value;
                }
            }

            // PROJECTS
            workspace.Projects = new List<CodeLiteProject>();

            foreach (XmlNode projectNode in workspaceReader.SelectNodes("CodeLite_Workspace/Project"))
            {
                CodeLiteProject project = new CodeLiteProject();
                workspace.Projects.Add(project);
                project.Name = projectNode.Attributes.GetNamedItem("Name").Value;
                project.Path = projectNode.Attributes.GetNamedItem("Path").Value;

                XmlDocument projectReader = new XmlDocument();
                projectReader.Load(Path.GetDirectoryName(workspacePath) + Path.DirectorySeparatorChar + project.Path);

                // Files
                project.CodeFiles = new List<string>();

                foreach (XmlNode directoryNode in projectReader.SelectNodes("CodeLite_Project/VirtualDirectory"))
                {
                    ParseVirtualDirectory(directoryNode, project);
                }

                // Dependencies
                project.Dependencies = new List<Dependencies>();

                foreach (XmlNode dependencyNode in projectReader.SelectNodes("CodeLite_Project/Dependencies"))
                {
                    if (dependencyNode.Attributes.GetNamedItem("Name") != null)
                    {
                        Dependencies dependencies = new Dependencies();
                        project.Dependencies.Add(dependencies);
                        dependencies.Name = dependencyNode.Attributes.GetNamedItem("Name").Value;

                        XmlNodeList dependencyProjects = dependencyNode.SelectNodes("Project");

                        dependencies.ProjectNames = new List<string>();

                        foreach (XmlNode dependencyProjectNode in dependencyProjects)
                        {
                            dependencies.ProjectNames.Add(dependencyProjectNode.Attributes.GetNamedItem("Name").Value);
                        }
                    }
                }

                // Configurations
                project.Configurations = new List<CodeLiteProjectConfiguration>();

                foreach (XmlNode configNode in projectReader.SelectSingleNode("CodeLite_Project/Settings").SelectNodes("Configuration"))
                {
                    project.Configurations.Add(ParseProjectConfiguration(configNode));
                }

                // Global settings
                project.GlobalConfiguration = ParseProjectConfiguration(projectReader.SelectSingleNode("CodeLite_Project/Settings").SelectSingleNode("GlobalSettings"));
            }

            return workspace;
        }