public void AddNode(BaseManifestNode node, IFindCriteria <XmlNode> parentNodeCriteria)
        {
            var parentNode = xmlDocument.FindNodeRecursive(parentNodeCriteria);

            if (parentNode != null)
            {
                parentNode.AddAndroidManifestNode(xmlDocument, node);
            }
            else
            {
                Debug.LogError("Failed to add new node to AndroidManifest.xml since no specified parent node found");
            }
        }
        public static void AddAndroidManifestNode(this XmlNode root, XmlDocument xmlDocument, BaseManifestNode node)
        {
            var xmlElement = xmlDocument.CreateElement(node.Tag);

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

                var manifest = xmlDocument.FindNodeInChildren(new FindByTag(AndroidManifestConstants.ManifestTag));

                if (manifest != null)
                {
                    var xmlNamespace = manifest.GetNamespaceOfPrefix(prefix);
                    xmlElement.SetAttribute(name, xmlNamespace, attribute.Value);
                }
            }

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

            root.InsertAt(xmlElement, 0);
        }
Example #3
0
 public FindByLabel(BaseManifestNode node)
 {
     this.node = node;
 }
Example #4
0
 public FindByChildName(string tag, BaseManifestNode childNode)
 {
     this.tag       = tag;
     this.childNode = childNode;
 }
Example #5
0
 public FindByName(BaseManifestNode node)
 {
     this.node = node;
 }
 public void AddChildNode(BaseManifestNode childNode)
 {
     ChildNodes.Add(childNode);
 }