Ejemplo n.º 1
0
 public static MethodTranslationInfo FromMethodInfo(MethodBase methodInfo, ClassTranslationInfo classTranslationInfo)
 {
     var result = new MethodTranslationInfo
     {
         _scriptName = methodInfo.Name,
         _classTi = classTranslationInfo
     };
     var scriptNameAttribute = methodInfo.GetCustomAttribute<ScriptNameAttribute>();
     if (scriptNameAttribute != null)
         result._scriptName = scriptNameAttribute.Name.Trim();
     if (string.IsNullOrEmpty(result._scriptName))
         throw new Exception("Method name is empty");
     return result;
 }
Ejemplo n.º 2
0
        public static MethodTranslationInfo FromMethodInfo(MethodBase methodInfo, ClassTranslationInfo classTranslationInfo)
        {
            var result = new MethodTranslationInfo
            {
                _scriptName = methodInfo.Name,
                _classTi    = classTranslationInfo
            };
            var scriptNameAttribute = methodInfo.GetCustomAttribute <ScriptNameAttribute>();

            if (scriptNameAttribute != null)
            {
                result._scriptName = scriptNameAttribute.Name.Trim();
            }
            if (string.IsNullOrEmpty(result._scriptName))
            {
                throw new Exception("Method name is empty");
            }
            return(result);
        }
Ejemplo n.º 3
0
        public ClassTranslationInfo GetOrMakeTranslationInfo(Type type)
        {
            if ((object)type == null)
            {
                throw new ArgumentNullException("type");
            }
            ClassTranslationInfo cti;

            if (_classTranslations.TryGetValue(type, out cti))
            {
                return(cti);
            }
            cti = _classTranslations[type] = new ClassTranslationInfo(type, this);
            if (OnTranslationInfoCreated != null)
            {
                OnTranslationInfoCreated(this, new TranslationInfoCreatedEventArgs {
                    ClassTranslation = cti
                });
            }
            return(cti);
        }
Ejemplo n.º 4
0
 public ClassTranslationInfo GetOrMakeTranslationInfo(Type type)
 {
     if ((object)type == null)
         throw new ArgumentNullException("type");
     ClassTranslationInfo cti;
     if (_classTranslations.TryGetValue(type, out cti)) return cti;
     cti = _classTranslations[type] = new ClassTranslationInfo(type, this);
     if (OnTranslationInfoCreated != null)
         OnTranslationInfoCreated(this, new TranslationInfoCreatedEventArgs { ClassTranslation = cti });
     return cti;
 }