Exemple #1
0
        public static Helper.KeycodeData getAlternateKeyBindings(String sTheText)
        {
            Helper.KeycodeData kcData = new Helper.KeycodeData();
            kcData.NumOfCodes = 0;
            kcData.kCode1     = KeyCode.None;
            kcData.kCode2     = KeyCode.None;
            kcData.kCode3     = KeyCode.None;
            try
            {
                string[] sArray = sTheText.Split(',');
                byte     ilen   = (byte)sArray.Length;
                if (ilen <= 1)
                {
                    return(kcData);
                }

                if (ilen == 2)
                {
                    kcData.kCode1     = (KeyCode)Enum.Parse(typeof(KeyCode), sArray[0].ToString());
                    kcData.kCode2     = (KeyCode)Enum.Parse(typeof(KeyCode), sArray[1].ToString());
                    kcData.NumOfCodes = 2;
                }
                else
                {
                    kcData.kCode1     = (KeyCode)Enum.Parse(typeof(KeyCode), sArray[0].ToString());
                    kcData.kCode2     = (KeyCode)Enum.Parse(typeof(KeyCode), sArray[1].ToString());
                    kcData.kCode3     = (KeyCode)Enum.Parse(typeof(KeyCode), sArray[2].ToString());
                    kcData.NumOfCodes = 3;
                }
                if (Mod.DEBUG_LOG_ON)
                {
                    Helper.dbgLog("Alternate Keys bound: " + kcData.NumOfCodes.ToString());
                }
            }
            catch (Exception ex)
            {
                Helper.dbgLog(ex.Message.ToString(), ex, true);
            }

            if ((kcData.kCode1 == KeyCode.None) || kcData.kCode2 == KeyCode.None)
            {
                kcData.kCode1     = KeyCode.LeftControl; kcData.kCode2 = KeyCode.LeftAlt; kcData.kCode3 = KeyCode.L;
                kcData.NumOfCodes = 3;
                Helper.dbgLog("Alternate Keys enabled but used incorrectly, using default alternate.");
            }
            return(kcData);
        }
Exemple #2
0
        public static Helper.KeycodeData getAlternateKeyBindings(String sTheText)
        {
            Helper.KeycodeData kcData = new Helper.KeycodeData();
            kcData.NumOfCodes = 0;
            kcData.kCode1 = KeyCode.None;
            kcData.kCode2 = KeyCode.None;
            kcData.kCode3 = KeyCode.None;
            try
            {
                string[] sArray = sTheText.Split(',');
                byte ilen = (byte)sArray.Length;
                if (ilen <= 1)
                { return kcData; }

                if (ilen == 2)
                {
                    kcData.kCode1 = (KeyCode)Enum.Parse(typeof(KeyCode), sArray[0].ToString());
                    kcData.kCode2 = (KeyCode)Enum.Parse(typeof(KeyCode), sArray[1].ToString());
                    kcData.NumOfCodes = 2;
                }
                else
                {
                    kcData.kCode1 = (KeyCode)Enum.Parse(typeof(KeyCode), sArray[0].ToString());
                    kcData.kCode2 = (KeyCode)Enum.Parse(typeof(KeyCode), sArray[1].ToString());
                    kcData.kCode3 = (KeyCode)Enum.Parse(typeof(KeyCode), sArray[2].ToString());
                    kcData.NumOfCodes = 3;
                }
                if (Mod.DEBUG_LOG_ON)
                { Helper.dbgLog("Alternate Keys bound: " + kcData.NumOfCodes.ToString()); }

            }
            catch (Exception ex)
            {
                Helper.dbgLog(ex.Message.ToString(), ex, true);
            }

            if ((kcData.kCode1 == KeyCode.None) || kcData.kCode2 == KeyCode.None)
            {
                kcData.kCode1 = KeyCode.LeftControl; kcData.kCode2 = KeyCode.LeftAlt; kcData.kCode3 = KeyCode.L;
                kcData.NumOfCodes = 3;
                Helper.dbgLog("Alternate Keys enabled but used incorrectly, using default alternate.");
            }
            return kcData;
        }