BitMiracle.VisualStudioConverter.CSScript.Converter.processProjectToolsVersion C# (CSharp) Method

processProjectToolsVersion() private method

private processProjectToolsVersion ( XmlDocument projectDocument, XmlNamespaceManager xmlNamespaceManager ) : bool
projectDocument System.Xml.XmlDocument
xmlNamespaceManager System.Xml.XmlNamespaceManager
return bool
        private bool processProjectToolsVersion(XmlDocument projectDocument, XmlNamespaceManager xmlNamespaceManager)
        {
            XmlNode projectNode = projectDocument.SelectSingleNode("/prj:Project", xmlNamespaceManager);
            if (projectNode == null)
                throw new ApplicationException("Invalid project file");

            // check is project already in target format
            XmlAttribute toolsVersionAttribute = projectNode.Attributes["ToolsVersion"];
            if (toolsVersionAttribute != null)
            {
                if (toolsVersionAttribute.InnerText == m_visualStudioFormat.ProjectToolsVersion)
                    return false;
            }
            else
            {
                // tools version attribute is absent in VS 2005 projects
                if (m_visualStudioFormat.Format == "2005")
                    return false;
            }

            string toolsVersion = m_visualStudioFormat.ProjectToolsVersion;
            if (!String.IsNullOrEmpty(toolsVersion)) // VS 2008, 2010
                toolsVersionAttribute.Value = toolsVersion;
            else // VS 2005
                projectNode.Attributes.Remove(projectNode.Attributes["ToolsVersion"]);

            return true;
        }