private static ResourceDataFactoryCollection GetFactories(FactoryLocation[] locations) { if (_factories == null) { if (locations == null) { locations = new FactoryLocation[] { new FactoryLocation(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), FactoryLocationType.Directory) } } ; List <ResourceDataFactory> list = new List <ResourceDataFactory>(); Prepopulate(list); foreach (FactoryLocation loc in locations) { switch (loc.Type) { case FactoryLocationType.Directory: // recursivly search for all DLLs if (Directory.Exists(loc.Path)) { RecurseDirectory(list, new DirectoryInfo(loc.Path)); } break; case FactoryLocationType.Filename: LoadFactoriesFromAssembly(list, loc.Path); break; case FactoryLocationType.Wildcard: throw new NotSupportedException(); // // String path = loc.Path.Substring(0, // // break; } } _factories = new ResourceDataFactoryCollection(list); } return(_factories); }
internal static ResourceDataFactoryCollection GetFactories() { if (_factories == null) { var list = new List <ResourceDataFactory>(); Prepopulate(list); LoadFactoriesFromAssemblies(list); _factories = new ResourceDataFactoryCollection(list); foreach (var factory in _factories) { factory.RegisterOptions(); } } return(_factories); }
public static Pair <ResourceDataFactory, String>[] GetOpenFileFilters() { if (_openFileFilters == null) { ResourceDataFactoryCollection factories = GetFactories(); List <Pair <ResourceDataFactory, String> > filters = new List <Pair <ResourceDataFactory, String> >(factories.Count); for (int i = 0; i < factories.Count; i++) { String filter = factories[i].OpenFileFilter; if (filter != null) { filters.Add(new Pair <ResourceDataFactory, String>(factories[i], filter)); } } _openFileFilters = filters.ToArray(); } return(_openFileFilters); }