示例#1
0
        public static bool DoesNotHaveApiStyle(this XmlElement element, ApiStyle style)
        {
            string styleString   = style.ToString().ToLowerInvariant();
            string apistylevalue = element.GetAttribute("apistyle");

            return(apistylevalue != styleString || string.IsNullOrWhiteSpace(apistylevalue));
        }
示例#2
0
 /// <param name="ns">The namespace that is being dropped.</param>
 /// <param name="style">The style that is being dropped.</param>
 /// <param name="frameworkName">Name of the framework, which should be used to filter out any other API</param>
 public MDocFileSource(string ns, ApiStyle style, string frameworkName)
 {
     droppedNamespace    = ns;
     shouldDropNamespace = !string.IsNullOrWhiteSpace(ns);
     styleToDrop         = style;
     framework           = frameworkName;
 }
示例#3
0
        public static void RemoveApiStyle(this XmlNode node, ApiStyle style)
        {
            var styleAttribute = node.Attributes["apistyle"];

            if (styleAttribute != null && styleAttribute.Value == style.ToString().ToLowerInvariant())
            {
                node.Attributes.Remove(styleAttribute);
            }
        }
示例#4
0
        public static void RemoveApiStyle(this XmlElement element, ApiStyle style)
        {
            string styleString   = style.ToString().ToLowerInvariant();
            string existingValue = element.GetAttribute("apistyle");

            if (string.IsNullOrWhiteSpace(existingValue) || existingValue == styleString)
            {
                element.RemoveAttribute("apistyle");
            }
        }
示例#5
0
        public static void AddApiStyle(this XmlNode node, ApiStyle style)
        {
            string styleString       = style.ToString().ToLowerInvariant();
            var    existingAttribute = node.Attributes["apistyle"];

            if (existingAttribute == null)
            {
                existingAttribute = node.OwnerDocument.CreateAttribute("apistyle");
                node.Attributes.Append(existingAttribute);
            }
            existingAttribute.Value = styleString;
        }
示例#6
0
        public static void AddApiStyle(this XmlElement element, ApiStyle style)
        {
            string styleString   = style.ToString().ToLowerInvariant();
            var    existingValue = element.GetAttribute("apistyle");

            if (string.IsNullOrWhiteSpace(existingValue) || existingValue != styleString)
            {
                element.SetAttribute("apistyle", styleString);
            }

            // Propagate the API style up to the membernode if necessary
            if (element.LocalName == "AssemblyInfo" && element.ParentNode != null && element.ParentNode.LocalName == "Member")
            {
                var member = element.ParentNode;
                var unifiedAssemblyNode = member.SelectSingleNode("AssemblyInfo[@apistyle='unified']");
                var classicAssemblyNode = member.SelectSingleNode("AssemblyInfo[not(@apistyle) or @apistyle='classic']");

                var    parentAttribute = element.ParentNode.Attributes["apistyle"];
                Action removeStyle     = () => element.ParentNode.Attributes.Remove(parentAttribute);
                Action propagateStyle  = () =>
                {
                    if (parentAttribute == null)
                    {
                        // if it doesn't have the attribute, then add it
                        parentAttribute       = element.OwnerDocument.CreateAttribute("apistyle");
                        parentAttribute.Value = styleString;
                        element.ParentNode.Attributes.Append(parentAttribute);
                    }
                };

                if ((style == ApiStyle.Classic && unifiedAssemblyNode != null) || (style == ApiStyle.Unified && classicAssemblyNode != null))
                {
                    removeStyle();
                }
                else
                {
                    propagateStyle();
                }
            }
        }
示例#7
0
        public static bool HasApiStyle(this XmlNode node, ApiStyle style)
        {
            var attribute = node.Attributes["apistyle"];

            return(attribute != null && attribute.Value == style.ToString().ToLowerInvariant());
        }
示例#8
0
        public static bool HasApiStyle(this XmlElement element, ApiStyle style)
        {
            string styleString = style.ToString().ToLowerInvariant();

            return(element.GetAttribute("apistyle") == styleString);
        }
示例#9
0
文件: assembler.cs 项目: nobled/mono
		/// <param name="ns">The namespace that is being dropped.</param>
		/// <param name="style">The style that is being dropped.</param>
		public MDocFileSource(string ns, ApiStyle style) 
		{
			droppedNamespace = ns;
			shouldDropNamespace = !string.IsNullOrWhiteSpace (ns);
			styleToDrop = style;
		}