Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        internal static List <string> GetOtherTimers()
        {
            List <string> lTimer           = new List <string>();
            string        hookPluginTimers = m_conf.GetString(m_ConfigOtherTimers, "TrayTotpGT.liRefreshTimer,KeeTrayTOTP.liRefreshTimer,KeePassOTP.m_columnOTP.m_columnRefreshTimer");

            //Quick & Dirty fix as I changed the class holding the timer in my KeePassOTP plugin
            if (hookPluginTimers.Contains("KeePass") && !hookPluginTimers.Contains("KeePassOTP.m_columnOTP.m_columnRefreshTimer"))
            {
                hookPluginTimers += ",KeePassOTP.m_columnOTP.m_columnRefreshTimer";
            }
            //Quick & Dirty fix as KeeTrayTotp renamed the private member starting with v0.103.0
            if (hookPluginTimers.Contains("KeeTrayTOTP") && !hookPluginTimers.Contains("KeeTrayTOTP._liRefreshTimer"))
            {
                hookPluginTimers += ",KeeTrayTOTP._liRefreshTimer";
            }
            m_conf.SetString(m_ConfigOtherTimers, hookPluginTimers);
            string[] sTimers = hookPluginTimers.Split(',');
            for (int i = 0; i < sTimers.Length; i++)
            {
                string sTimer = sTimers[i].Trim().Replace(" ", string.Empty);
                if (!string.IsNullOrEmpty(sTimer) && !lTimer.Contains(sTimer))
                {
                    lTimer.Add(sTimer);
                }
            }
            return(lTimer);
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
        private Version GetSavedSettingsPluginVersion()
        {
            var     versionStr = _customConfig.GetString(CFG_SAVED_SETTINGS_PLUGIN_VERSION, null);
            Version version;

            if (!Version.TryParse(versionStr, out version))
            {
                if (_customConfig.GetString(DEPRECATED_CFG_AUTO_PROMPT, null) != null)
                {
                    version = new Version(1, 0);
                }
                else
                {
                    version = new Version(2, 0);
                }
            }
            return(version);
        }
Ejemplo n.º 5
0
        public string GetCustomDownloadProvider()
        {
            if (string.IsNullOrEmpty(m_customDownloadProvider))
            {
                m_customDownloadProvider = config.GetString(customDownloadProvider, "");
            }

            return(m_customDownloadProvider);
        }
Ejemplo n.º 6
0
        public Configuration(AceCustomConfig config)
        {
            _config = config;

            if (_config.GetString(KeyIdName, null) != null)
            {
                return;
            }
            _config.SetString(KeyIdName, "");
            _config.SetString(ApplicationKeyName, "");
            _config.SetBool(SyncOnSaveName, false);
            _config.SetBool(SyncOnLoadName, false);
        }
        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);
        }
Ejemplo n.º 8
0
 public static string GetCurrentTransliterationName(this AceCustomConfig customConfig, string defaultValue = "")
 {
     return(customConfig.GetString("CurrentTransliteration", defaultValue));
 }