Exemplo n.º 1
0
        public void Set(string name, string parameterName, string doc)
        {
            if (name.StartsWith("param") && name.Length > "param".Length)
            {
                parameterName = ((IMember)member).Parameters[int.Parse(name.Substring("param".Length))].Name;
                name          = "param";
            }
            Section newSection = new Section(name);

            if (parameterName != null)
            {
                newSection.SetAttribute(name == "exception" ? "cref" : "name", parameterName);
            }

            newSection.Documentation = doc;

            for (int i = 0; i < sections.Count; i++)
            {
                if (sections[i].Name == name)
                {
                    if (!string.IsNullOrEmpty(parameterName) && !sections[i].Attributes.Any(a => a.Value == parameterName))
                    {
                        continue;
                    }
                    sections[i] = newSection;
                    return;
                }
            }

            sections.Add(newSection);
        }
Exemplo n.º 2
0
        public void Set(string name, string parameterName, string doc)
        {
            if (name.StartsWith("param", StringComparison.Ordinal) && name.Length > "param".Length)
            {
                var parameters = member.GetParameters();
                var idx        = int.Parse(name.Substring("param".Length));
                parameterName = idx < parameters.Length ? parameters [idx].Name : "unknown";
                name          = "param";
            }
            Section newSection = new Section(name);

            if (parameterName != null)
            {
                newSection.SetAttribute(name == "exception" ? "cref" : "name", parameterName);
            }

            newSection.Documentation = doc;

            for (int i = 0; i < sections.Count; i++)
            {
                if (sections[i].Name == name)
                {
                    if (!string.IsNullOrEmpty(parameterName) && !sections[i].Attributes.Any(a => a.Value == parameterName))
                    {
                        continue;
                    }
                    sections[i] = newSection;
                    return;
                }
            }

            sections.Add(newSection);
        }
Exemplo n.º 3
0
        void FillDocumentation(string xmlDoc)
        {
            if (string.IsNullOrEmpty(xmlDoc))
            {
                return;
            }
            StringBuilder sb = new StringBuilder();

            sb.Append("<root>");
            bool wasWs = false;

            foreach (char ch in xmlDoc)
            {
                if (ch == '\r')
                {
                    continue;
                }
                if (ch == ' ' || ch == '\t')
                {
                    if (!wasWs)
                    {
                        sb.Append(' ');
                    }
                    wasWs = true;
                    continue;
                }
                wasWs = false;
                sb.Append(ch);
            }
            sb.Append("</root>");
            try {
                using (var reader = XmlTextReader.Create(new System.IO.StringReader(sb.ToString()))) {
                    while (reader.Read())
                    {
                        if (reader.NodeType != XmlNodeType.Element)
                        {
                            continue;
                        }
                        if (reader.LocalName == "root")
                        {
                            continue;
                        }
                        Section readSection = new Section(reader.LocalName);
                        if (reader.MoveToFirstAttribute())
                        {
                            do
                            {
                                readSection.SetAttribute(reader.LocalName, reader.Value);
                            } while (reader.MoveToNextAttribute());
                        }
                        readSection.Documentation = reader.ReadElementString().Trim();
                        sections.Add(readSection);
                    }
                }
            } catch (Exception e) {
                LoggingService.LogError("Error while filling documentation", e);
            }
        }
		public void Set (string name, string parameterName, string doc)
		{
			if (name.StartsWith ("param") && name.Length > "param".Length) {
				parameterName = ((IParameterizedMember)member).Parameters[int.Parse (name.Substring("param".Length))].Name;
				name = "param";
			}
			Section newSection = new Section (name);
			
			if (parameterName != null)
				newSection.SetAttribute (name == "exception" ? "cref" : "name", parameterName);
			
			newSection.Documentation = doc;
			
			for (int i = 0; i < sections.Count; i++) {
				if (sections[i].Name == name) {
					if (!string.IsNullOrEmpty (parameterName) && !sections[i].Attributes.Any (a => a.Value == parameterName))
						continue;
					sections[i] = newSection;
					return;
				}
			}
			
			sections.Add (newSection);
		}
		void FillDocumentation (string xmlDoc)
		{
			if (string.IsNullOrEmpty (xmlDoc))
				return;
			StringBuilder sb = new StringBuilder ();
			sb.Append ("<root>");
			bool wasWs = false;
			foreach (char ch in xmlDoc) {
				if (ch =='\r')
					continue;
				if (ch == ' ' || ch == '\t') {
					if (!wasWs)
						sb.Append (' ');
					wasWs = true;
					continue;
				}
				wasWs = false;
				sb.Append (ch);
			}
			sb.Append ("</root>");
			try {
				using (var reader = XmlTextReader.Create (new System.IO.StringReader (sb.ToString ()))) {
					while (reader.Read ()) {
						if (reader.NodeType != XmlNodeType.Element)
							continue;
						if (reader.LocalName == "root") {
							continue;
						}
						Section readSection = new Section (reader.LocalName);
						if (reader.MoveToFirstAttribute ()) {
							do {
								readSection.SetAttribute (reader.LocalName, reader.Value);
							} while (reader.MoveToNextAttribute ());
						}
						readSection.Documentation = reader.ReadElementString ().Trim ();
						sections.Add (readSection);
					}
				}
			} catch (Exception e) {
				LoggingService.LogError ("Error while filling documentation", e);
			}
		}
Exemplo n.º 6
0
		public void Set (string name, string parameterName, string doc)
		{
			if (name.StartsWith ("param", StringComparison.Ordinal) && name.Length > "param".Length) {
				var parameters = member.GetParameters ();
				var idx = int.Parse (name.Substring ("param".Length));
				parameterName = idx < parameters.Length ? parameters [idx].Name : "unknown";
				name = "param";
			}
			Section newSection = new Section (name);
			
			if (parameterName != null)
				newSection.SetAttribute (name == "exception" ? "cref" : "name", parameterName);
			
			newSection.Documentation = doc;
			
			for (int i = 0; i < sections.Count; i++) {
				if (sections[i].Name == name) {
					if (!string.IsNullOrEmpty (parameterName) && !sections[i].Attributes.Any (a => a.Value == parameterName))
						continue;
					sections[i] = newSection;
					return;
				}
			}
			
			sections.Add (newSection);
		}