A lot of this code is largely out of date and due for an update. The factory is almost always chosen based on the extensions that the factory supports. See UFactory::GetSupportedFileExtensions. Usually your FactoryCreateBinary or FactoryCreateText should just return false if it cant handle the file.