Esempio n. 1
0
 public static String Get(DslElement This, String Name, String Moniker)
 {
     try
     {
         return This.SelectSingleNode("p:" + Name).SelectSingleNode("p:" + Moniker, This.OwnerDocument.Manager).Attributes["Name"].Value;
     }
     catch (NullReferenceException)
     {
         return null;
     }
 }
Esempio n. 2
0
 public static void Set(DslElement This, String Name, String Moniker, String Value)
 {
     if (Value == null)
     {
         XmlNode node = This.SelectSingleNode("p:" + Name);
         if (node != null) This.Xml.RemoveChild(node);
     }
     else
     {
         XmlElement node = This.GetChildNode(Name + "/" + Moniker) as XmlElement;
         node.SetAttribute("Name", Value);
     }
 }
Esempio n. 3
0
 public DslElement Add(DslElement Node)
 {
     RootNode.AppendChild(Node.Xml);
     return Node;
 }
Esempio n. 4
0
 public void RemoveLinked(DslElement Node)
 {
     if (Node.Xml.HasAttribute("Name"))
     {
         MonikersCollection dcms = new MonikersCollection(Node.OwnerDocument, Node.Xml.Name);
         foreach (DslElement el in dcms)
         {
             if (el.References(Node))
             {
                 el.OwnerElement.DisposeLinked();
             }
         }
     }
     Remove(Node);
 }
Esempio n. 5
0
 public void Remove(DslElement Node)
 {
     RootNode.RemoveChild(Node.Xml);
 }
Esempio n. 6
0
 public XmlNode GetChildNode(String xPath)
 {
     XmlNode node = null;
     DslElement e = this;
     foreach (String name in xPath.Split('/'))
     {
         node = e.GetChildNodeSimple(name);
         e = new DslElement(node as XmlElement);
     }
     return node;
 }
Esempio n. 7
0
        /// <summary>Ссылается ли данный узел на заданное имя. 
        /// При этом мы считаем, что данный узел - моникер</summary>
        /// <param name="Name">Имя, которое хотим проверить</param>
        /// <returns>Ссылается или нет</returns>
        public bool References(DslElement Node)
        {
            String Name = Node.Xml.GetAttribute("Name");

            if (Node.Xml.Name == "DomainProperty")
            {
                Name = (Node.Xml.ParentNode.ParentNode as XmlElement).GetAttribute("Name") + "[^a-zA-Z0-9]" + Name;
            }
            else if (Node.Xml.Name == "DomainClass" || Node.Xml.Name == "DomainRelationship")
            {
                return Name.Equals(Xml.GetAttribute("Name"));
            }

            Regex regex = new Regex("([^a-zA-Z0-9])" + Name + "([^a-zA-Z0-9])");
            return regex.IsMatch("<" + Xml.GetAttribute("Name") + ">");
        }