示例#1
0
        //============================================================
        // <T>在方法节点的子节点中连接上方法的返回值节点
        //
        // @param node 返回值节点的父节点,即隶属于的方法节点
        // @param indextable 类型全名的索引表
        //============================================================
        private void ReturnNodeMaker(FXmlNode node, FClassesIndexTable indextable)
        {
            FXmlNode nodeRetrun = new FXmlNode("Return");

            if (this.ReturnType != "" && this.ReturnType != "void")
            {
                string strType = this.ReturnType;
                nodeRetrun.Set("type", this.ReturnType);
                FFileNode type = new FFileNode(this.ReturnType, GetUsing(_strLine));
                this.ReturnType = indextable.LookInMap(type, this.ReturnType);
                if (strType != this.ReturnType)
                {
                    nodeRetrun.Set("return_type", this.ReturnType);
                }
            }
            if (this.AnnotateReturn.Trim() != "")
            {
                nodeRetrun.Set("description", this.AnnotateReturn);
            }
            if (this.ReturnType.Trim() != "" && this.ReturnType.Trim() != "void")
            {
                node.Push(nodeRetrun);
            }
            FXmlNode resource = new FXmlNode("Source");

            resource.Text = MethodCode;
            node.Push(resource);
        }
示例#2
0
        //============================================================
        // <T>生成XML节点,并附加到父节点上。</T>
        //
        // @param nodeParent 属性节点的父节点
        // @param indextable 类型全名索引表
        // @param swPrint 用于打印警告的StreamWriter对象
        // @param file 警告所处在的文件
        // @param relative 被选取的文件夹的路径
        //============================================================
        public void XMLMaker(FXmlNode nodeParent, FClassesIndexTable indextable, StreamWriter swPrint, FileInfo file, string relative)
        {
            if (!IsProAnnoFine())
            {
                PrintAnnoWarning(swPrint, file, relative);
            }
            FXmlNode nodeProperty = new FXmlNode("Property");

            nodeProperty.Set("name", this.PropertyName);
            nodeProperty.Set("type", this.PropertyType);
            FFileNode type     = new FFileNode(this.PropertyType, GetUsing(_strLine));
            string    fulltype = indextable.LookInMap(type, this.PropertyType);

            if (fulltype != this.PropertyType)
            {
                nodeProperty.Set("full_name", fulltype);
            }
            if (this.AnnotateLable != "")
            {
                nodeProperty.Set("label", AnnotateLable);
            }
            if (this.AnnotateDescription != "")
            {
                nodeProperty.Set("description", AnnotateDescription);
            }
            nodeProperty.Set("access_level", AccessLevel);
            FXmlNode code = new FXmlNode("Source");

            code.Text = this.PropertyCode;
            nodeProperty.Push(code);
            nodeParent.Push(nodeProperty);
        }
示例#3
0
        //============================================================
        // <T>在Map表中查找在哦并返回查找到的值。</T>
        //
        // @param filenode 带查找节点信息
        // @param type 类型
        // @return 返回类型全名
        //============================================================
        public string LookInMap(FFileNode filenode, string type)
        {
            string fullClassString = string.Empty;
            string key             = filenode.ClassStr;

            if (_classesMap.Contains(key))
            {
                FArray <string> value = _classesMap[key];
                if (_classesMap.Contains(key) && value.Length == 1)
                {
                    fullClassString = value[0].ToString();
                    if (fullClassString != string.Empty)
                    {
                        return(fullClassString + "." + type);
                    }
                    else
                    {
                        return(type);
                    }
                }
                if (_classesMap.Contains(key) && value.Length > 1)
                {
                    fullClassString = GetCorrectNamespace(filenode.Usings, value);
                    if (fullClassString != string.Empty)
                    {
                        return(fullClassString + "." + type);
                    }
                    else
                    {
                        return(type);
                    }
                }
            }
            return(type);
        }
示例#4
0
        //============================================================
        // <T>在字段节点的子节点中连接上方法的返回值节点
        //
        // @param nodeParent 返回值节点的父节点,即隶属于的方法节点
        // @param indextable 类型全名的索引表
        // @param swPrint 用于打印警告的StreamWriter对象
        // @param file 警告所处在的文件
        // @param relative 被选取的文件夹的路径
        //============================================================
        public void XMLMaker(FXmlNode nodeParent, FClassesIndexTable indextable, StreamWriter swPrint, FileInfo file, string relative)
        {
            if (!IsFieldAnnoFine())
            {
                PrintAnnoWarning(swPrint, file, relative);
            }
            FXmlNode nodeField = new FXmlNode("Field");

            nodeField.Set("name", this.FieldName);
            nodeField.Set("full_name", this.FullName);
            nodeField.Set("access_level", this.AccessLevel);
            nodeField.Set("type", this.Type);
            FFileNode type     = new FFileNode(this.Type, GetUsing(_strLines));
            string    fulltype = indextable.LookInMap(type, this.Type);

            if (Type != this.Type)
            {
                nodeField.Set("return_type", fulltype);
            }
            if (Description != "")
            {
                nodeField.Set("description", Description);
            }
            nodeParent.Push(nodeField);
        }
示例#5
0
        //============================================================
        //<T>将类所继承的接口作为子节点连接到类的节点下面</T>
        // @param interface 接口的字符串组
        // @param nodeClass 要连接的父节点,也就是类的节点
        //============================================================
        public void MakeInterfaceNode(FArray <string> interfaces, FXmlNode nodeClass, FClassesIndexTable indextable)
        {
            if (interfaces == null || interfaces.Length < 1)
            {
                return;
            }
            FXmlNode nodeInterface = new FXmlNode("Inherts");

            foreach (string str in interfaces)
            {
                FXmlNode  inhert    = new FXmlNode("Inhert");
                string    inhertstr = str.Trim();
                FFileNode type      = new FFileNode(inhertstr, GetUsing(_strLine));
                inhertstr = indextable.LookInMap(type, inhertstr);
                inhert.Set("name", inhertstr.Trim());
                nodeInterface.Push(inhert);
            }
            nodeClass.Push(nodeInterface);
        }
示例#6
0
 //============================================================
 // <T>将属于参数的字符串对象传给参数对象后,解析参数。</T>
 //
 // @param param 属于参数的字符串。
 // @param stranno属于参数的注释内容
 // @param swPrint 用于打印警告的StreamWriter对象
 // @param file 警告所处在的文件
 // @param relative 被选取的文件夹的路径
 //============================================================
 public void ParserParam(string param, FStrings stranno, FClassesIndexTable indextable)
 {
     param = param.Trim();
     //int index=param.LastIndexOf(' ');
     //char[] c = param.ToArray<char>();
     string[] str = param.Trim().Split(new char[] { ' ' });
     if (str.Length > 1)
     {
         string paramtype = string.Empty, paramname = string.Empty;
         for (int n = 0; n < str.Length - 1; n++)
         {
             paramtype += str[n].ToString() + " ";
         }
         paramname           = str[str.Length - 1].ToString();
         this._parameterType = paramtype.Trim();
         FFileNode type = new FFileNode(_parameterType, GetUsing(_strLine));
         this._fulltype      = indextable.LookInMap(type, this._parameterType);
         this._parameterName = paramname.Trim();
     }
 }
示例#7
0
        //============================================================
        // <T>生成节点时,将此对象生成的节点连接到上层节点上</T>
        //
        // @param node 需要连接的父节点。
        // @param swPrint 用于打印警告的StreamWriter对象
        // @param file 警告所处在的文件
        // @param relative 被选取的文件夹的路径
        // @return 本对象生成的节点。
        //============================================================
        public FXmlNode XMLMaker(FXmlNode node, FClassesIndexTable indextable, StreamWriter swPrint, FileInfo file, string relative)
        {
            if (!IsClassAnnoFine())
            {
                PrintAnnoWarning(swPrint, file, relative);
            }
            FXmlNode classNode = new FXmlNode("Class");

            classNode.Set("name", this.ClassName);
            if (this.AccessLevel != "")
            {
                classNode.Set("access_level", this.AccessLevel);
            }
            if (this.Annotates != null && Annotates.Count > 0)
            {
                ParserClassAnnotate();
                if (Label.Trim() != "")
                {
                    classNode.Set("label", Label.Trim());
                }
                if (Description.Trim() != "")
                {
                    classNode.Set("description", Description.Trim());
                }
            }
            if (this.ParentsName != string.Empty)
            {
                FFileNode type = new FFileNode(this.ParentsName.Trim(), GetUsing(_strLine));
                this.ParentsName = indextable.LookInMap(type, this._parentName.Trim());
                classNode.Set("parent_class", ParentsName.Trim());
            }
            FXmlNode classCode = new FXmlNode("Source");

            classCode.Text = ClassCode;
            classNode.Push(classCode);
            node.Push(classNode);
            return(classNode);
        }