コード例 #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
ファイル: TranslationInfo.cs プロジェクト: isukces/cs2python
        public MethodTranslationInfo GetOrMakeTranslationInfo(MethodBase methodInfo)
        {
            var cti = GetOrMakeTranslationInfo(methodInfo.DeclaringType);

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