Пример #1
0
        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();
        }
        public bool GetAutomaticPrefixURLs()
        {
            if (!m_automaticPrefixURLs.HasValue)
            {
                m_automaticPrefixURLs = config.GetBool(automaticPrefixURLs, false);
            }

            return(m_automaticPrefixURLs.Value);
        }
Пример #3
0
        public static void Read()
        {
            bool test = Testmode;

            Testmode = false;
            const string ConfigPrefix = "ColoredPassword.";

            FirstRun       = m_Config.GetBool(ConfigPrefix + "FirstRun", true);
            Active         = m_Config.GetBool(ConfigPrefix + "Active", true);
            ColorEntryView = m_Config.GetBool(ConfigPrefix + "ColorEntryView", true);
            ListViewKeepBackgroundColor = m_Config.GetBool(ConfigPrefix + "ListViewKeepBackgroundColor", true);
            string help = m_Config.GetString(ConfigPrefix + "ForeColorDefault", "WindowText");

            ForeColorDefault      = NameToColor(help);
            help                  = m_Config.GetString(ConfigPrefix + "BackColorDefault", "Window");
            BackColorDefault      = NameToColor(help);
            help                  = m_Config.GetString(ConfigPrefix + "ForeColorDigit", "Red");
            ForeColorDigit        = NameToColor(help);
            help                  = m_Config.GetString(ConfigPrefix + "BackColorDigit", "White");
            BackColorDigit        = NameToColor(help);
            help                  = m_Config.GetString(ConfigPrefix + "ForeColorSpecial", "Green");
            ForeColorSpecial      = NameToColor(help);
            help                  = m_Config.GetString(ConfigPrefix + "BackColorSpecial", "White");
            BackColorSpecial      = NameToColor(help);
            LowercaseDifferent    = m_Config.GetBool(ConfigPrefix + "LowercaseDifferent", false);
            help                  = m_Config.GetString(ConfigPrefix + "ForeColorLower", ColorToName(ForeColorDefault));
            ForeColorLower        = NameToColor(help);
            help                  = m_Config.GetString(ConfigPrefix + "BackColorLower", ColorToName(BackColorDefault));
            BackColorLower        = NameToColor(help);
            SinglePwDisplayActive = m_Config.GetBool(ConfigPrefix + "SinglePwDisplay", SinglePwDisplayActive);
            ColorPwGen            = m_Config.GetBool(ConfigPrefix + "ColorPwGen", ColorPwGen);
            Testmode              = test;
            Write();
        }
Пример #4
0
        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);
        }