Ejemplo n.º 1
0
        public string GetKeyNameFromCode(int code)
        {
            int scanCode = KeyHasher.GetScanCodeFromHash(code);
            int extended = KeyHasher.GetExtendedFromHash(code);

            string expression = @"/KeycodeData/keycodes[sc = '" + scanCode.ToString(CultureInfo.InvariantCulture.NumberFormat) + "' and ex = '" + extended.ToString(CultureInfo.InvariantCulture.NumberFormat) + "'] ";

            var iterator = _navigator.Select(expression);

            string name = string.Empty;

            if (iterator.Count == 1)
            {
                iterator.MoveNext();
                name = GetElementValue("name", iterator.Current);
            }

            return(name);
        }
Ejemplo n.º 2
0
        private void GetLocalizableKeyNames()
        {
            localizableKeyNames.Clear();

            foreach (int hash in localizableKeys)
            {
                // None of the localizable names need the extended bit.
                int scanCode = KeyHasher.GetScanCodeFromHash(hash);

                // Need to track if a localizable key is a symbol - shifter-symbol
                // combination but it's length is not 3 - i.e. instead of 1 and !
                // it is Qaf and RehYehAlefLam (as on the Farsi keyboard)

                bool   overlong = false;
                string name     = KeyboardHelper.GetKeyName(scanCode, ref overlong);

                nonLocalizableKeyNames.Add(hash, name);
                if (overlong)
                {
                    // Console.WriteLine("Adding overlong key: code {0} name length: {1} name: {2}", hash, name.Length, name);
                    overLongKeys.Add(hash);
                }
            }
        }