Inheritance: DataNode
Ejemplo n.º 1
0
        /// <summary>
        /// Parses the specified node.
        /// </summary>
        /// <param name="node">The node.</param>
        public override void Parse(XmlNode node)
        {
            m_Name         = Helper.AttributeValue(node, "name", m_Name);
            m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig);
            m_Path         = Helper.AttributeValue(node, "path", m_Path);
            m_Version      = Helper.AttributeValue(node, "version", m_Version);

            m_FullPath = m_Path;
            try
            {
                m_FullPath = Helper.ResolvePath(m_FullPath);
            }
            catch
            {
                throw new WarningException("Could not resolve solution path: {0}", m_Path);
            }

            Kernel.Instance.CurrentWorkingDirectory.Push();
            try
            {
                Helper.SetCurrentDir(m_FullPath);

                if (node == null)
                {
                    throw new ArgumentNullException("node");
                }

                foreach (XmlNode child in node.ChildNodes)
                {
                    IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
                    if (dataNode is OptionsNode)
                    {
                        m_Options = (OptionsNode)dataNode;
                    }
                    else if (dataNode is FilesNode)
                    {
                        m_Files = (FilesNode)dataNode;
                    }
                    else if (dataNode is ConfigurationNode)
                    {
                        ConfigurationNode configurationNode = (ConfigurationNode)dataNode;
                        m_Configurations[configurationNode.NameAndPlatform] = configurationNode;

                        // If the active configuration is null, then we populate it.
                        if (ActiveConfig == null)
                        {
                            ActiveConfig = configurationNode.Name;
                        }
                    }
                    else if (dataNode is ProjectNode)
                    {
                        m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode)dataNode;
                        m_ProjectsOrder.Add((ProjectNode)dataNode);
                    }
                    else if (dataNode is SolutionNode)
                    {
                        m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode)dataNode;
                    }
                    else if (dataNode is ProcessNode)
                    {
                        ProcessNode p = (ProcessNode)dataNode;
                        Kernel.Instance.ProcessFile(p, this);
                    }
                    else if (dataNode is DatabaseProjectNode)
                    {
                        m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = (DatabaseProjectNode)dataNode;
                    }
                    else if (dataNode is CleanupNode)
                    {
                        if (m_Cleanup != null)
                        {
                            throw new WarningException("There can only be one Cleanup node.");
                        }
                        m_Cleanup = (CleanupNode)dataNode;
                    }
                }
            }
            finally
            {
                Kernel.Instance.CurrentWorkingDirectory.Pop();
            }
        }
Ejemplo n.º 2
0
        public void ProcessFile(ProcessNode node, SolutionNode parent)
        {
            if (node.IsValid)
            {
                ArrayList list = new ArrayList();
                ProcessFile(node.Path, list);

                foreach (SolutionNode solution in list)
                    parent.SolutionsTable[solution.Name] = solution;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Parses the specified node.
        /// </summary>
        /// <param name="node">The node.</param>
        public override void Parse(XmlNode node)
        {
            m_Name         = Helper.AttributeValue(node, "name", m_Name);
            m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig);
            m_Path         = Helper.AttributeValue(node, "path", m_Path);

            m_FullPath = m_Path;
            try
            {
                m_FullPath = Helper.ResolvePath(m_FullPath);
            }
            catch
            {
                throw new WarningException("Could not resolve solution path: {0}", m_Path);
            }

            Kernel.Instance.CurrentWorkingDirectory.Push();
            try
            {
                Helper.SetCurrentDir(m_FullPath);

                if (node == null)
                {
                    throw new ArgumentNullException("node");
                }

                foreach (XmlNode child in node.ChildNodes)
                {
                    IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
                    if (dataNode is OptionsNode)
                    {
                        m_Options = (OptionsNode)dataNode;
                    }
                    else if (dataNode is FilesNode)
                    {
                        m_Files = (FilesNode)dataNode;
                    }
                    else if (dataNode is ConfigurationNode)
                    {
                        m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode;
                    }
                    else if (dataNode is ProjectNode)
                    {
                        m_Projects[((ProjectNode)dataNode).Name] = dataNode;
                        m_ProjectsOrder.Add(dataNode);
                    }
                    else if (dataNode is SolutionNode)
                    {
                        m_Solutions[((SolutionNode)dataNode).Name] = dataNode;
                    }
                    else if (dataNode is ProcessNode)
                    {
                        ProcessNode p = (ProcessNode)dataNode;
                        Kernel.Instance.ProcessFile(p, this);
                    }
                    else if (dataNode is DatabaseProjectNode)
                    {
                        m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode;
                    }
                }
            }
            finally
            {
                Kernel.Instance.CurrentWorkingDirectory.Pop();
            }
        }