Exemplo n.º 1
0
        public Global(Protocol parent, XmlNode xml, XmlNamespaceManager nsm)
            : this(parent)
        {
            if (xml == null)
                throw new ArgumentNullException();
            if (nsm == null)
                throw new ArgumentNullException();

            XmlAttribute attr = xml.SelectSingleNode("@name", nsm) as XmlAttribute;
            if (attr != null)
                this.Name = attr.Value;

            XmlElement elem = xml.SelectSingleNode("sd:Description", nsm) as XmlElement;
            if (elem != null)
                this.Description = new HtmlString(elem);
            elem = xml.SelectSingleNode("sd:Class", nsm) as XmlElement;
            if (elem != null)
                this.Definition = new GlobalClass(this, elem, nsm);
            elem = xml.SelectSingleNode("sd:Constant", nsm) as XmlElement;
            if (elem != null)
                this.Definition = new GlobalConstant(this, elem, nsm);
            elem = xml.SelectSingleNode("sd:Pool", nsm) as XmlElement;
            if (elem != null)
                this.Definition = new GlobalPool(this, elem, nsm);
            elem = xml.SelectSingleNode("sd:Global", nsm) as XmlElement;
            if (elem != null)
                this.Definition = new GlobalVariable(this, elem, nsm);
            elem = xml.SelectSingleNode("sd:Initializer", nsm) as XmlElement;
            if (elem != null)
                this.Initializer = elem.InnerText;
        }
Exemplo n.º 2
0
 public Message(Protocol parent)
 {
     if (parent == null)
         throw new ArgumentNullException();
     this.Protocol = parent;
     this.Refinement = new Dictionary<string, HtmlString>();
     this.Parameters = new NotifyingCollection<Parameter>();
 }
Exemplo n.º 3
0
        public Message(Protocol parent, XmlNode xml, XmlNamespaceManager nsm)
            : this(parent)
        {
            if (xml == null)
                throw new ArgumentNullException();
            if (nsm == null)
                throw new ArgumentNullException();

            XmlAttribute attr = xml.SelectSingleNode("@selector", nsm) as XmlAttribute;
            if (attr != null)
                this.Selector = attr.Value;
            attr = xml.SelectSingleNode("@docId", nsm) as XmlAttribute;
            if (attr != null)
                this.DocumentationId = attr.Value;
            attr = xml.SelectSingleNode("@refined", nsm) as XmlAttribute;
            if (attr != null)
                this.IsRefined = Boolean.Parse(attr.Value);

            XmlElement elem = xml.SelectSingleNode("sd:Synopsis", nsm) as XmlElement;
            if (elem != null)
                this.Synopsis = new HtmlString(elem);
            elem = xml.SelectSingleNode("sd:Definition", nsm) as XmlElement;
            if (elem != null)
            {
                this.DefinitionProtocol = elem.SelectSingleNode("@protocol").Value;
                this.DefinitionDescription = new HtmlString(elem);
            }
            elem = xml.SelectSingleNode("sd:Errors", nsm) as XmlElement;
            if (elem != null)
                this.Errors = new HtmlString(elem);
            elem = xml.SelectSingleNode("sd:Source", nsm) as XmlElement;
            if (elem != null)
                this.Source = elem.InnerText;
            elem = xml.SelectSingleNode("sd:ReturnValue", nsm) as XmlElement;
            if (elem != null)
                this.ReturnValue = new ReturnValue(this, elem, nsm);

            foreach (XmlElement node in xml.SelectNodes("sd:Parameter", nsm))
                this.Parameters.Add(new Parameter(this, node, nsm));
            foreach (XmlElement node in xml.SelectNodes("sd:Refinement", nsm))
                this.Refinement[node.SelectSingleNode("@protocol").Value] = new HtmlString(node);
        }
Exemplo n.º 4
0
 public Global(Protocol parent)
 {
     if (parent == null)
         throw new ArgumentNullException();
     this.Protocol = parent;
 }
 private bool HasConformsToCircularReference(Protocol p, List<Protocol> recursionSet, Dictionary<string, Protocol> map)
 {
     if (p == this.Protocol)
         return true;
     if (recursionSet.Contains(p))
         return false;
     recursionSet.Add(p);
     foreach (string name in p.ConformsTo)
     {
         if (name != "ANY")
         {
             if (this.HasConformsToCircularReference(map[name], recursionSet, map))
                 return true;
         }
     }
     return false;
 }
 private void CreateNewProtocolMenuItem_Click(object sender, EventArgs e)
 {
     if (this.SystemDescriptionHolder == null)
         return;
     SystemDescription sd = this.SystemDescriptionHolder.Value;
     if (sd == null)
         return;
     Protocol p = new Protocol(sd);
     p.Name = "";
     if (!this.ProtocolHolder.SetValue(p))
         return;
 }
        private void AddProtocol(Protocol prot, List<Protocol> recursionSet, int level)
        {
            if (this.AllProtocolsHolder == null)
                return;
            if (this.AllProtocolsHolder.Collection == null)
                return;
            IEnumerable<Protocol> conforming = this.AllProtocolsHolder.Collection
                .Where(p => p.ConformsTo.Contains(prot.Name)).OrderBy(p => p.Name);

            foreach (Protocol p in conforming)
            {
                if (!recursionSet.Contains(p))
                {
                    recursionSet.Add(p);
                    string tmp = "";
                    for (int i = 0; i < level; i++)
                        tmp = tmp + "   ";
                    ListViewItem lvi = this.listProtocols.Items.Add(tmp + p.Name);
                    lvi.SubItems.Add(p.DocumentationId);
                    lvi.SubItems.Add(p.IsAbstract ? "Yes" : "No");
                    lvi.SubItems.Add(p.Messages.Count.ToString());
                    lvi.SubItems.Add(p.StandardGlobals.Count(g => g.Definition is GlobalClass).ToString());
                    lvi.SubItems.Add(p.StandardGlobals.Count(g => g.Definition is GlobalVariable).ToString());
                    lvi.SubItems.Add(p.StandardGlobals.Count(g => g.Definition is GlobalConstant).ToString());
                    lvi.SubItems.Add(p.StandardGlobals.Count(g => g.Definition is GlobalPool).ToString());
                    lvi.SubItems.Add(p.StandardGlobals.Count(g => g.Definition == null).ToString());
                    this.AddProtocol(p, recursionSet, level + 1);
                }
            }
        }