private static List <IPackable> PackableThings = new List <IPackable>(); //2015.04.11. public static void LoadAll() { //2015.04.11. var types = Assembly.GetExecutingAssembly().GetTypes(); foreach (var type in types) { if (!typeof(IPackable).IsAssignableFrom(type) || type.IsInterface) { continue; } if (!Directory.Exists(GetName(type))) { Directory.CreateDirectory(GetName(type)); //2015.05.16. } string[] files = Directory.GetFiles(GetName(type)).Where(entry => Path.GetFileNameWithoutExtension(entry).Length > 0).ToArray(); //Where: 2015.07.06. if (files.Length == 0) { DownloadDefaults(type); //2015.06.14. } foreach (string file in files) { IPackable packable = Activator.CreateInstance(type, true) as IPackable; PackableThings.Add(packable); if (typeof(IPackWithSave).IsAssignableFrom(type) && !type.IsInterface) { (packable as IPackWithSave).FileName = file; //2015.06.06. } if (!packable.LoadFromPack(file)) { PackableThings.Remove(packable); //2015.05.24. - Ezzel elvileg előbb-utóbb törli } } } }