Ejemplo n.º 1
0
        public string TranslateInputName(string inputName, string zone)
        {
            string input = "";

            // If inputName is renamed value we changed it to original
            if (InputSources.ContainsKey(inputName))
            {
                inputName = InputSources[inputName];
            }
            // Search for mapping
            if (InputMap.ContainsKey(inputName))
            {
                input = InputMap[inputName];
            }
            // If there is no mapping maybe value is already mapped value
            if (InputMap.ContainsValue(inputName))
            {
                input = inputName;
            }

            if (!string.IsNullOrWhiteSpace(input))
            {
                if (zone == "1")
                {
                    input = $"SI{input}";
                }
                else
                {
                    input = $"Z{zone}{input}";
                }
            }

            return(input);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrives the action associated with the given console key.
        /// </summary>
        /// <param name="keyInfo">The key that was pressed.</param>
        /// <returns>An action that the key is associated with. If the key has no associated action, will return null instead.</returns>
        public Action GetActionForKey(ConsoleKeyInfo keyInfo)
        {
            InputKey key = GetInputKeyFromInput(keyInfo);

            if (InputMap.ContainsKey(key))
            {
                return(InputMap[key]);
            }
            else
            {
                return(null);
            }
        }