예제 #1
0
 private void CommandsAfterLaunch(ReadOnlyCollection <string> args)
 {
     if (args.Count > 0)
     {
         string filename = args[0];
         Logger.debug("applicationOpenFile:" + filename);
         Local f = LocalFactory.createLocal(filename);
         if (f.exists())
         {
             if ("cyberducklicense".Equals(f.getExtension()))
             {
                 License license = LicenseFactory.create(f);
                 if (license.verify())
                 {
                     f.copy(
                         LocalFactory.createLocal(
                             Preferences.instance().getProperty("application.support.path"), f.getName()));
                     if (DialogResult.OK == _bc.InfoBox(
                             license.ToString(),
                             Locale.localizedString(
                                 "Thanks for your support! Your contribution helps to further advance development to make Cyberduck even better.",
                                 "License"),
                             Locale.localizedString(
                                 "Your donation key has been copied to the Application Support folder.", "License"),
                             String.Format("{0}", Locale.localizedString("Continue", "License")),
                             null, false))
                     {
                         ;
                     }
                 }
                 else
                 {
                     if (DialogResult.OK == _bc.WarningBox(
                             Locale.localizedString("Not a valid donation key", "License"),
                             Locale.localizedString("Not a valid donation key", "License"),
                             Locale.localizedString("This donation key does not appear to be valid.", "License"),
                             null,
                             String.Format("{0}", Locale.localizedString("Continue", "License")),
                             false, Preferences.instance().getProperty("website.help") + "/faq"))
                     {
                         ;
                     }
                 }
             }
             else if ("cyberduckprofile".Equals(f.getExtension()))
             {
                 Protocol profile = (Protocol)ProtocolReaderFactory.instance().read(f);
                 profile.register();
                 Host host = new Host(profile, profile.getDefaultHostname(), profile.getDefaultPort());
                 NewBrowser().AddBookmark(host);
                 // Register in application support
                 Local profiles =
                     LocalFactory.createLocal(Preferences.instance().getProperty("application.support.path"),
                                              "Profiles");
                 profiles.mkdir(true);
                 f.copy(LocalFactory.createLocal(profiles, f.getName()));
             }
             else if ("duck".Equals(f.getExtension()))
             {
                 Host host = (Host)HostReaderFactory.instance().read(f);
                 NewBrowser().Mount(host);
             }
         }
     }
 }
예제 #2
0
 public static void Register()
 {
     ProtocolReaderFactory.addFactory(ch.cyberduck.core.Factory.NATIVE_PLATFORM, new Factory());
 }