コード例 #1
0
        private void GetItemClassFromAttributes(XmlReader xrdr, out string sItemClass, out int clid)
        {
            sItemClass = xrdr.GetAttribute("itemClass");
            if (String.IsNullOrEmpty(sItemClass))
            {
                throw new Exception("Missing itemClass attribute for <List> element");
            }
            clid = m_mdc.GetClassId(sItemClass);
            if (clid == 0)
            {
                throw new Exception("Invalid itemClass attribute value for <List> element");
            }
            bool fOk = false;

            for (int i = 0; i < m_rgItemClasses.Length; ++i)
            {
                if (clid == m_rgItemClasses[i])
                {
                    fOk = true;
                    break;
                }
            }
            if (!fOk)
            {
                throw new Exception("Invalid itemClass attribute value for <List> element: not a CmPossibility");
            }
            // Find the names of subclasses of our particular class.  One or more may be used in the XML file
            // instead of sItemClass.
            m_itemClassNames.Clear();
            int[] subClassIds = m_mdc.GetAllSubclasses(clid);
            for (int i = 0; i < subClassIds.Length; ++i)
            {
                m_itemClassNames.Add(m_mdc.GetClassName(subClassIds [i]));
            }
        }
コード例 #2
0
        private void GetItemClassFromAttributes(XmlReader xrdr, out string sItemClass, out int clid)
        {
            sItemClass = xrdr.GetAttribute("itemClass");
            if (String.IsNullOrEmpty(sItemClass))
            {
                throw new Exception("Missing itemClass attribute for <List> element");
            }
            clid = m_mdc.GetClassId(sItemClass);
            if (clid == 0)
            {
                throw new Exception("Invalid itemClass attribute value for <List> element");
            }
            bool fOk = false;

            for (int i = 0; i < m_rgItemClasses.Length; ++i)
            {
                if (clid == m_rgItemClasses[i])
                {
                    fOk = true;
                    break;
                }
            }
            if (!fOk)
            {
                throw new Exception("Invalid itemClass attribute value for <List> element: not a CmPossibility");
            }
        }
コード例 #3
0
 /// <summary>
 ///:&gt;:&gt; Reverse access methods
 ///:&gt; Get the ID of the class having the specified name. Returns 0 if not found.
 ///</summary>
 /// <param name='bstrClassName'> </param>
 /// <returns></returns>
 public virtual int GetClassId(string bstrClassName)
 {
     return(m_metaDataCache.GetClassId(bstrClassName));
 }
コード例 #4
0
 /// <summary>
 /// Get a copy of the Set of ICmObjectOrSurrogate instances of the given classname.
 /// </summary>
 internal IEnumerable <ICmObjectOrSurrogate> AllObjectsOrSurrogates(string classname)
 {
     return(AllObjectsOrSurrogates(m_mdc.GetClassId(classname)));
 }