Ejemplo n.º 1
0
        private bool Send(object key, KeyboardLocale locale)
        {
            if (key is Keys mKey)
            {
                if (mKey != Keys.None)
                {
                    Send(KeyPress, mKey);
                }
            }
            else if (key is string sKey)
            {
                Send(Text, sKey);
            }
            else if (key is int[] aKey)
            {
                Send(IntKeys, aKey);
            }
            else if (key is LocaleDictionary ld)
            {
                if (ld.TryGetValue(locale, out object loKey))
                {
                    return(Send(loKey, locale));
                }
                else if (ld.TryGetValue(KeyboardLocale.ANY_OTHER, out object aoKey))
                {
                    return(Send(aoKey, locale));
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                throw new Exception("Unsupported type: " + key.GetType());
            }

            return(true);
        }
Ejemplo n.º 2
0
        public bool Send(Keys key, KeyDictionary mappings, int keyboardLayout)
        {
            KeyboardLocale locale = KeyboardLocaleResolver(keyboardLayout);

            return(mappings.TryGetValue(key, out object mapped) && Send(mapped, locale));
        }