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) + "'] ";

            XPathNodeIterator iterator = (XPathNodeIterator)_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);
                }
            }
        }