Пример #1
0
        private void WriteList(System.IO.StreamWriter writer, SortedList <string, DocObject> sortlist)
        {
            foreach (string key in sortlist.Keys)
            {
                DocObject docEntity = sortlist[key];

                WriteItem(writer, docEntity, 0, docEntity.Name);

                if (docEntity is DocEntity)
                {
                    if ((this.m_scope & DocDefinitionScopeEnum.EntityAttribute) != 0)
                    {
                        DocEntity docEnt = (DocEntity)docEntity;
                        foreach (DocAttribute docAttr in docEnt.Attributes)
                        {
                            WriteItem(writer, docAttr, 1, docEntity.Name);
                        }
                    }
                }
                else if (docEntity is DocEnumeration)
                {
                    if ((this.m_scope & DocDefinitionScopeEnum.TypeConstant) != 0)
                    {
                        DocEnumeration docEnum = (DocEnumeration)docEntity;
                        foreach (DocConstant docConst in docEnum.Constants)
                        {
                            WriteItem(writer, docConst, 1, docEntity.Name);
                        }
                    }
                }
                else if (docEntity is DocPropertySet)
                {
                    if ((this.m_scope & DocDefinitionScopeEnum.PsetProperty) != 0)
                    {
                        DocPropertySet docPset       = (DocPropertySet)docEntity;
                        DocEntity      docApp        = null;
                        DocEntity[]    docApplicable = docPset.GetApplicableTypeDefinitions(this.m_project);
                        if (docApplicable != null && docApplicable.Length > 0 && docApplicable[0] != null)
                        {
                            docApp = this.m_project.GetDefinition(docApplicable[0].BaseDefinition) as DocEntity;
                        }
                        foreach (DocProperty docProp in docPset.Properties)
                        {
                            // filter out leaf properties defined at common pset (e.g. Reference, Status)
                            DocProperty docSuper = this.m_project.FindProperty(docProp.Name, docApp);
                            if (docSuper == docProp || docSuper == null)
                            {
                                WriteItem(writer, docProp, 1, docEntity.Name);
                            }
                        }
                    }
                }
                else if (docEntity is DocPropertyEnumeration)
                {
                    if ((this.m_scope & DocDefinitionScopeEnum.PEnumConstant) != 0)
                    {
                        DocPropertyEnumeration docPE = (DocPropertyEnumeration)docEntity;
                        foreach (DocPropertyConstant docPC in docPE.Constants)
                        {
                            WriteItem(writer, docPC, 1, docEntity.Name);
                        }
                    }
                }
                else if (docEntity is DocQuantitySet)
                {
                    if ((this.m_scope & DocDefinitionScopeEnum.QsetQuantity) != 0)
                    {
                        DocQuantitySet docQset = (DocQuantitySet)docEntity;
                        foreach (DocQuantity docQuan in docQset.Quantities)
                        {
                            WriteItem(writer, docQuan, 1, docEntity.Name);
                        }
                    }
                }
            }
        }