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; }
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); }
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); }
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; }