Skip to content

Commit 8e7c389

Browse files
committed
Load protocols using service loader.
1 parent a52843d commit 8e7c389

File tree

1 file changed

+5
-32
lines changed

1 file changed

+5
-32
lines changed

windows/src/main/csharp/ch/cyberduck/ui/controller/MainController.cs

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,16 @@
1818

1919
using ch.cyberduck.core;
2020
using ch.cyberduck.core.aquaticprime;
21-
using ch.cyberduck.core.azure;
22-
using ch.cyberduck.core.b2;
2321
using ch.cyberduck.core.bonjour;
24-
using ch.cyberduck.core.box;
25-
using ch.cyberduck.core.brick;
26-
using ch.cyberduck.core.ctera;
27-
using ch.cyberduck.core.dav;
28-
using ch.cyberduck.core.deepbox;
29-
using ch.cyberduck.core.dropbox;
30-
using ch.cyberduck.core.eue;
3122
using ch.cyberduck.core.exception;
32-
using ch.cyberduck.core.ftp;
33-
using ch.cyberduck.core.googledrive;
34-
using ch.cyberduck.core.googlestorage;
35-
using ch.cyberduck.core.hubic;
3623
using ch.cyberduck.core.importer;
37-
using ch.cyberduck.core.irods;
3824
using ch.cyberduck.core.local;
39-
using ch.cyberduck.core.manta;
40-
using ch.cyberduck.core.nextcloud;
41-
using ch.cyberduck.core.nio;
4225
using ch.cyberduck.core.notification;
4326
using ch.cyberduck.core.oauth;
44-
using ch.cyberduck.core.onedrive;
45-
using ch.cyberduck.core.openstack;
46-
using ch.cyberduck.core.owncloud;
4727
using ch.cyberduck.core.pool;
4828
using ch.cyberduck.core.preferences;
4929
using ch.cyberduck.core.profiles;
50-
using ch.cyberduck.core.s3;
51-
using ch.cyberduck.core.sds;
5230
using ch.cyberduck.core.serializer;
53-
using ch.cyberduck.core.sftp;
54-
using ch.cyberduck.core.smb;
55-
using ch.cyberduck.core.spectra;
56-
using ch.cyberduck.core.storegate;
5731
using ch.cyberduck.core.threading;
5832
using ch.cyberduck.core.transfer;
5933
using ch.cyberduck.core.updater;
@@ -90,6 +64,7 @@
9064
using static Windows.Win32.PInvoke;
9165
using Application = ch.cyberduck.core.local.Application;
9266
using UnhandledExceptionEventArgs = System.UnhandledExceptionEventArgs;
67+
using ServiceLoader = java.util.ServiceLoader;
9368

9469
namespace Ch.Cyberduck.Ui.Controller
9570
{
@@ -150,12 +125,10 @@ public MainController(ProtocolFactory protocolFactory, BaseController controller
150125
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
151126
}
152127

153-
protocolFactory.register(new FTPProtocol(), new FTPTLSProtocol(), new SFTPProtocol(), new DAVProtocol(), new SMBProtocol(),
154-
new DAVSSLProtocol(), new SwiftProtocol(), new S3Protocol(), new GoogleStorageProtocol(),
155-
new AzureProtocol(), new IRODSProtocol(), new SpectraProtocol(), new B2Protocol(), new DriveProtocol(),
156-
new DropboxProtocol(), new HubicProtocol(), new LocalProtocol(), new OneDriveProtocol(), new SharepointProtocol(), new SharepointSiteProtocol(),
157-
new MantaProtocol(), new SDSProtocol(), new StoregateProtocol(), new BrickProtocol(), new NextcloudProtocol(), new OwncloudProtocol(), new CteraProtocol(), new BoxProtocol(), new EueProtocol(),
158-
new DeepboxProtocol());
128+
foreach (Protocol p in ServiceLoader.load(typeof(Protocol)))
129+
{
130+
protocolFactory.register(p);
131+
}
159132
protocolFactory.load();
160133

161134
SynchronizationContext.SetSynchronizationContext(new WindowsFormsSynchronizationContext());

0 commit comments

Comments
 (0)