Exemplo n.º 1
0
        public ParseEvents(List<String> keys, List<String> values, string line)
        {
            MatchCollection m;
            string s;

            m = Regex.Matches(line, @"(addEventListener|removeEventListener)[ \(\w]*");
            if (m.Count == 0) return;
            s = line.Substring(line.IndexOf(m[0].Value) + m[0].Value.Length);
            if (s.Substring(0,1) != ".") return;
            s = s.Substring(1);
            
            m = Regex.Matches(s, @"[\w]*");
            if (m.Count == 0) return;
            name = m[0].Value;
            //TraceManager.Add("name:" + name);

            s = s.Split(',')[1];
            m = Regex.Matches(s, @"[ \w]*");
            if (m.Count == 0) return;
            callback = m[0].Value.Trim();
            //TraceManager.Add("callback:" + callback);

            switchName = PluginMain.SwitchValue(keys, values, name);
            //TraceManager.Add("switchName:" + switchName);

            //int idx = -1;
            Variations v1 = new Variations(name);
            //TraceManager.Add("v1.allLowerCase: " + v1.allLowerCase);
            //TraceManager.Add("v1.firstOnlyLowerCase: " + v1.firstOnlyLowerCase);
            //TraceManager.Add("v1.allUpperCase: " + v1.allUpperCase);
            //TraceManager.Add("v1.extractLowerCase: " + v1.extractLowerCase);
            //TraceManager.Add("v1.extractUpperCase: " + v1.extractUpperCase);

            Variations v2 = new Variations(switchName);
            //TraceManager.Add("v2.allLowerCase: " + v2.allLowerCase);
            //TraceManager.Add("v2.firstOnlyLowerCase: " + v2.firstOnlyLowerCase);
            //TraceManager.Add("v2.allUpperCase: " + v2.allUpperCase);
            //TraceManager.Add("v2.extractLowerCase: " + v2.extractLowerCase);
            //TraceManager.Add("v2.extractUpperCase: " + v2.extractUpperCase);

            switchCallback = callback;
            if (callback.IndexOf(v1.allLowerCase) > -1) SwitchCallback(v1.allLowerCase, v2.allLowerCase);
            else if (callback.IndexOf(v1.firstOnlyLowerCase) > -1) SwitchCallback(v1.firstOnlyLowerCase, v2.firstOnlyLowerCase);
            else if (callback.IndexOf(v1.allUpperCase) > -1) SwitchCallback(v1.allUpperCase, v2.allUpperCase);
            else if (callback.IndexOf(v1.extractLowerCase) > -1) SwitchCallback(v1.extractLowerCase, v2.extractLowerCase);
            else if (callback.IndexOf(v1.extractUpperCase) > -1) SwitchCallback(v1.extractUpperCase, v2.extractUpperCase);       
        }
Exemplo n.º 2
0
        public ParseEvents(List <String> keys, List <String> values, string line)
        {
            MatchCollection m;
            string          s;

            m = Regex.Matches(line, @"(addEventListener|removeEventListener)[ \(\w]*");
            if (m.Count == 0)
            {
                return;
            }
            s = line.Substring(line.IndexOf(m[0].Value) + m[0].Value.Length);
            if (s.Substring(0, 1) != ".")
            {
                return;
            }
            s = s.Substring(1);

            m = Regex.Matches(s, @"[\w]*");
            if (m.Count == 0)
            {
                return;
            }
            name = m[0].Value;
            //TraceManager.Add("name:" + name);

            s = s.Split(',')[1];
            m = Regex.Matches(s, @"[ \w]*");
            if (m.Count == 0)
            {
                return;
            }
            callback = m[0].Value.Trim();
            //TraceManager.Add("callback:" + callback);

            switchName = PluginMain.SwitchValue(keys, values, name);
            //TraceManager.Add("switchName:" + switchName);

            //int idx = -1;
            Variations v1 = new Variations(name);
            //TraceManager.Add("v1.allLowerCase: " + v1.allLowerCase);
            //TraceManager.Add("v1.firstOnlyLowerCase: " + v1.firstOnlyLowerCase);
            //TraceManager.Add("v1.allUpperCase: " + v1.allUpperCase);
            //TraceManager.Add("v1.extractLowerCase: " + v1.extractLowerCase);
            //TraceManager.Add("v1.extractUpperCase: " + v1.extractUpperCase);

            Variations v2 = new Variations(switchName);

            //TraceManager.Add("v2.allLowerCase: " + v2.allLowerCase);
            //TraceManager.Add("v2.firstOnlyLowerCase: " + v2.firstOnlyLowerCase);
            //TraceManager.Add("v2.allUpperCase: " + v2.allUpperCase);
            //TraceManager.Add("v2.extractLowerCase: " + v2.extractLowerCase);
            //TraceManager.Add("v2.extractUpperCase: " + v2.extractUpperCase);

            switchCallback = callback;
            if (callback.IndexOf(v1.allLowerCase) > -1)
            {
                SwitchCallback(v1.allLowerCase, v2.allLowerCase);
            }
            else if (callback.IndexOf(v1.firstOnlyLowerCase) > -1)
            {
                SwitchCallback(v1.firstOnlyLowerCase, v2.firstOnlyLowerCase);
            }
            else if (callback.IndexOf(v1.allUpperCase) > -1)
            {
                SwitchCallback(v1.allUpperCase, v2.allUpperCase);
            }
            else if (callback.IndexOf(v1.extractLowerCase) > -1)
            {
                SwitchCallback(v1.extractLowerCase, v2.extractLowerCase);
            }
            else if (callback.IndexOf(v1.extractUpperCase) > -1)
            {
                SwitchCallback(v1.extractUpperCase, v2.extractUpperCase);
            }
        }