Пример #1
0
        public override void LoadFromXml(XmlElement e)
        {
            base.LoadFromXml(e);

            if (Type == ProMetaConst.DATATYPE_LOCALSTRUCT)
            {
                string lstr = XmlUtil.GetAttrStrVal(e, "struct-name", "");
                if (lstr == "")
                {
                    throw new exception.AnalysisException(String.Format("pro-meta/pro[{0}]/members/member type=local-struct must define struct-name property", owner_.Name));
                }

                ref_local_struct_ = owner_.GetLocalStructByName(lstr);
                if (ref_local_struct_ == null)
                {
                    throw new exception.AnalysisException(String.Format("pro-meta/pro[{0}]/members/member type=local-struct define struct-name[{1}] not exist", owner_.Name, lstr));
                }
            }

            if (Type == ProMetaConst.DATATYPE_GLOBALSTRUCT)
            {
                string lstr = XmlUtil.GetAttrStrVal(e, "struct-name", "");
                if (lstr == "")
                {
                    throw new exception.AnalysisException(String.Format("pro-meta/pro[{0}]/members/member type=global-struct must define struct-name property", owner_.Name));
                }

                ref_global_struct_ = ProMetaHelper.Instance().GetGlobalStructByName(lstr);
                if (ref_global_struct_ == null)
                {
                    throw new exception.AnalysisException(String.Format("pro-meta/pro[{0}]/members/member type=global-struct define struct-name[{1}] not exist", owner_.Name, lstr));
                }
            }
        }
Пример #2
0
        public void AddGlobalStruct(GlobalStruct gs)
        {
            if (GetGlobalStructByName(gs.Name) != null)
            {
                throw new AnalysisException(String.Format("redefine {0} global struct", gs.Name));
            }

            global_struct_.Add(gs);
        }
Пример #3
0
        protected void AnalyseGlobalStruct(XmlElement e)
        {
            string name = XmlUtil.GetAttrStrVal(e, "name", "");

            if (name == "")
            {
                throw new exception.AnalysisException(String.Format("pro-region/global-struct/struct node must define a name"));
            }
            GlobalStruct gs = new GlobalStruct(name, this);

            gs.LoadFromXml(e);

            ProMetaHelper.Instance().AddGlobalStruct(gs);
        }