protected override void OnRuntimeEnable() { base.OnRuntimeEnable(); FieldInfo fieldInfo = Target.GetType().GetField("_helper", BindingFlags.Instance | BindingFlags.NonPublic); _helper = fieldInfo != null ? (fieldInfo.GetValue(Target) as IInternalModuleHelper) : null; }
/// <summary> /// 初始化模块 /// </summary> internal virtual void OnInitialization() { if (HelperType != "<None>") { Type type = ReflectionToolkit.GetTypeInRunTimeAssemblies(HelperType); if (type != null) { if (typeof(IInternalModuleHelper).IsAssignableFrom(type)) { Helper = Activator.CreateInstance(type) as IInternalModuleHelper; Helper.Module = this; } else { throw new HTFrameworkException(HTFrameworkModule.Input, "创建内置模块助手失败:内置模块助手类 " + HelperType + " 必须实现该模块对应的助手接口!"); } } else { throw new HTFrameworkException(HTFrameworkModule.Input, "创建内置模块助手失败:丢失内置模块助手类 " + HelperType + "!"); } } }