예제 #1
0
        public bool Contains(AndroidManifestNode node)
        {
            var parentNode = _xmlDocument.FindNodeRecursive(new ByName(node.ParentName));

            if (parentNode != null)
            {
                var xmlNode = parentNode.FindNodeInChildren(new ByAllAttributes(node));
                return(xmlNode != null);
            }
            return(false);
        }
예제 #2
0
        public void Add(AndroidManifestNode node)
        {
            var parentNode = _xmlDocument.FindNodeRecursive(new ByName(node.ParentName));

            if (parentNode != null)
            {
                parentNode.AddAndroidManifestNode(_xmlDocument, node);
            }
            else
            {
                throw new Exception("GetSocial: Failed to modify AndroidManifest.xml. Can't find node " + node.ParentName);
            }
        }
예제 #3
0
        public void RemoveSimilar(AndroidManifestNode node)
        {
            var parentNode = _xmlDocument.FindNodeRecursive(new ByName(node.ParentName));

            if (parentNode != null)
            {
                var xmlNode = parentNode.FindNodeInChildren(new ByNameAttrribute(node));
                if (xmlNode != null)
                {
                    parentNode.RemoveChild(xmlNode);
                }
            }
        }
예제 #4
0
 public ByAllAttributes(AndroidManifestNode node)
 {
     _node = node;
 }
예제 #5
0
 public ByNameAttrribute(AndroidManifestNode node)
 {
     _node = node;
 }
예제 #6
0
 public void AddChild(AndroidManifestNode childNode)
 {
     ChildNodes.Add(childNode);
 }
예제 #7
0
        public static void AddAndroidManifestNode(this XmlNode root, XmlDocument xmlDocument, AndroidManifestNode node)
        {
            var xmlElement = xmlDocument.CreateElement(node.Name);

            foreach (var attribute in node.Attributes)
            {
                var split  = attribute.Key.Split(':');
                var prefix = split[0];
                var name   = split[1];

                var xmlNamespace = xmlDocument.FindNodeInChildren(new ByName(AndroidManifestNode.ManifestTag)).GetNamespaceOfPrefix(prefix);

                xmlElement.SetAttribute(name, xmlNamespace, attribute.Value);
            }
            ;

            node.ChildNodes.ForEach(childNode => xmlElement.AddAndroidManifestNode(xmlDocument, childNode));

            // always add our elements on top
            root.InsertAt(xmlElement, 0);
        }