Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void RegisterFubarConverterTypes()
- {
- foreach (Type type in Enumerable.Where<Type>(Enumerable.SelectMany<Assembly, Type>(Enumerable.Select<FileInfo, Assembly>(Enumerable.Select<string, FileInfo>((IEnumerable<string>) Directory.GetFiles(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), "Fubar.*.dll"), (Func<string, FileInfo>) (filePath => new FileInfo(filePath))), (Func<FileInfo, Assembly>) (fileInfo => AppDomain.CurrentDomain.Load(fileInfo.Name.Replace(fileInfo.Extension, string.Empty)))), (Func<Assembly, IEnumerable<Type>>) (assembly => UtilityFubar.GetAssemblyPublicTypes(assembly))), (Func<Type, bool>) (implementation => typeof (IFubarConverter).IsAssignableFrom(implementation) && implementation.IsClass && !implementation.IsAbstract)))
- {
- IFubarConverter converter = Activator.CreateInstance(type) as IFubarConverter;
- if (type.IsSubclassOf(typeof (XmlToFubarConverter)))
- UtilityFubar.RegisterFubarConverterType(UtilityFubar.XmlToFubarConverterTypes, converter);
- else if (type.IsSubclassOf(typeof (FubarToXmlConverter)))
- UtilityFubar.RegisterFubarConverterType(UtilityFubar.FubarToXmlConverterTypes, converter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement