Пример #1
0
        public static MethodTranslationInfo FromMethodInfo(MethodBase methodInfo,
                                                           ClassTranslationInfo classTranslationInfo)
        {
            var result = new MethodTranslationInfo
            {
                ScriptName = methodInfo.Name,
                ClassTi    = classTranslationInfo
            };
            var scriptNameAttribute = methodInfo.GetCustomAttribute <PyNameAttribute>();

            if (scriptNameAttribute != null)
            {
                result.ScriptName = scriptNameAttribute.Name.Trim();
            }
            if (string.IsNullOrEmpty(result.ScriptName))
            {
                throw new Exception("Method name is empty");
            }
            return(result);
        }
Пример #2
0
        public MethodTranslationInfo GetOrMakeTranslationInfo(MethodBase methodInfo)
        {
            var cti = GetOrMakeTranslationInfo(methodInfo.DeclaringType);

            return(MethodTranslationInfo.FromMethodInfo(methodInfo, cti));
        }