/// <summary>
        /// enregistre une nouvelle méthode supplémentaire
        /// </summary>
        /// <param name="method"></param>
        public static void RegisterMethode(CMethodeSupplementaire method)
        {
            ArrayList lstVals = (ArrayList)m_tableTypeToMethod[method.DeclaringType];

            if (lstVals == null)
            {
                lstVals = new ArrayList();
                m_tableTypeToMethod[method.DeclaringType] = lstVals;
            }
            lstVals.Add(method);
        }
示例#2
0
        public CInfoMethodeDynamique(Type tp, string strNom)
        {
            MethodInfo method = tp.GetMethod(strNom);

            if (method == null)
            {
                CMethodeSupplementaire methodSupp = CGestionnaireMethodesSupplementaires.GetMethod(tp, strNom);
                if (methodSupp == null)
                {
                    m_strNomMethode  = "#" + strNom + "#";
                    m_strDescription = I.T("Method not found  :@1|30109 ", strNom);
                    m_typeRetour     = typeof(string);
                }
                else
                {
                    m_strNomMethode  = methodSupp.Name;
                    m_strDescription = methodSupp.Description;
                    m_lstParametres.AddRange(methodSupp.InfosParametres);
                }
            }
            else
            {
                m_strNomMethode = method.Name;
                Object[] attribs = method.GetCustomAttributes(typeof(DynamicMethodAttribute), true);
                if (attribs.Length != 0)
                {
                    DynamicMethodAttribute attrib = (DynamicMethodAttribute)attribs[0];
                    m_strDescription = attrib.Descriptif;
                    int nParametre = 0;
                    foreach (ParameterInfo info in method.GetParameters())
                    {
                        m_lstParametres.Add(new CInfoParametreMethodeDynamique(info.Name, attrib.GetDescriptionParametre(nParametre), info.ParameterType));
                        nParametre++;
                    }
                }
            }
        }