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); }
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); } }
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); } } }
public ByAllAttributes(AndroidManifestNode node) { _node = node; }
public ByNameAttrribute(AndroidManifestNode node) { _node = node; }
public void AddChild(AndroidManifestNode childNode) { ChildNodes.Add(childNode); }
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); }