コード例 #1
0
ファイル: Project.cs プロジェクト: uQr/Visual-NHibernate
        private void ProcessFolderNode(XmlNode folderNode, IFolder parentFolder, string outputName)
        {
            #region Process sub-folders
            XmlNodeList subFolderNodes	= folderNode.SelectNodes("folder");
                ArrayList actualSubFolders = new ArrayList();

                for (int i = 0; i < subFolderNodes.Count; i++)
                {
                    XmlNode subFolderNode = subFolderNodes[i];

                    // Only process if the correct output
                    if (HasDesiredOutput(subFolderNode, outputName))
                    {
                        Folder tempFolder = new Folder();
                        tempFolder.Name = subFolderNode.Attributes["name"].Value;
                        ProcessFolderNode(subFolderNode, tempFolder, outputName);
                        actualSubFolders.Add(tempFolder);
                    }
                }
                Folder[] subFolders = (Folder[])actualSubFolders.ToArray(typeof(Folder));
                #endregion

                #region Process scripts
                XmlNodeList scriptNodes = folderNode.SelectNodes("script");
                ArrayList actualScripts = new ArrayList();

                for (int i = 0; i < scriptNodes.Count; i++)
                {
                    XmlNode scriptNode = scriptNodes[i];

                    // Only process if the correct output
                    if (HasDesiredOutput(scriptNode, outputName))
                    {
                        Script tempScript = new Script();
                        tempScript.FileName = scriptNode.Attributes["filename"].Value;
                        tempScript.ScriptName = scriptNode.Attributes["scriptname"].Value;
                        tempScript.IteratorName = scriptNode.Attributes["iteratorname"].Value;
                        actualScripts.Add(tempScript);
                    }
                }
                Script[] scripts = (Script[])actualScripts.ToArray(typeof(Script));
                #endregion

                #region Process files
                XmlNodeList fileNodes = folderNode.SelectNodes("file");
                ArrayList actualFiles = new ArrayList();

                for (int i = 0; i < fileNodes.Count; i++)
                {
                    XmlNode fileNode = fileNodes[i];

                    // Only process if the correct output
                    if (HasDesiredOutput(fileNode, outputName))
                    {
                        File tempFile = new File();
                        tempFile.Name = fileNode.Attributes["name"].Value;
                        actualFiles.Add(tempFile);
                    }
                }
                File[] files = (File[])actualFiles.ToArray(typeof(File));
                #endregion

            parentFolder.Files = files;
            parentFolder.SubFolders = subFolders;
            parentFolder.Scripts = scripts;
        }
コード例 #2
0
ファイル: Project.cs プロジェクト: windygu/Visual-NHibernate
        private void ProcessFolderNode(XmlNode folderNode, IFolder parentFolder, string outputName)
        {
            #region Process sub-folders
            XmlNodeList subFolderNodes   = folderNode.SelectNodes("folder");
            ArrayList   actualSubFolders = new ArrayList();

            for (int i = 0; i < subFolderNodes.Count; i++)
            {
                XmlNode subFolderNode = subFolderNodes[i];

                // Only process if the correct output
                if (HasDesiredOutput(subFolderNode, outputName))
                {
                    Folder tempFolder = new Folder();
                    tempFolder.Name = subFolderNode.Attributes["name"].Value;
                    ProcessFolderNode(subFolderNode, tempFolder, outputName);
                    actualSubFolders.Add(tempFolder);
                }
            }
            Folder[] subFolders = (Folder[])actualSubFolders.ToArray(typeof(Folder));
            #endregion

            #region Process scripts
            XmlNodeList scriptNodes   = folderNode.SelectNodes("script");
            ArrayList   actualScripts = new ArrayList();

            for (int i = 0; i < scriptNodes.Count; i++)
            {
                XmlNode scriptNode = scriptNodes[i];

                // Only process if the correct output
                if (HasDesiredOutput(scriptNode, outputName))
                {
                    Script tempScript = new Script();
                    tempScript.FileName     = scriptNode.Attributes["filename"].Value;
                    tempScript.ScriptName   = scriptNode.Attributes["scriptname"].Value;
                    tempScript.IteratorName = scriptNode.Attributes["iteratorname"].Value;
                    actualScripts.Add(tempScript);
                }
            }
            Script[] scripts = (Script[])actualScripts.ToArray(typeof(Script));
            #endregion

            #region Process files
            XmlNodeList fileNodes   = folderNode.SelectNodes("file");
            ArrayList   actualFiles = new ArrayList();

            for (int i = 0; i < fileNodes.Count; i++)
            {
                XmlNode fileNode = fileNodes[i];

                // Only process if the correct output
                if (HasDesiredOutput(fileNode, outputName))
                {
                    File tempFile = new File();
                    tempFile.Name = fileNode.Attributes["name"].Value;
                    actualFiles.Add(tempFile);
                }
            }
            File[] files = (File[])actualFiles.ToArray(typeof(File));
            #endregion

            parentFolder.Files      = files;
            parentFolder.SubFolders = subFolders;
            parentFolder.Scripts    = scripts;
        }