Пример #1
0
        protected override bool isChangedKeyAccepted(string hostname, PublicKey key)
        {
            AsyncController.AsyncDelegate d = delegate
            {
                _parent.CommandBox(
                    String.Format(LocaleFactory.localizedString("Changed fingerprint", "Sftp"), hostname),
                    String.Format(LocaleFactory.localizedString("Changed fingerprint", "Sftp"), hostname),
                    String.Format(
                        LocaleFactory.localizedString("The fingerprint for the {1} key sent by the server is {0}.",
                                                      "Sftp"), new SSHFingerprintGenerator().fingerprint(key), KeyType.fromKey(key).name()),
                    String.Format("{0}|{1}", LocaleFactory.localizedString("Allow"),
                                  LocaleFactory.localizedString("Deny")), false, LocaleFactory.localizedString("Always"),
                    TaskDialogIcon.Warning,
                    ProviderHelpServiceFactory.get().help(Scheme.sftp),
                    delegate(int option, bool verificationChecked)
                {
                    switch (option)
                    {
                    case 0:
                        allow(hostname, key, verificationChecked);
                        break;

                    case 1:
                        Log.warn("Cannot continue without a valid host key");
                        throw new ConnectionCanceledException();
                    }
                });
            };
            _parent.Invoke(d, true);
            return(true);
        }