Exemple #1
0
        public Dictionary <string, KeyExecutor> readFile(string path)
        {
            string[] fileContent = System.IO.File.ReadAllLines(path);
            Dictionary <string, KeyExecutor> executors = new Dictionary <string, KeyExecutor>();

            foreach (string line in fileContent)
            {
                string line_wc = line;
                keyManager.clear();
                multiKeyManager.clear();
                keyCombinationManager.clear();
                keyAxisManager.clear();

                Match match = Regex.Match(line_wc, @"^(A?\d+)\s*-\s*([\w\s+,|]+)$");
                if (match.Success)
                {
                    string id = match.Groups[1].Value;
                    line_wc = Regex.Replace(match.Groups[2].Value, @"\s", "");

                    line_wc = keyManager.replaceAll(line_wc);
                    line_wc = multiKeyManager.replaceAll(line_wc);
                    line_wc = keyCombinationManager.replaceAll(line_wc);
                    line_wc = keyAxisManager.replaceAll(line_wc);

                    if (Regex.IsMatch(line_wc, @"\$\d+\w+%"))
                    {
                        TokenManager highestLevel = keyAxisManager.getHighestLevel();
                        if (highestLevel != null)
                        {
                            highestLevel.buildExecutorTree(line_wc, id, executors);
                        }
                    }
                }
            }
            return(executors);
        }