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(); }
public XmlNode GenerateXML() { // Create XML Node and Attributes XmlDocument d = new XmlDocument(); XmlNode output = d.CreateNode("element", "Case", null); XmlAttribute caseInsensitive = d.CreateAttribute("CaseInsensitive"); XmlAttribute dontEval = d.CreateAttribute("DontEval"); XmlAttribute regEx = d.CreateAttribute("RegEx"); XmlAttribute condition = d.CreateAttribute("Condition"); // Set Attribute Values caseInsensitive.Value = CaseInsensitive.ToString(); dontEval.Value = DontEval.ToString(); regEx.Value = RegEx; condition.Value = Condition; // Append Attributes output.Attributes.Append(caseInsensitive); output.Attributes.Append(dontEval); output.Attributes.Append(regEx); if (!string.IsNullOrEmpty(Condition)) { output.Attributes.Append(condition); } // Append Children foreach (Variable v in SubChildren) { XmlNode importNode = d.ImportNode(v.GenerateXML(), true); output.AppendChild(importNode); } return(output); }
/// <summary> /// Returns value of the actual instance if the specified key equals to the one stored in the actual instance. /// </summary> /// <param name="key">Key.</param> /// <param name="value">Variable to return the value to.</param> /// <returns> /// <c>true</c> if value has been found, <c>false</c> otherwise. /// </returns> public bool TryGetValue(CaseInsensitive key, out object value) { if (Key == key) { value = Value; return(true); } value = null; return(false); }
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(); }
public bool TryGetValue(CaseInsensitive key, out object value) { foreach (var kv in Builder) { var item = kv.Value; if (item.TryGetValue(key, out var v)) { value = v; return(true); } } value = default(object); return(false); }
bool IMetadata.TryGetValue(CaseInsensitive key, out object value) { if (KeyMaxLength == key) { value = MaxLength; return(true); } if (KeyMinLength == key && MinLength.HasValue) { value = MinLength.Value; return(true); } value = default(object); return(false); }
bool IMetadata.TryGetValue(CaseInsensitive key, out object value) { if (KeyPrecision == key) { value = PrecisionValue; return(true); } if (KeyScale == key) { value = Scale; return(true); } value = default(object); return(false); }
public void Serialize_ShouldIgnoreProperty_GivenDifferingCaseAndCaseInsensitiveFalse() { var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = false, }; var instance = CaseInsensitive.Random(); var context = new Context <CaseInsensitive>( instance, options ); var json = "{\"vAlUe\":123,\"REALLYlongPropertyNameThatGoesBeyond256Characters________________________________________________________________________________________________________________________________________________________________________________________________________________\":456}"; var expected = (0, 0); var result = JsonSerializer.Deserialize <CaseInsensitive>(json, options); var actual = (result.Value, result.ReallyLongPropertyNameThatGoesBeyond256Characters________________________________________________________________________________________________________________________________________________________________________________________________________________); Assert.Equal(expected, actual); }
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(); }
public MetadataFlag(bool value, CaseInsensitive dataKey) : base(value, dataKey) { }
public MetadataValue(T value, CaseInsensitive dataKey) { Value = value; Key = dataKey; }
MetadataKeyAttribute(CaseInsensitive key) => Key = key;
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(); }
/// <inheritdoc /> public bool TryGetValue(CaseInsensitive key, out object value) => RawMetadata.TryGetValue(key, out value);