public void AddWatch(String exp) { if (!watches.ContainsKey(exp)) { SquirrelWatch w = new SquirrelWatch(); w.expression = exp; w.id = lastwatchid++; w.lastevaluated = snapshotid; watches.Add(w.expression, w); _AddWatch(w.id, exp); } else { SquirrelWatch w = watches[exp]; w.lastevaluated = snapshotid; } }
void CollectWatches() { List <string> watchestodelete = new List <string>(); foreach (SquirrelWatch w in watches.Values) { if (w.lastevaluated < snapshotid) { watchestodelete.Add(w.expression); } } foreach (string s in watchestodelete) { SquirrelWatch w = watches[s]; _RemoveWatch(w.id); watches.Remove(s); //Console.WriteLine("removing " + w.expression); } }