Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="elemNode"></param>
        /// <param name="sortByPosFlg"></param>
        /// <param name="elemvo"></param>
        private static void readElementContents(XmlNode elemNode, bool sortByPosFlg, ref ElementVO elemvo)
        {
            List <AttributeVO>   retAttrList   = new List <AttributeVO>();
            List <MethodVO>      retMethList   = new List <MethodVO>();
            List <TaggedValueVO> retTagValList = new List <TaggedValueVO>();
            List <ConnectorVO>   retConnList   = new List <ConnectorVO>();

            foreach (XmlNode eNode in elemNode.ChildNodes)
            {
                // ElementReferenceの読み込み
                if ("ref".Equals(eNode.Name))
                {
                    elemvo.elementReferenceVO = readElementReference(eNode);
                }

                // attributesの読み込み
                if ("attribute".Equals(eNode.Name))
                {
                    retAttrList.Add(readAttribute(eNode));
                }

                // methodsの読み込み
                if ("method".Equals(eNode.Name))
                {
                    retMethList.Add(readMethod(eNode));
                }

                // タグ付き値の読み込み
                if ("taggedValues".Equals(eNode.Name))
                {
                    retTagValList = readTaggedValues(eNode);
                }

                // クラス間接続情報の読み込み
                //    this.connReader.readConnectorByGUID(convo, elemvo);
                //    retConnList.Add(convo);
            }

            elemvo.attributes   = retAttrList;
            elemvo.methods      = retMethList;
            elemvo.taggedValues = retTagValList;

            // ConnectionSearcher
            elemvo.connectors = new List <ConnectorVO>();

            // 要素配下のソート
            if (sortByPosFlg)
            {
                elemvo.sortAttributes();
                elemvo.sortMethods();
                elemvo.sortTaggedValues();
            }
            else
            {
                elemvo.sortAttributesGUID();
                elemvo.sortMethodsGUID();
                elemvo.sortTaggedValuesGUID();
            }
        }
Пример #2
0
        private void readElementContents(ElementVO elemvo, XmlNode parentNode)
        {
            List <AttributeVO>   retAttrList   = new List <AttributeVO>();
            List <MethodVO>      retMethList   = new List <MethodVO>();
            List <TaggedValueVO> retTagValList = new List <TaggedValueVO>();
            List <ConnectorVO>   retConnList   = new List <ConnectorVO>();

            foreach (XmlNode eNode in parentNode.ChildNodes)
            {
                if ("attribute".Equals(eNode.Name))
                {
                    AttributeVO attvo = new AttributeVO();
                    foreach (XmlAttribute attr in eNode.Attributes)
                    {
                        switch (attr.Name)
                        {
                        case "name": attvo.name = attr.Value; break;

                        case "alias": attvo.alias = attr.Value; break;

                        case "stereotype": attvo.stereoType = attr.Value; break;

                        case "guid": attvo.guid = attr.Value; break;

                        case "pos":
                            Int32 p;
                            if (!Int32.TryParse(attr.Value, out p))
                            {
                                p = 0;
                            }
                            attvo.pos = p;
                            break;

                        case "changed":
                            attvo.changed = attr.Value[0];
                            break;
                        }
                    }

                    retAttrList.Add(attvo);
                }

                if ("method".Equals(eNode.Name))
                {
                    MethodVO mthvo = new MethodVO();
                    foreach (XmlAttribute attr in eNode.Attributes)
                    {
                        switch (attr.Name)
                        {
                        case "name": mthvo.name = attr.Value; break;

                        case "alias": mthvo.alias = attr.Value; break;

                        case "stereotype": mthvo.stereoType = attr.Value; break;

                        case "guid": mthvo.guid = attr.Value; break;

                        case "pos":
                            Int32 p;
                            if (!Int32.TryParse(attr.Value, out p))
                            {
                                p = 0;
                            }
                            mthvo.pos = p;
                            break;

                        case "changed":
                            mthvo.changed = attr.Value[0];
                            break;
                        }
                    }

                    if (eNode.SelectSingleNode("behavior") != null)
                    {
                        mthvo.behavior = eNode.SelectSingleNode("behavior").InnerText;
                    }
                    if (eNode.SelectSingleNode("notes") != null)
                    {
                        mthvo.notes = eNode.SelectSingleNode("notes").InnerText;
                    }

                    if (eNode.SelectSingleNode("returnType") != null)
                    {
                        mthvo.returnType = eNode.SelectSingleNode("returnType").InnerText;
                    }

                    if (eNode.SelectSingleNode("visibility") != null)
                    {
                        mthvo.visibility = eNode.SelectSingleNode("visibility").InnerText;
                    }

                    retMethList.Add(mthvo);
                }

                // タグ付き値の読み込み
                if ("tv".Equals(eNode.Name))
                {
                    retTagValList = readTaggedValues(eNode);
                }


//              if ( "connector".Equals(eNode.Name) ) {
//                  ConnectorVO convo = new ConnectorVO();
//					foreach(XmlAttribute attr in eNode.Attributes) {
//                      switch( attr.Name ) {
//                          case "name" : convo.name = attr.Value; break;
////                            case "alias" : convo.alias = attr.Value; break;
////                            case "stereotype" : convo.stereoType = attr.Value; break;
//                          case "guid" : convo.guid = attr.Value; break;
////                            case "pos" : convo.pos = attr.Value; break;
//                      }
//                  }
//
//                  this.connReader.readConnectorByGUID(convo, elemvo);
//
//                  retConnList.Add(convo);
//              }
            }

            elemvo.attributes   = retAttrList;
            elemvo.methods      = retMethList;
            elemvo.taggedValues = retTagValList;

            // ConnectionSearcher
            if (connSearcher == null)
            {
                elemvo.connectors = new List <ConnectorVO>();
                elemvo.sortAttributesGUID();
                elemvo.sortMethodsGUID();
                elemvo.sortTaggedValuesGUID();
            }
            else
            {
                elemvo.connectors = connSearcher.findByObjectGuid(elemvo.guid);
                elemvo.sortAttributes();
                elemvo.sortMethods();
                elemvo.sortTaggedValues();
            }
        }