public void Initialise(IConfiguration config) { // Create Temp library, // Determine store type from configuration IFtpLibrary ftpLib = new FtpLibrary(); if (!string.IsNullOrEmpty(config.CustomFtpLibraryAssemblyName)) { var assemblyFileName = config.CustomFtpLibraryAssemblyName; if (!assemblyFileName.ToLower().EndsWith(".dll")) { assemblyFileName += ".dll"; } Assembly asm = Assembly.LoadFrom(assemblyFileName); Type pluginType = asm != null?asm.GetTypes().Where(IsFtpLib).FirstOrDefault() : null; if (pluginType != null) { ftpLib = (IFtpLibrary)Activator.CreateInstance(pluginType); } } SchedulerContainer.Container.Configure(c => c.AddRegistry <SmRegistry>()); // Inject the persistence store after initialization SchedulerContainer.Container.Inject(ftpLib); }
public object Process(object target, IContext context) { IFtpLibrary retval = new FtpLibrary(); if (!string.IsNullOrEmpty(_config.CustomFtpLibraryAssemblyName) && target.GetType().GetInterfaces().Contains(typeof(IFtpLibrary))) { var assemblyFileName = _config.CustomFtpLibraryAssemblyName; if (!assemblyFileName.ToLower().EndsWith(".dll")) { assemblyFileName += ".dll"; } Assembly asm = Assembly.LoadFrom(assemblyFileName); Type pluginType = asm != null ? asm.GetTypes().Where(IsFtpLib).FirstOrDefault() : null; if (pluginType != null) { retval = (IFtpLibrary) Activator.CreateInstance(pluginType); } } return retval; }
public object Process(object target, IContext context) { IFtpLibrary retval = new FtpLibrary(); if (!string.IsNullOrEmpty(_config.CustomFtpLibraryAssemblyName) && target.GetType().GetInterfaces().Contains(typeof(IFtpLibrary))) { var assemblyFileName = _config.CustomFtpLibraryAssemblyName; if (!assemblyFileName.ToLower().EndsWith(".dll")) { assemblyFileName += ".dll"; } Assembly asm = Assembly.LoadFrom(assemblyFileName); Type pluginType = asm != null?asm.GetTypes().Where(IsFtpLib).FirstOrDefault() : null; if (pluginType != null) { retval = (IFtpLibrary)Activator.CreateInstance(pluginType); } } return(retval); }