Ejemplo n.º 1
0
        /// <summary>
        /// Функция рекурсивно анализирует все VHDL файлы библиотеки
        /// </summary>
        /// <param name="path"></param>
        private void AnalyzeFolder(string path)
        {
            logger.WriteLineFormat("Analyzing folder {0}", path);
            string LibraryName = Path.GetFileNameWithoutExtension(path);

            if (Directory.Exists(path) == true)
            {
                string[] dirs = Directory.GetDirectories(path);
                foreach (string dir in dirs)
                {
                    AnalyzeFolder(dir);
                }

                string[] files = Directory.GetFiles(path);
                foreach (string file in files)
                {
                    if (isVHDLCodeFile(file) == true)
                    {
                        logger.WriteLineFormat("Added file for analyze {0}", file);
                        LibraryFileInfo inf = LibraryFileInfo.AnalyzeFile(file, LibraryName);
                        if (inf != null)
                        {
                            libraryFiles.Add(inf);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Загрузка списка библиотек с XML файла
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static List <LibraryInfo> LoadLibraries(Logger logger, string path)
        {
            logger.WriteLineFormat("Loading compiled libraries from file {0}", path);
            List <LibraryInfo> res = new List <LibraryInfo>();

            XmlDocument _doc = new XmlDocument();

            _doc.Load(path);
            XmlNodeList nodes = _doc.SelectNodes("/Libraries/Library");

            foreach (XmlNode node in nodes)
            {
                string      LibraryName = node.Attributes["LibraryName"].Value;
                LibraryInfo inf         = new LibraryInfo(LibraryName);
                res.Add(inf);
                foreach (XmlNode package in node.ChildNodes)
                {
                    string PackageName        = package.Attributes["Name"].Value;
                    string DeclarationPath    = package.Attributes["DeclarationPath"].Value;
                    string BodyPath           = package.Attributes["BodyPath"].Value;
                    string DeclarationLibPath = package.Attributes["DeclarationLibPath"].Value;
                    string BodyLibPath        = package.Attributes["BodyLibPath"].Value;

                    PackageInfo pi = new PackageInfo(PackageName, LibraryName, DeclarationPath, BodyPath, DeclarationLibPath, BodyLibPath);
                    inf.packages.Add(pi);

                    logger.WriteLine("----------------------------------");
                    logger.WriteLineFormat("PackageName: {0}", PackageName);
                    logger.WriteLineFormat("DeclarationPath: {0}", DeclarationPath);
                    logger.WriteLineFormat("BodyPath: {0}", BodyPath);
                    logger.WriteLineFormat("DeclarationLibPath: {0}", DeclarationLibPath);
                    logger.WriteLineFormat("BodyLibPath: {0}", BodyLibPath);
                    logger.WriteLine("----------------------------------");
                }
                inf.UpdateLibraryScope();
            }

            return(res);
        }