Exemplo n.º 1
0
        //============================================================
        // <T>建立输出XML文件的根节点。</T>
        //
        // @param package 当前类所在包的包对象
        // @return 包含包对象的根节点
        //============================================================
        public FXmlNode RootPackageNode(FAsPackage package)
        {
            FXmlDocument doc       = new FXmlDocument();
            FXmlNode     config    = doc.Root;
            FXmlNode     nodeSpace = package.XMLMaker(config);

            return(nodeSpace);
        }
Exemplo n.º 2
0
        //============================================================
        // <T>解析类。</T>
        //
        // @param indextable 类全名的索引表
        // @param path 解析结果的输出路径
        // @param swPrint 用于打印警告结果的StreamWriter对象
        // @param relative 当前解析文件所在的目录的路径
        // @param package 类所在包的包对象
        // @param file 当前解析的文件
        //============================================================
        public void ParserClass(FAsClassesIndexTable indextable, FAsPackage package, string path, StreamWriter swPrint, FileInfo file, string relative)
        {
            FXmlDocument doc         = new FXmlDocument();
            FXmlNode     config      = doc.Root;
            FXmlNode     nodePackage = package.XMLMaker(config);
            FXmlNode     xmlClass    = XMLMaker(nodePackage, indextable);

            MakeInterfaceNode(xmlClass, indextable);
            FXmlNode methods    = new FXmlNode("Methods");
            FXmlNode fields     = new FXmlNode("Fields");
            FXmlNode properties = new FXmlNode("Properties");

            xmlClass.Push(fields);
            xmlClass.Push(properties);
            xmlClass.Push(methods);
            //判断并得到段落注释的行号区间
            int start, end = CheckParaAnnotate(_strLine, _startIndex, out start);

            for (int n = _startIndex; n < _endIndex; n++)
            {
                //如果在区间中则推出当前循环继续执行
                if (IsInInterregional(n, start, end))
                {
                    continue;
                }
                if (FAsField.IsField(_strLine, n))
                {
                    FAsField field = new FAsField(_strLine, n);
                    field.Parser(fields, indextable, swPrint, file, relative);
                }
                if (FAsProperty.IsProperty(_strLine, n))
                {
                    int         endindex = GetPairNum(_strLine, n);
                    FAsProperty property = new FAsProperty(_strLine, n, endindex);
                    property.ParserPorperty(properties, indextable, swPrint, file, relative);
                }
                if (FAsMethod.IsMethod(_strLine, n))
                {
                    int       methodEnd = GetPairNum(_strLine, n);
                    FAsMethod asMethod  = new FAsMethod(_strLine, n, methodEnd);
                    asMethod.ParserMethod(methods, indextable, swPrint, file, relative);
                    this.Method.Add(asMethod);
                }
            }
            SaveXMLFile(doc, path);
        }