Exemple #1
0
 static void AddXmlDocumentation(IXmlDocOutput output, XmlReader xml)
 {
     string lastElemName = string.Empty;
     bool isNewLine = true;
     while (xml.Read()) {
         if (xml.NodeType == XmlNodeType.Element) {
             string elname = xml.Name.ToLowerInvariant();
             if (!xml.IsEmptyElement)
                 lastElemName = elname;
             switch (elname) {
                 case "filterpriority":
                 case "remarks":
                     xml.Skip();
                     break;
                 case "example":
                     output.WriteNewLine();
                     output.Write("Example", TextTokenType.XmlDocToolTipExample);
                     output.Write(":", TextTokenType.XmlDocToolTipColon);
                     output.WriteNewLine();
                     isNewLine = true;
                     break;
                 case "exception":
                     output.WriteNewLine();
                     output.Write(GetCref(xml["cref"]), TextTokenType.XmlDocToolTipExceptionCref);
                     output.Write(":", TextTokenType.XmlDocToolTipColon);
                     output.WriteSpace();
                     isNewLine = false;
                     break;
                 case "returns":
                     output.WriteNewLine();
                     output.Write("Returns", TextTokenType.XmlDocToolTipReturns);
                     output.Write(":", TextTokenType.XmlDocToolTipColon);
                     output.WriteSpace();
                     isNewLine = false;
                     break;
                 case "see":
                     output.Write(GetCref(xml["cref"]), TextTokenType.XmlDocToolTipSeeCref);
                     output.Write((xml["langword"] ?? string.Empty).Trim(), TextTokenType.XmlDocToolTipSeeLangword);
                     isNewLine = false;
                     break;
                 case "seealso":
                     output.WriteNewLine();
                     output.Write("See also", TextTokenType.XmlDocToolTipSeeAlso);
                     output.Write(":", TextTokenType.XmlDocToolTipColon);
                     output.WriteSpace();
                     output.Write(GetCref(xml["cref"]), TextTokenType.XmlDocToolTipSeeAlsoCref);
                     isNewLine = false;
                     break;
                 case "paramref":
                     output.Write((xml["name"] ?? string.Empty).Trim(), TextTokenType.XmlDocToolTipParamRefName);
                     isNewLine = false;
                     break;
                 case "param":
                     output.WriteNewLine();
                     output.Write(whitespace.Replace((xml["name"] ?? string.Empty).Trim(), " "), TextTokenType.XmlDocToolTipParamName);
                     output.Write(":", TextTokenType.XmlDocToolTipColon);
                     output.WriteSpace();
                     isNewLine = false;
                     break;
                 case "typeparam":
                     output.WriteNewLine();
                     output.Write(whitespace.Replace((xml["name"] ?? string.Empty).Trim(), " "), TextTokenType.XmlDocToolTipTypeParamName);
                     output.Write(":", TextTokenType.XmlDocToolTipColon);
                     output.WriteSpace();
                     isNewLine = false;
                     break;
                 case "value":
                     output.WriteNewLine();
                     output.Write("Value", TextTokenType.XmlDocToolTipValue);
                     output.Write(":", TextTokenType.XmlDocToolTipColon);
                     output.WriteNewLine();
                     isNewLine = true;
                     break;
                 case "br":
                 case "para":
                     output.WriteNewLine();
                     isNewLine = true;
                     break;
                 default:
                     break;
             }
         } else if (xml.NodeType == XmlNodeType.Text) {
             var s = whitespace.Replace(xml.Value, " ");
             if (isNewLine)
                 s = s.TrimStart();
             output.Write(s, lastElemName == "summary" ? TextTokenType.XmlDocSummary : TextTokenType.XmlDocToolTipText);
             isNewLine = false;
         }
     }
 }
Exemple #2
0
        static void AddXmlDocumentation(IXmlDocOutput output, XmlReader xml)
        {
            string lastElemName = string.Empty;
            bool   isNewLine    = true;

            while (xml.Read())
            {
                if (xml.NodeType == XmlNodeType.Element)
                {
                    string elname = xml.Name.ToLowerInvariant();
                    if (!xml.IsEmptyElement)
                    {
                        lastElemName = elname;
                    }
                    switch (elname)
                    {
                    case "filterpriority":
                    case "remarks":
                        xml.Skip();
                        break;

                    case "example":
                        output.WriteNewLine();
                        output.Write("Example", TextTokenType.XmlDocToolTipExample);
                        output.Write(":", TextTokenType.XmlDocToolTipColon);
                        output.WriteNewLine();
                        isNewLine = true;
                        break;

                    case "exception":
                        output.WriteNewLine();
                        output.Write(GetCref(xml["cref"]), TextTokenType.XmlDocToolTipExceptionCref);
                        output.Write(":", TextTokenType.XmlDocToolTipColon);
                        output.WriteSpace();
                        isNewLine = false;
                        break;

                    case "returns":
                        output.WriteNewLine();
                        output.Write("Returns", TextTokenType.XmlDocToolTipReturns);
                        output.Write(":", TextTokenType.XmlDocToolTipColon);
                        output.WriteSpace();
                        isNewLine = false;
                        break;

                    case "see":
                        output.Write(GetCref(xml["cref"]), TextTokenType.XmlDocToolTipSeeCref);
                        output.Write((xml["langword"] ?? string.Empty).Trim(), TextTokenType.XmlDocToolTipSeeLangword);
                        isNewLine = false;
                        break;

                    case "seealso":
                        output.WriteNewLine();
                        output.Write("See also", TextTokenType.XmlDocToolTipSeeAlso);
                        output.Write(":", TextTokenType.XmlDocToolTipColon);
                        output.WriteSpace();
                        output.Write(GetCref(xml["cref"]), TextTokenType.XmlDocToolTipSeeAlsoCref);
                        isNewLine = false;
                        break;

                    case "paramref":
                        output.Write((xml["name"] ?? string.Empty).Trim(), TextTokenType.XmlDocToolTipParamRefName);
                        isNewLine = false;
                        break;

                    case "param":
                        output.WriteNewLine();
                        output.Write(whitespace.Replace((xml["name"] ?? string.Empty).Trim(), " "), TextTokenType.XmlDocToolTipParamName);
                        output.Write(":", TextTokenType.XmlDocToolTipColon);
                        output.WriteSpace();
                        isNewLine = false;
                        break;

                    case "typeparam":
                        output.WriteNewLine();
                        output.Write(whitespace.Replace((xml["name"] ?? string.Empty).Trim(), " "), TextTokenType.XmlDocToolTipTypeParamName);
                        output.Write(":", TextTokenType.XmlDocToolTipColon);
                        output.WriteSpace();
                        isNewLine = false;
                        break;

                    case "value":
                        output.WriteNewLine();
                        output.Write("Value", TextTokenType.XmlDocToolTipValue);
                        output.Write(":", TextTokenType.XmlDocToolTipColon);
                        output.WriteNewLine();
                        isNewLine = true;
                        break;

                    case "br":
                    case "para":
                        output.WriteNewLine();
                        isNewLine = true;
                        break;

                    default:
                        break;
                    }
                }
                else if (xml.NodeType == XmlNodeType.Text)
                {
                    var s = whitespace.Replace(xml.Value, " ");
                    if (isNewLine)
                    {
                        s = s.TrimStart();
                    }
                    output.Write(s, lastElemName == "summary" ? TextTokenType.XmlDocSummary : TextTokenType.XmlDocToolTipText);
                    isNewLine = false;
                }
            }
        }
Exemple #3
0
        static void AddXmlDocumentation(IXmlDocOutput output, XmlReader xml)
        {
            bool isNewLine = true;

            while (xml.Read())
            {
                if (xml.NodeType == XmlNodeType.Element)
                {
                    string elname = xml.Name.ToLowerInvariant();
                    switch (elname)
                    {
                    case "filterpriority":
                    case "remarks":
                        xml.Skip();
                        break;

                    case "example":
                        output.WriteNewLine();
                        output.Write("Example", BoxedTextColor.XmlDocToolTipHeader);
                        output.Write(":", BoxedTextColor.Text);
                        output.WriteNewLine();
                        isNewLine = true;
                        break;

                    case "exception":
                        output.WriteNewLine();
                        output.Write(GetCref(xml["cref"]), BoxedTextColor.XmlDocToolTipHeader);
                        output.Write(":", BoxedTextColor.Text);
                        output.WriteSpace();
                        isNewLine = false;
                        break;

                    case "returns":
                        output.WriteNewLine();
                        output.Write("Returns", BoxedTextColor.XmlDocToolTipHeader);
                        output.Write(":", BoxedTextColor.Text);
                        output.WriteSpace();
                        isNewLine = false;
                        break;

                    case "see":
                        output.Write(GetCref(xml["cref"]), BoxedTextColor.Text);
                        output.Write((xml["langword"] ?? string.Empty).Trim(), BoxedTextColor.Keyword);
                        isNewLine = false;
                        break;

                    case "seealso":
                        output.WriteNewLine();
                        output.Write("See also", BoxedTextColor.XmlDocToolTipHeader);
                        output.Write(":", BoxedTextColor.Text);
                        output.WriteSpace();
                        output.Write(GetCref(xml["cref"]), BoxedTextColor.Text);
                        isNewLine = false;
                        break;

                    case "paramref":
                        output.Write((xml["name"] ?? string.Empty).Trim(), BoxedTextColor.Parameter);
                        isNewLine = false;
                        break;

                    case "param":
                        output.WriteNewLine();
                        output.Write(whitespace.Replace((xml["name"] ?? string.Empty).Trim(), " "), BoxedTextColor.Parameter);
                        output.Write(":", BoxedTextColor.Text);
                        output.WriteSpace();
                        isNewLine = false;
                        break;

                    case "typeparam":
                        output.WriteNewLine();
                        output.Write(whitespace.Replace((xml["name"] ?? string.Empty).Trim(), " "), BoxedTextColor.TypeGenericParameter);
                        output.Write(":", BoxedTextColor.Text);
                        output.WriteSpace();
                        isNewLine = false;
                        break;

                    case "value":
                        output.WriteNewLine();
                        output.Write("Value", BoxedTextColor.Keyword);
                        output.Write(":", BoxedTextColor.Text);
                        output.WriteNewLine();
                        isNewLine = true;
                        break;

                    case "br":
                    case "para":
                        output.WriteNewLine();
                        isNewLine = true;
                        break;

                    default:
                        break;
                    }
                }
                else if (xml.NodeType == XmlNodeType.Text)
                {
                    var s = whitespace.Replace(xml.Value, " ");
                    if (isNewLine)
                    {
                        s = s.TrimStart();
                    }
                    output.Write(s, BoxedTextColor.Text);
                    isNewLine = false;
                }
            }
        }
Exemple #4
0
		static void AddXmlDocumentation(IXmlDocOutput output, XmlReader xml) {
			bool isNewLine = true;
			while (xml.Read()) {
				if (xml.NodeType == XmlNodeType.Element) {
					string elname = xml.Name.ToLowerInvariant();
					switch (elname) {
					case "filterpriority":
					case "remarks":
						xml.Skip();
						break;
					case "example":
						output.WriteNewLine();
						output.Write("Example", BoxedTextColor.XmlDocToolTipHeader);
						output.Write(":", BoxedTextColor.Text);
						output.WriteNewLine();
						isNewLine = true;
						break;
					case "exception":
						output.WriteNewLine();
						output.Write(GetCref(xml["cref"]), BoxedTextColor.XmlDocToolTipHeader);
						output.Write(":", BoxedTextColor.Text);
						output.WriteSpace();
						isNewLine = false;
						break;
					case "returns":
						output.WriteNewLine();
						output.Write("Returns", BoxedTextColor.XmlDocToolTipHeader);
						output.Write(":", BoxedTextColor.Text);
						output.WriteSpace();
						isNewLine = false;
						break;
					case "see":
						output.Write(GetCref(xml["cref"]), BoxedTextColor.Text);
						output.Write((xml["langword"] ?? string.Empty).Trim(), BoxedTextColor.Keyword);
						isNewLine = false;
						break;
					case "seealso":
						output.WriteNewLine();
						output.Write("See also", BoxedTextColor.XmlDocToolTipHeader);
						output.Write(":", BoxedTextColor.Text);
						output.WriteSpace();
						output.Write(GetCref(xml["cref"]), BoxedTextColor.Text);
						isNewLine = false;
						break;
					case "paramref":
						output.Write((xml["name"] ?? string.Empty).Trim(), BoxedTextColor.Parameter);
						isNewLine = false;
						break;
					case "param":
						output.WriteNewLine();
						output.Write(whitespace.Replace((xml["name"] ?? string.Empty).Trim(), " "), BoxedTextColor.Parameter);
						output.Write(":", BoxedTextColor.Text);
						output.WriteSpace();
						isNewLine = false;
						break;
					case "typeparam":
						output.WriteNewLine();
						output.Write(whitespace.Replace((xml["name"] ?? string.Empty).Trim(), " "), BoxedTextColor.TypeGenericParameter);
						output.Write(":", BoxedTextColor.Text);
						output.WriteSpace();
						isNewLine = false;
						break;
					case "value":
						output.WriteNewLine();
						output.Write("Value", BoxedTextColor.Keyword);
						output.Write(":", BoxedTextColor.Text);
						output.WriteNewLine();
						isNewLine = true;
						break;
					case "br":
					case "para":
						output.WriteNewLine();
						isNewLine = true;
						break;
					default:
						break;
					}
				}
				else if (xml.NodeType == XmlNodeType.Text) {
					var s = whitespace.Replace(xml.Value, " ");
					if (isNewLine)
						s = s.TrimStart();
					output.Write(s, BoxedTextColor.Text);
					isNewLine = false;
				}
			}
		}