Ejemplo n.º 1
0
 string GetCurrentText()
 {
     if (_currentText == null && GetDocument() != null)
     {
         _currentText = _doc.Beautify().ToString();
     }
     return(_currentText);
 }
Ejemplo n.º 2
0
        public static string AddIds(string file)
        {
            XDocument doc = XDocument.Load(file);

            ScanDocument(doc);

            foreach (var node in doc.Descendants())
            {
                var    atrs        = node.Attributes().Where(a => a.Name.LocalName == "id").ToList();
                string elementName = node.Name.LocalName.ToString().Replace(".", "_");

                if (atrs.Count == 0)
                {
                    string attrId = MakeId(elementName);

                    node.SetAttributeValue("{http://schemas.android.com/apk/res/android}id", "@+id/" + attrId);
                }
            }
            return(doc.Beautify());
        }