private bool TryLoadConfigurator(FileInfo file) { try { var assembly = Assembly.LoadFrom(file.FullName); var apiConfiguratorType = assembly.GetTypes() .FirstOrDefault(x => x.GetInterface(typeof(IConfigureApi).Name) != null); if (apiConfiguratorType != null) { _configurator = Activator.CreateInstance(apiConfiguratorType).As <IConfigureApi>(); return(true); } } catch (TypeLoadException) { } catch (ReflectionTypeLoadException) { } catch (BadImageFormatException) { } catch (FileNotFoundException) { } catch (FileLoadException) { } return(false); }
private bool TryLoadConfigurator(FileInfo file) { try { var assembly = Assembly.LoadFrom(file.FullName); var apiConfiguratorType = assembly.GetTypes() .FirstOrDefault(x => x.GetInterface(typeof (IConfigureApi).Name) != null); if (apiConfiguratorType != null) { _configurator = Activator.CreateInstance(apiConfiguratorType).As<IConfigureApi>(); return true; } } catch (TypeLoadException) { } catch (ReflectionTypeLoadException) { } catch (BadImageFormatException) { } catch (FileNotFoundException) { } catch (FileLoadException) { } return false; }