Пример #1
0
        protected void load_properties_pars_attachments_children(bool bNode, int version, string agentType, SecurityElement node)
        {
#if !BEHAVIAC_RELEASE
            SetAgentType(agentType);
#endif//#ifdef _DEBUG

            bool bHasEvents = this.HasEvents();

            if (node.Children != null)
            {
                List <property_t> properties = new List <property_t>();

                foreach (SecurityElement c in node.Children)
                {
                    if (!load_property_pars(ref properties, c, version, agentType))
                    {
                        if (bNode)
                        {
                            if (c.Tag == "attachment")
                            {
                                string       pAttachClassName = c.Attribute("class");
                                BehaviorNode pAttachment      = BehaviorNode.Create(pAttachClassName);

                                Debug.Check(pAttachment != null);

                                if (pAttachment != null)
                                {
                                    pAttachment.SetClassNameString(pAttachClassName);
                                    string idStr = c.Attribute("id");
                                    pAttachment.SetId(Convert.ToInt32(idStr));

                                    pAttachment.load_properties_pars_attachments_children(false, version, agentType, c);

                                    this.Attach(pAttachment);

                                    bHasEvents |= (pAttachment is Event);
                                }
                            }
                            else if (c.Tag == "node")
                            {
                                BehaviorNode pChildNode = BehaviorNode.load(agentType, c);
                                bHasEvents |= pChildNode.m_bHasEvents;

                                this.AddChild(pChildNode);
                            }
                        }
                    }
                }

                if (properties.Count > 0)
                {
                    this.load(version, agentType, properties);
                }
            }

            this.m_bHasEvents |= bHasEvents;
        }
Пример #2
0
        protected void load_properties_pars_attachments_children(bool bNode, int version, string agentType, SecurityElement node)
        {
            bool flag = this.HasEvents();

            if (node.get_Children() != null)
            {
                List <property_t> list       = new List <property_t>();
                IEnumerator       enumerator = node.get_Children().GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        SecurityElement securityElement = (SecurityElement)enumerator.get_Current();
                        if (!this.load_property_pars(ref list, securityElement, version, agentType) && bNode)
                        {
                            if (securityElement.get_Tag() == "attachment")
                            {
                                string       text         = securityElement.Attribute("class");
                                BehaviorNode behaviorNode = BehaviorNode.Create(text);
                                if (behaviorNode != null)
                                {
                                    behaviorNode.SetClassNameString(text);
                                    string text2 = securityElement.Attribute("id");
                                    behaviorNode.SetId(Convert.ToInt32(text2));
                                    behaviorNode.load_properties_pars_attachments_children(false, version, agentType, securityElement);
                                    this.Attach(behaviorNode);
                                    flag |= (behaviorNode is Event);
                                }
                            }
                            else if (securityElement.get_Tag() == "node")
                            {
                                BehaviorNode behaviorNode2 = BehaviorNode.load(agentType, securityElement);
                                flag |= behaviorNode2.m_bHasEvents;
                                this.AddChild(behaviorNode2);
                            }
                        }
                    }
                }
                finally
                {
                    IDisposable disposable = enumerator as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }
                if (list.get_Count() > 0)
                {
                    this.load(version, agentType, list);
                }
            }
            this.m_bHasEvents |= flag;
        }