示例#1
0
文件: Extensions.cs 项目: codaxy/dox
        //---------------------------------------------------------------------------------------
        //------- docParaType Extension
        //---------------------------------------------------------------------------------------
        /// <summary>
        /// Create a Dox.Descritpion element from information in docParaType
        /// </summary>
        /// <param name="t">
        /// A <see cref="docParaType"/>
        /// </param>
        /// <param name="segmentList">
        /// A <see cref="List<Dox.DescriptionSegment>"/>
        /// </param>
        public static void GetDescriptionSegment(this docParaType t, List<Codaxy.Dox.DescriptionSegment> segmentList)
        {
            if (t.Text != null)
            foreach(var text in t.Text)
            {
                segmentList.Add(new Codaxy.Dox.DescriptionSegment()
                {
                    Text = text,
                    Type = Codaxy.Dox.DescriptionSegmentType.Text
                });
            }

            if (t.Items != null)
            foreach (var item in t.Items){

            if (item.GetType ().Equals (typeof(docHeadingType))) {
                segmentList.Add(new Codaxy.Dox.DescriptionSegment(){
                    Text = ((docHeadingType)item).Text[0],
                    Type = Codaxy.Dox.DescriptionSegmentType.Header
                });
            }

            if (item.GetType ().Equals (typeof(docRefTextType))) {
                segmentList.Add(new Codaxy.Dox.DescriptionSegment {
                    Text = ((docRefTextType)item).Text[0],
                    Ref = ((docRefTextType)item).Text[0], Type = Codaxy.Dox.DescriptionSegmentType.See
                });
            }

            if (item.GetType ().Equals (typeof(listingType))) {
                listingType type = ((listingType)item);
                var CodeSeg = new Codaxy.Dox.DescriptionSegment ();
                CodeSeg.Type = Codaxy.Dox.DescriptionSegmentType.Code;
                foreach (codelineType line in type.codeline) {
                    foreach (highlightType high in line.highlight) {
                        if (high.Text != null)
                        foreach (string text in high.Text) {
                            CodeSeg.Text += text + " ";
                        }
                    }
                }
                segmentList.Add(CodeSeg);
            }

            }
        }
示例#2
0
 public void AddChild(DescriptionSegment s)
 {
     if (Children == null)
         Children = new List<DescriptionSegment>();
     Children.Add(s);
 }