示例#1
0
 private bool ProcessKey(int KeyCode, Key Key)
 {
     switch (Key.KeyType)
     {
         case Key.KeyTypes.Vowel:
             return ProcessVowel(Key.Telugu1, Key.Telugu2);
         case Key.KeyTypes.Consonant:
             return ProcessConsonant(Key.Telugu1);
         case Key.KeyTypes.Number:
             return ProcessNumber(Key.Telugu1);
         case Key.KeyTypes.Special:
             switch (KeyCode)
             {
                 case 65: //a
                     return ProcessA();
                 case 72: //h
                     return ProcessH();
             }
             break;
     }
     return false;
 }
示例#2
0
        private static void ParseKeyFile()
        {
            try
            {
                String[] Rows = LoadKeyFile();
                if (Rows == null || Rows.Length == 0) return;
                String[] Row;

                for (int i = 0; i < Rows.Length; i++)
                {
                    if (Rows[i].StartsWith("#")) continue;
                    Row = Rows[i].Split(";".ToCharArray());
                    if (Row.Length < 6) continue;

                    //0: Key code
                    //1: Telugu1
                    //2: Telugu2
                    //3: Type
                    //4: Shift
                    //5: AltGr
                    //6: SpecialFunction

                    Key Key = new Key();
                    Key.Telugu1 = Row[1].Trim();
                    Key.Telugu2 = Row[2].Trim();

                    switch (Row[3].Trim().ToLower())
                    {
                        case "number":
                            Key.KeyType = SaPhoTeKeyboard.Key.KeyTypes.Number;
                            break;
                        case "consonant":
                            Key.KeyType = SaPhoTeKeyboard.Key.KeyTypes.Consonant;
                            break;
                        case "vowel":
                            Key.KeyType = SaPhoTeKeyboard.Key.KeyTypes.Vowel;
                            break;
                    }

                    if (Row[6].Trim().ToLower() == "1") Key.KeyType = SaPhoTeKeyboard.Key.KeyTypes.Special;
                    if (Row[4].Trim().ToLower() == "1")
                    {
                        _Shift.Add(int.Parse(Row[0]), Key);
                    }
                    else if (Row[5].Trim().ToLower() == "1")
                    {
                        _AltGr.Add(int.Parse(Row[0]), Key);
                    }
                    else
                    {
                        _Normal.Add(int.Parse(Row[0]), Key);
                    }
                }
            }
            catch (Exception ex)
            {
                Helpers.ShowError("ParseKeyFile", ex);
            }
        }