Пример #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;
        }
Пример #3
0
        protected static BehaviorNode load(string agentType, SecurityElement node)
        {
            int          version      = int.Parse(node.Attribute("version"));
            string       text         = node.Attribute("class");
            BehaviorNode behaviorNode = BehaviorNode.Create(text);

            if (behaviorNode != null)
            {
                behaviorNode.SetClassNameString(text);
                string text2 = node.Attribute("id");
                behaviorNode.SetId(Convert.ToInt32(text2));
                behaviorNode.load_properties_pars_attachments_children(true, version, agentType, node);
            }
            return(behaviorNode);
        }
Пример #4
0
        protected BehaviorNode load(string agentType, BsonDeserizer d)
        {
            string       pClassName = d.ReadString();
            BehaviorNode pNode      = BehaviorNode.Create(pClassName);

            Debug.Check(pNode != null, pClassName);

            string verString = d.ReadString();
            int    version   = Convert.ToInt32(verString);

            if (pNode != null)
            {
                pNode.SetClassNameString(pClassName);
                string idString = d.ReadString();
                pNode.SetId(Convert.ToInt32(idString));

                pNode.load_properties_pars_attachments_children(version, agentType, d);
            }

            return(pNode);
        }
Пример #5
0
        protected static BehaviorNode load(string agentType, SecurityElement node)
        {
            Debug.Check(node.Tag == "node");

            int version = int.Parse(node.Attribute("version"));

            string       pClassName = node.Attribute("class");
            BehaviorNode pNode      = BehaviorNode.Create(pClassName);

            Debug.Check(pNode != null);
            if (pNode != null)
            {
                pNode.SetClassNameString(pClassName);
                string idStr = node.Attribute("id");
                pNode.SetId(Convert.ToInt32(idStr));

                pNode.load_properties_pars_attachments_children(true, version, agentType, node);
            }

            return(pNode);
        }
Пример #6
0
        protected void load_attachments(int version, string agentType, BsonDeserizer d)
        {
            d.OpenDocument();

            BsonDeserizer.BsonTypes type = d.ReadType();
            while (type == BsonDeserizer.BsonTypes.BT_AttachmentElement)
            {
                {
                    d.OpenDocument();

                    string attachClassName = d.ReadString();

                    BehaviorNode pAttachment = BehaviorNode.Create(attachClassName);
                    Debug.Check(pAttachment != null, attachClassName);

                    if (pAttachment != null)
                    {
                        pAttachment.SetClassNameString(attachClassName);

                        string idString = d.ReadString();
                        pAttachment.SetId(Convert.ToInt32(idString));

                        pAttachment.load_properties_pars_attachments_children(version, agentType, d);

                        this.Attach(pAttachment);

                        this.m_bHasEvents |= (pAttachment is Event);
                    }

                    d.CloseDocument(false);
                }

                type = d.ReadType();
            }

            Debug.Check(type == BsonDeserizer.BsonTypes.BT_None);
            d.CloseDocument(false);
        }