Exemplo n.º 1
0
        /// <summary>
        /// loads all *.xxgen and *.zeus into templates<ZeusTemplateHeader>[]
        /// updates IdPathHash<TemplateID,filename>
        ///
        /// used by "Zeus Templates by Namespace"
        /// </summary>
        private void _buildChildren(DirectoryInfo rootInfo, ArrayList templates)
        {
            ZeusTemplateHeader template;

            foreach (DirectoryInfo dirInfo in rootInfo.GetDirectories())
            {
                if (dirInfo.Attributes != (FileAttributes.System | dirInfo.Attributes))
                {
                    this._buildChildren(dirInfo, templates);                     // recurse into subdirectories
                }
            }

            foreach (FileInfo fileInfo in rootInfo.GetFiles())
            {
                if (IsTemplateFile(fileInfo))
                {
                    string filename = fileInfo.FullName;

                    if (!templates.Contains(filename))
                    {
                        try
                        {
                            template = ZeusTemplateParser.LoadTemplateHeader(filename);
                            IdPathHash.Add(template.UniqueID.ToUpper(), template.FilePath + template.FileName);
                        }
                        catch
                        {
                            continue;
                        }

                        templates.Add(template);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void _buildChildren(SortedTreeNode rootNode, DirectoryInfo rootInfo)
        {
            ZeusTemplateHeader template;

            foreach (DirectoryInfo dirInfo in rootInfo.GetDirectories())
            {
                if (dirInfo.Attributes != (FileAttributes.System | dirInfo.Attributes))
                {
                    FolderTreeNode node = new FolderTreeNode(dirInfo.Name);
                    rootNode.AddSorted(node);

                    this._buildChildren(node, dirInfo);
                }
            }

            foreach (FileInfo fileInfo in rootInfo.GetFiles())
            {
                if (IsTemplateFile(fileInfo))
                {
                    string filename = fileInfo.FullName;

                    try
                    {
                        template = ZeusTemplateParser.LoadTemplateHeader(filename);
                        IdPathHash.Add(template.UniqueID.ToUpper(), template.FilePath + template.FileName);
                    }
                    catch
                    {
                        continue;
                    }

                    TemplateTreeNode node = new TemplateTreeNode(template, true);
                    rootNode.AddSorted(node);
                }
            }
        }