private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); this.Text = IopDefs.ProductName + " Options"; AceCustomConfig cfg = IOProtocolExtExt.Host.CustomConfig; ulong uTimeout = cfg.GetULong(IopDefs.OptTimeout, 0); m_cbTimeout.Checked = (uTimeout > 0); if (uTimeout > 0) { try { m_numTimeout.Value = uTimeout; } catch (Exception) { Debug.Assert(false); } } m_cbFtpsImplicit.Checked = cfg.GetBool(IopDefs.OptFtpsImplicit, false); m_cbFtpsExplicitSsl.Checked = cfg.GetBool(IopDefs.OptFtpsExplicitSsl, false); m_cbFtpsExplicitTls.Checked = cfg.GetBool(IopDefs.OptFtpsExplicitTls, false); m_tbPrivateKey.Text = cfg.GetString(IopDefs.OptSshPrivateKey, ""); EnableControlsEx(); }
private static string AddCommonOpenOptions(string strOpenCmd, string strSessionUrl) { if (string.IsNullOrEmpty(strOpenCmd)) { return(strOpenCmd); } if (strSessionUrl == null) { Debug.Assert(false); return(strOpenCmd); } AceCustomConfig cfg = IOProtocolExtExt.Host.CustomConfig; string str = strOpenCmd; ulong uTimeout = cfg.GetULong(IopDefs.OptTimeout, 0); if (uTimeout > 0) { str += (" -timeout=" + uTimeout.ToString()); } if (strSessionUrl.StartsWith("ftps:", StrUtil.CaseIgnoreCmp)) { if (cfg.GetBool(IopDefs.OptFtpsImplicit, false)) { str += " -implicit"; } if (cfg.GetBool(IopDefs.OptFtpsExplicitSsl, false)) { str += " -explicitssl"; } if (cfg.GetBool(IopDefs.OptFtpsExplicitTls, false)) { str += " -explicittls"; } } return(str); }
private string AddCommonOpenOptions(string strOpenCmd, string strSessionUrl) { if (string.IsNullOrEmpty(strOpenCmd)) { return(strOpenCmd); } if (strSessionUrl == null) { Debug.Assert(false); return(strOpenCmd); } AceCustomConfig cfg = IOProtocolExtExt.Host.CustomConfig; string str = strOpenCmd; ulong uTimeout = cfg.GetULong(IopDefs.OptTimeout, 0); if (uTimeout > 0) { str += (" -timeout=" + uTimeout.ToString()); } if (strSessionUrl.StartsWith("ftps:", StrUtil.CaseIgnoreCmp)) { if (cfg.GetBool(IopDefs.OptFtpsImplicit, false)) { str += " -implicit"; } if (cfg.GetBool(IopDefs.OptFtpsExplicitSsl, false)) { str += " -explicitssl"; } if (cfg.GetBool(IopDefs.OptFtpsExplicitTls, false)) { str += " -explicittls"; } } if (strSessionUrl.StartsWith("scp:", StrUtil.CaseIgnoreCmp)) { string strPrivateKey = cfg.GetString(IopDefs.OptSshPrivateKey, ""); if (!string.IsNullOrEmpty(strPrivateKey)) { str += " -privatekey=" + strPrivateKey; } } // if(!string.IsNullOrEmpty(strHostKey)) // str += " -hostkey=\"" + strHostKey + "\""; str += " -hostkey=*"; string strRawCfg = string.Empty; try { Uri uriProxy = GetProxyUri(strSessionUrl, false); if (uriProxy == null) { uriProxy = GetProxyUri(strSessionUrl, true); } if (uriProxy != null) { strRawCfg += " ProxyMethod=3"; if (!string.IsNullOrEmpty(uriProxy.Host)) { strRawCfg += " ProxyHost=" + EncodeParam(uriProxy.Host); } if (uriProxy.Port > 0) { strRawCfg += " ProxyPort=" + uriProxy.Port.ToString(); } string strPrxUserName = null, strPrxPassword = null; ICredentials iCred = m_prx.Credentials; NetworkCredential nc = (iCred as NetworkCredential); if ((nc == null) && (iCred != null)) { nc = iCred.GetCredential(uriProxy, "Basic"); } if (nc != null) { strPrxUserName = nc.UserName; strPrxPassword = nc.Password; } if (!string.IsNullOrEmpty(strPrxUserName)) { strRawCfg += " ProxyUsername="******" ProxyPassword="******" ProxyMethod=3"; if (!string.IsNullOrEmpty(strPrxHost)) { strRawCfg += " ProxyHost=" + EncodeParam(strPrxHost); } if (!string.IsNullOrEmpty(strPrxPort)) { strRawCfg += " ProxyPort=" + EncodeParam(strPrxPort); } if (!string.IsNullOrEmpty(strPrxUserName)) { strRawCfg += " ProxyUsername="******" ProxyPassword="******" -rawsettings " + strRawCfg; } return(str); }