Exemple #1
0
        private static void WifiZoneFlow(
            List <string> current_near_wifis,
            List <string> latest_ruleset,
            Action insideBlockZone, Action outsideBlockZone, Action <List <string> > updateRules
            )
        {
            if (current_near_wifis.Count > 0)
            {
                List <string> newRuleSet = new List <string>();
                string        reason     = "init";
                if (WifiHelper.fastBlockZoneCheck(current_near_wifis, latest_ruleset, out newRuleSet, (text) => log(text), out reason))
                {
                    // Update all rules with bad ones:

                    // TODO: get new rules by call not changing them

                    updateRules?.Invoke(latest_ruleset);
                    log("Reason blocked: " + reason);
                    insideBlockZone?.Invoke();
                }
                else
                {
                    outsideBlockZone?.Invoke();
                }
            }
            else
            {
                log("Found 0 wifis, assume blockzone");
                insideBlockZone?.Invoke();
            }
        }
Exemple #2
0
        public List <string> TestWifiBlocked(bool inBlockZone, List <string> current, List <string> rules)
        {
            List <string> newRules;
            string        reason = "";

            Assert.AreEqual(inBlockZone, WifiHelper.fastBlockZoneCheck(
                                current, rules, out newRules, (s) => Console.WriteLine(s), out reason
                                ));
            return(newRules);
        }