示例#1
0
        public static void LoadConfig()
        {
            // The key used as the compose key
            ComposeKey.Load();

            if (!m_valid_compose_keys.Contains(ComposeKey.Value))
            {
                ComposeKey.Value = m_default_compose_key;
            }

            // The timeout delay
            ResetDelay.Load();

            // Activate the desired interface language
            Language.Load();

            // HACK: if the user uses the "it-CH" locale, replace it with "it"
            // because we use "it-CH" as a special value to mean Sardinian.
            // The reason is that apparently we cannot define a custom
            // CultureInfo without registering it, and we cannot register it
            // without administrator privileges.
            if (Thread.CurrentThread.CurrentUICulture.Name == "it-CH")
            {
                try
                {
                    Thread.CurrentThread.CurrentUICulture
                        = Thread.CurrentThread.CurrentUICulture.Parent;
                }
                catch (Exception) { }
            }

            if (Language.Value != "")
            {
                if (m_valid_languages.ContainsKey(Language.Value))
                {
                    try
                    {
                        var ci = CultureInfo.GetCultureInfo(Language.Value);
                        Thread.CurrentThread.CurrentUICulture = ci;
                    }
                    catch (Exception) { }
                }
                else
                {
                    Language.Value = "";
                }
            }

            // Catch-22: we can only add this string when the UI language is known
            m_valid_languages[""] = i18n.Text.AutodetectLanguage;

            // Various options
            CaseInsensitive.Load();
            DiscardOnInvalid.Load();
            BeepOnInvalid.Load();
            KeepOriginalKey.Load();
            InsertZwsp.Load();
            EmulateCapsLock.Load();
            ShiftDisablesCapsLock.Load();
        }
示例#2
0
 public static void SaveConfig()
 {
     SaveEntry("reset_delay", m_delay.ToString());
     Language.Save();
     ComposeKey.Save();
     CaseInsensitive.Save();
     DiscardOnInvalid.Save();
     BeepOnInvalid.Save();
     KeepOriginalKey.Save();
     InsertZwsp.Save();
     EmulateCapsLock.Save();
     ShiftDisablesCapsLock.Save();
 }
示例#3
0
        public static void SaveConfig()
        {
            // FIXME: this is illegal if not in the STA thread
            //Log.Debug("Saving configuration file {0}", GetConfigFile());
            Console.WriteLine("Saving configuration file {0}", GetConfigFile());

            SaveEntry("reset_delay", m_delay.ToString());
            Language.Save();
            ComposeKeys.Save();
            Disabled.Save();
            UnicodeInput.Save();
            CaseInsensitive.Save();
            DiscardOnInvalid.Save();
            BeepOnInvalid.Save();
            KeepOriginalKey.Save();
            InsertZwsp.Save();
            EmulateCapsLock.Save();
            ShiftDisablesCapsLock.Save();
            CapsLockCapitalizes.Save();
            AllowInjected.Save();
        }
示例#4
0
        public static void LoadConfig()
        {
            // FIXME: this is illegal if not in the STA thread
            //Log.Debug("Reloading configuration file {0}", GetConfigFile());
            Console.WriteLine("Reloading configuration file {0}", GetConfigFile());

            // The keys used as the compose keys
            ComposeKeys.Load();
            ValidateComposeKeys();

            // The timeout delay
            ResetDelay.Load();

            // Activate the desired interface language
            Language.Load();

            // HACK: if the user uses the "it-CH" locale, replace it with "it"
            // because we use "it-CH" as a special value to mean Sardinian.
            // The reason is that apparently we cannot define a custom
            // CultureInfo without registering it, and we cannot register it
            // without administrator privileges.
            // Same with "de-CH" which we use for Esperanto, and "be-BY" which
            // we use for Latin Belarus… this is ridiculous, Microsoft.
            if (Thread.CurrentThread.CurrentUICulture.Name == "it-CH" ||
                Thread.CurrentThread.CurrentUICulture.Name == "de-CH" ||
                Thread.CurrentThread.CurrentUICulture.Name == "be-BY")
            {
                try
                {
                    Thread.CurrentThread.CurrentUICulture
                        = Thread.CurrentThread.CurrentUICulture.Parent;
                }
                catch (Exception) { }
            }

            if (Language.Value != "")
            {
                if (m_valid_languages.ContainsKey(Language.Value))
                {
                    try
                    {
                        var ci = CultureInfo.GetCultureInfo(Language.Value);
                        Thread.CurrentThread.CurrentUICulture = ci;
                    }
                    catch (Exception) { }
                }
                else
                {
                    Language.Value = "";
                }
            }

            // Catch-22: we can only add this string when the UI language is known
            m_valid_languages[""] = i18n.Text.AutodetectLanguage;

            // Various options
            Disabled.Load();
            UnicodeInput.Load();
            CaseInsensitive.Load();
            DiscardOnInvalid.Load();
            BeepOnInvalid.Load();
            KeepOriginalKey.Load();
            InsertZwsp.Load();
            EmulateCapsLock.Load();
            ShiftDisablesCapsLock.Load();
            CapsLockCapitalizes.Load();
            AllowInjected.Load();
        }